{"id":16012505,"url":"https://github.com/bircher/drupalgap-offline","last_synced_at":"2025-04-05T02:42:04.809Z","repository":{"id":17825955,"uuid":"20728405","full_name":"bircher/drupalgap-offline","owner":"bircher","description":"offline module for drupalgap","archived":false,"fork":false,"pushed_at":"2014-08-25T22:13:43.000Z","size":152,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T11:09:33.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bircher.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-11T14:32:49.000Z","updated_at":"2017-01-04T00:34:44.000Z","dependencies_parsed_at":"2022-09-10T18:03:07.549Z","dependency_job_id":null,"html_url":"https://github.com/bircher/drupalgap-offline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bircher%2Fdrupalgap-offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bircher%2Fdrupalgap-offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bircher%2Fdrupalgap-offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bircher%2Fdrupalgap-offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bircher","download_url":"https://codeload.github.com/bircher/drupalgap-offline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280177,"owners_count":20912965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T14:03:44.468Z","updated_at":"2025-04-05T02:42:04.782Z","avatar_url":"https://github.com/bircher.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"offline\n=======\n\nMake the drupalgap app save the content offline\n\nSetup\n=====\n\nClone this repository as \"offline\" in your apps modules directory and enable it like another contrib module.\n\nThe module is currently only tested for anonymous users.\n\nThe module caches the connection so that it can be started in offline mode.\nThe intended purpose is to work with indefinite cache enabled and then reloading the cached nodes when the user clicks on refresh.\ncall the provided offline_refresh_node(nid) to make this smoother.\n\n\nTo be able to start the app in offline mode you will have to implement the menu callback for `offline`\nfor example:\n\n```js\n/**\n * Implements hook_menu().\n */\nfunction mymodule_menu() {\n  var items = {};\n\n  // the core offline page is herewith overridden and we serve the normal content.\n  items['offline'] = {\n    title: 'Offline mode',\n    page_callback: 'mymodule_offline_page'\n  }\n  return items;\n}\n\n\n/**\n * Call back for the offline page.\n * @return {Object}\n */\nfunction mymodule_offline_page() {\n  try {\n    if (variable_get('offline_connect', false)) {\n      drupalgap_goto('start'); // the normal start you use...\n    }\n  \n    var content = {\n      'message': {\n        'markup': '\u003ch2\u003eFailed Connection\u003c/h2\u003e' +\n          \"\u003cp\u003eThe first time the app is used it needs to connect to the internet in order to fetch the content.\u003c/p\u003e\"\n      },\n      'try_again': {\n        'theme': 'button',\n        'text': 'Try Again',\n        'attributes': {\n          'onclick': 'javascript:offline_try_again();'\n        }\n      },\n      'footer': {\n        'markup': \"\u003cp\u003eCheck your device's network settings and try again.\u003c/p\u003e\"\n      }\n    };\n    return content;\n  }\n  catch (error) { console.log('mymodule_offline_page - ' + error); }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbircher%2Fdrupalgap-offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbircher%2Fdrupalgap-offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbircher%2Fdrupalgap-offline/lists"}