From aeccb1324dad2e0ee3429a699d9d68f44ef950fc Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Wed, 30 Jan 2013 23:07:57 -0200 Subject: [PATCH] Try to install application. Tries to install the application from its manifest, using a blank icon and updating a status div. --- images/pomo-128.png | Bin 0 -> 330 bytes index.html | 3 +++ install.js | 33 +++++++++++++++++++++++++++++++++ pomo.webapp | 14 ++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 images/pomo-128.png create mode 100644 install.js create mode 100644 pomo.webapp diff --git a/images/pomo-128.png b/images/pomo-128.png new file mode 100644 index 0000000000000000000000000000000000000000..a5f1cf6fe851d5a4de3359ed27cfc2633cd6f501 GIT binary patch literal 330 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1SEZ8zRdwroCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#E~7kysLLV0FMhJw4NZ$Nk>pEyv_ z5l Pomo + +
+
diff --git a/install.js b/install.js new file mode 100644 index 0000000..0cdde11 --- /dev/null +++ b/install.js @@ -0,0 +1,33 @@ +function status_update(stat_str) { + var stat_el = document.getElementById("status"); + stat_el.innerHTML = stat_str; +} + +function install() { + status_update("Installing"); + var app = navigator.mozApps.install("http://pomo.cascardo.info/pomo.webapp"); + app.onsuccess = function() { + status_update("Application installed now"); + } + app.onerror = function() { + status_update("Error installing app: " + app.error.name); + } +} + +function check_install() { + var app = navigator.mozApps.getSelf(); + app.onsuccess = function() { + if (app.result) { + status_update("Installed"); + } else { + status_update("Not Installed"); + install(); + } + }; + app.onerror = function() { + var stat = document.getElementById("status"); + status_update("Installing app not supported"); + status_update("Skipping installation"); + }; +} +check_install(); diff --git a/pomo.webapp b/pomo.webapp new file mode 100644 index 0000000..197a4ae --- /dev/null +++ b/pomo.webapp @@ -0,0 +1,14 @@ +{ + "name": "Pomo", + "description": "Pomodoro", + "launch_path": "/", + "icons": { + "128": "/images/pomo-128.png" + }, + "developer": { + "name": "Thadeu Lima de Souza Cascardo", + "url": "http://cascardo.info/" + }, + "default_locale": "en", + "appcache_path": "/index.manifest" +} -- 2.20.1