From 943dff7b6985c50a08831ddc69d4e018893b2435 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 11 Oct 2013 14:42:08 -0700 Subject: [PATCH] Add option to install locally with firefox --- clientapp/models/state.js | 14 +++++++++++++- clientapp/pages/main.js | 4 ++++ clientapp/template.html | 1 + clientapp/templates.js | 2 +- clientapp/templates/pages/main.jade | 3 ++- public/images/icon_128x128.png | Bin 0 -> 8482 bytes public/manifest.webapp | 7 +++++++ server.js | 5 +++++ 8 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 public/images/icon_128x128.png create mode 100644 public/manifest.webapp diff --git a/clientapp/models/state.js b/clientapp/models/state.js index 233e069..022936e 100644 --- a/clientapp/models/state.js +++ b/clientapp/models/state.js @@ -24,6 +24,16 @@ module.exports = HumanModel.define({ }, true); } + if (navigator.mozApps) { + this.installable = true; + var req = navigator.mozApps.checkInstalled(window.location.origin + '/manifest.webapp'); + req.onsuccess = function (e) { + if (req.result) { + self.installedFirefox = true; + } + }; + } + this.markActive(); }, session: { @@ -35,7 +45,9 @@ module.exports = HumanModel.define({ idleSince: 'date', allowAlerts: ['bool', true, false], badge: ['string', true, ''], - pageTitle: ['string', true, ''] + pageTitle: ['string', true, ''], + installable: ['bool', true, false], + installedFirefox: ['bool', true, false] }, derived: { title: { diff --git a/clientapp/pages/main.js b/clientapp/pages/main.js index 4f5f876..2005e90 100644 --- a/clientapp/pages/main.js +++ b/clientapp/pages/main.js @@ -19,6 +19,7 @@ module.exports = BasePage.extend({ }, events: { 'click .enableAlerts': 'enableAlerts', + 'click .installFirefox': 'installFirefox', 'dragover': 'handleAvatarChangeDragOver', 'drop': 'handleAvatarChange', 'change #uploader': 'handleAvatarChange', @@ -39,6 +40,9 @@ module.exports = BasePage.extend({ } }); }, + installFirefox: function () { + navigator.mozApps.install(window.location.origin + '/manifest.webapp'); + }, handleAvatarChangeDragOver: function (e) { e.preventDefault(); return false; diff --git a/clientapp/template.html b/clientapp/template.html index 327c8bc..6cc52e4 100644 --- a/clientapp/template.html +++ b/clientapp/template.html @@ -11,6 +11,7 @@

Connecting...

+ Cancel
diff --git a/clientapp/templates.js b/clientapp/templates.js index 6d4d341..0c8123c 100644 --- a/clientapp/templates.js +++ b/clientapp/templates.js @@ -178,7 +178,7 @@ exports.pages.groupchat = function anonymous(locals) { exports.pages.main = function anonymous(locals) { var buf = []; with (locals || {}) { - buf.push('

Current status

Change Avatar

Drag and drop a new avatar here

Alerts

'); + buf.push('

Current status

Change Avatar

Drag and drop a new avatar here

Desktop Integration

'); } return buf.join(""); }; diff --git a/clientapp/templates/pages/main.jade b/clientapp/templates/pages/main.jade index 0e229c2..b01e9fd 100644 --- a/clientapp/templates/pages/main.jade +++ b/clientapp/templates/pages/main.jade @@ -13,5 +13,6 @@ section.page.main input#uploader(type="file") div - h3 Alerts + h3 Desktop Integration button.enableAlerts Enable alerts + button.installFirefox Install app diff --git a/public/images/icon_128x128.png b/public/images/icon_128x128.png new file mode 100644 index 0000000000000000000000000000000000000000..b6d4db37f959f2f2d0016066804195a759299110 GIT binary patch literal 8482 zcma(%RaX=Yu)B13=hBEE9n!JV9TEadNk~h_(w&mh9n!IcfUtCThm>@8*ZuAVCQt^o*N%6rV8{@XHU}PC3 z>dHY=xtdR)Aj&gPatRSvUX%_S#mr~vwzEM&E1a!dLEdM-7nhFt1X*XZ&E1SetJm=6 zapdFr$32lf;}x(N#HKNWTqh#6qB?tmF(s*#BsoVVY8p1Hgg9GqpvsXjGDh&Bi}-H* zXp=e$ZR8~3^i}ni0q!0BcPf%ztc0^o-_6J4u&!Qz~vnd3TY%pn4$APky-ZBAJm1z2XVv{r8 zxtaS7_d}-J^|4W~-cwd_i}`Qd$hG&k+8vP+3ys%Q=SsDZnid69f8_i4$7x>#Pg;%Z zvP7us+MXN)Qbn|evWDz4Sdh1X6tVy+ZkIlmso|+Vv;u1EqhfuFX@P0e3nREMO5@L5jC(K?)HF z{Ts>D*DDEqfU~C^<$FQ^fT~3SET!$ae3I>zr8Adu=5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