Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
|
|
@ -0,0 +1,9 @@
|
|||
;'use strict';(function(exports){var form;function init(){form=document.querySelector('form');form.addEventListener('submit',onFormSubmit);navigator.mozL10n.once(function(){sendNotification().catch((err)=>{console.error('Error while sending a notification',err);});});document.addEventListener('visibilitychange',onVisibilityChange);}
|
||||
function sendNotification(){var params=Utils.parseParams();var fromNotification=params.notification;if(fromNotification){return Promise.resolve();}
|
||||
return new Promise(function(resolve,reject){var titleL10n=params.title;var body=params.body;var req=navigator.mozApps.getSelf();req.onsuccess=function onsuccess(event){var app=event.target.result;NotificationHelper.send(titleL10n,{body:body,tag:''+Date.now(),icon:NotificationHelper.getIconURI(app),data:{title:titleL10n},closeOnClick:false}).then(function(notification){notification.onerror=function onerror(){reject(new Error('CMAS: notification API error'));};notification.onshow=resolve;});};req.onerror=function onerror(){reject(new Error('CMAS: App getSelf request error'));};});}
|
||||
function closeApp(){window.opener?window.opener.close():window.close();}
|
||||
function onFormSubmit(e){e.preventDefault();closeApp();}
|
||||
function onVisibilityChange(){if(document.hidden&&!document.querySelector('h1').clientHeight){closeApp();}}
|
||||
function render(){var params=Utils.parseParams();renderForm(params);var fromNotification=params.notification;if(!fromNotification){Notify.notify();}}
|
||||
function renderForm(params){var title=params.title;var body=params.body;form.querySelector('h1').setAttribute('data-l10n-id',title);form.querySelector('p').textContent=body;}
|
||||
exports.Attention={init,render};})(window);
|
||||
Loading…
Reference in a new issue