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:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1 @@
;window.COMPONENTS_BASE_URL='/shared/elements/';

View file

@ -0,0 +1,373 @@
;(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GaiaHeader=f()}})(function(){var define,module,exports;return(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){;(function(define){define(function(require,exports,module){'use strict';var debug=0?console.log.bind(console):function(){};var cache={};var MIN=16;var MAX=24;var BUFFER=3;module.exports=function(config){debug('font fit',config);var space=config.space-BUFFER;var min=config.min||MIN;var max=config.max||MAX;var text=trim(config.text);var fontSize=max;var textWidth;var font;do{font=config.font.replace(/\d+px/,fontSize+'px');textWidth=getTextWidth(text,font);}while(textWidth>space&&fontSize!==min&&fontSize--);return{textWidth:textWidth,fontSize:fontSize,overflowing:textWidth>space};};function getTextWidth(text,font){var ctx=getCanvasContext(font);var width=ctx.measureText(text).width;debug('got text width',width);return width;}
function getCanvasContext(font){debug('get canvas context',font);var cached=cache[font];if(cached){return cached;}
var canvas=document.createElement('canvas');canvas.setAttribute('moz-opaque','true');canvas.setAttribute('width','1px');canvas.setAttribute('height','1px');debug('created canvas',canvas);var ctx=canvas.getContext('2d',{willReadFrequently:true});ctx.font=font;return cache[font]=ctx;}
function trim(text){return text.replace(/\s+/g,' ').trim();}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('font-fit',this));},{}],2:[function(require,module,exports){;(function(define){'use strict';define(function(require,exports,module){var textContent=Object.getOwnPropertyDescriptor(Node.prototype,'textContent');var innerHTML=Object.getOwnPropertyDescriptor(Element.prototype,'innerHTML');var removeAttribute=Element.prototype.removeAttribute;var setAttribute=Element.prototype.setAttribute;var noop=function(){};exports.register=function(name,props){var baseProto=getBaseProto(props.extends);var template=props.template||baseProto.templateString;var extensible=props.extensible=props.hasOwnProperty('extensible')?props.extensible:true;delete props.extends;if(template){if(extensible&&props.template){props.templateString=props.template;}
var output=processCss(template,name);props.template=document.createElement('template');props.template.innerHTML=output.template;props.lightCss=output.lightCss;props.globalCss=props.globalCss||'';props.globalCss+=output.globalCss;}
injectGlobalCss(props.globalCss);delete props.globalCss;var descriptors=mixin(props.attrs||{},base.descriptors);props._attrs=props.attrs;delete props.attrs;var proto=createProto(baseProto,props);Object.defineProperties(proto,descriptors);try{return document.registerElement(name,{prototype:proto});}catch(e){if(e.name!=='NotSupportedError'){throw e;}}};var base={properties:{GaiaComponent:true,attributeChanged:noop,attached:noop,detached:noop,created:noop,createdCallback:function(){if(this.dirObserver){addDirObserver();}
injectLightCss(this);this.created();},attributeChangedCallback:function(name,from,to){var prop=toCamelCase(name);if(this._attrs&&this._attrs[prop]){this[prop]=to;}
this.attributeChanged(name,from,to);},attachedCallback:function(){if(this.dirObserver){this.setInnerDirAttributes=setInnerDirAttributes.bind(null,this);document.addEventListener('dirchanged',this.setInnerDirAttributes);}
this.attached();},detachedCallback:function(){if(this.dirObserver){document.removeEventListener('dirchanged',this.setInnerDirAttributes);}
this.detached();},setupShadowRoot:function(){if(!this.template){return;}
var node=document.importNode(this.template.content,true);this.createShadowRoot().appendChild(node);if(this.dirObserver){setInnerDirAttributes(this);}
return this.shadowRoot;},setAttr:function(name,value){var internal=this.shadowRoot.firstElementChild;setAttribute.call(internal,name,value);setAttribute.call(this,name,value);},removeAttr:function(name){var internal=this.shadowRoot.firstElementChild;removeAttribute.call(internal,name);removeAttribute.call(this,name);}},descriptors:{textContent:{set:function(value){textContent.set.call(this,value);if(this.lightStyle){this.appendChild(this.lightStyle);}},get:function(){return textContent.get();}},innerHTML:{set:function(value){innerHTML.set.call(this,value);if(this.lightStyle){this.appendChild(this.lightStyle);}},get:innerHTML.get}}};var defaultPrototype=createProto(HTMLElement.prototype,base.properties);function getBaseProto(proto){if(!proto){return defaultPrototype;}
proto=proto.prototype||proto;return!proto.GaiaComponent?createProto(proto,base.properties):proto;}
function createProto(proto,props){return mixin(Object.create(proto),props);}
var hasShadowCSS=(function(){var div=document.createElement('div');try{div.querySelector(':host');div.querySelector('::content');return true;}
catch(e){return false;}})();var regex={shadowCss:/(?:\:host|\:\:content)[^{]*\{[^}]*\}/g,':host':/(?:\:host)/g,':host()':/\:host\((.+)\)(?: \:\:content)?/g,':host-context':/\:host-context\((.+)\)([^{,]+)?/g,'::content':/(?:\:\:content)/g};function processCss(template,name){var globalCss='';var lightCss='';if(!hasShadowCSS){template=template.replace(regex.shadowCss,function(match){var hostContext=regex[':host-context'].exec(match);if(hostContext){globalCss+=match.replace(regex['::content'],'').replace(regex[':host-context'],'$1 '+name+'$2').replace(/ +/g,' ');}else{lightCss+=match.replace(regex[':host()'],name+'$1').replace(regex[':host'],name).replace(regex['::content'],name);}
return'';});}
return{template:template,lightCss:lightCss,globalCss:globalCss};}
function injectGlobalCss(css){if(!css){return;}
var style=document.createElement('style');style.innerHTML=css.trim();headReady().then(function(){document.head.appendChild(style);});}
function headReady(){return new Promise(function(resolve){if(document.head){return resolve();}
window.addEventListener('load',function fn(){window.removeEventListener('load',fn);resolve();});});}
function injectLightCss(el){if(hasShadowCSS){return;}
var stylesheet=el.querySelector('style');if(!stylesheet){stylesheet=document.createElement('style');stylesheet.setAttribute('scoped','');stylesheet.appendChild(document.createTextNode(el.lightCss));el.appendChild(stylesheet);}
el.lightStyle=stylesheet;}
function toCamelCase(string){return string.replace(/-(.)/g,function replacer(string,p1){return p1.toUpperCase();});}
var dirObserver;function setInnerDirAttributes(component){var dir=component.dir||document.dir;Array.from(component.shadowRoot.children).forEach(element=>{if(element.nodeName!=='STYLE'){element.dir=dir;}});}
function addDirObserver(){if(dirObserver){return;}
dirObserver=new MutationObserver(onChanged);dirObserver.observe(document.documentElement,{attributeFilter:['dir'],attributes:true});function onChanged(mutations){document.dispatchEvent(new Event('dirchanged'));}}
function mixin(target,source){for(var key in source){target[key]=source[key];}
return target;}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-component',this));},{}],3:[function(require,module,exports){(function(define){'use strict';define(function(require,exports,module){var base=window.GAIA_ICONS_BASE_URL||window.COMPONENTS_BASE_URL||'bower_components/';if(!document.documentElement){window.addEventListener('load',load);}else{load();}
function load(){if(isLoaded()){return;}
var link=document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=base+'gaia-icons/gaia-icons.css';document.head.appendChild(link);exports.loaded=true;}
function isLoaded(){return exports.loaded||document.querySelector('link[href*=gaia-icons]')||document.documentElement.classList.contains('gaia-icons-loaded');}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-icons',this));},{}],4:[function(require,module,exports){;(function(define){'use strict';define(function(require,exports,module){var component=require('gaia-component');var fontFit=require('font-fit');require('gaia-icons');var debug=0?console.log.bind(console):function(){};const KNOWN_ACTIONS={menu:'menu',back:'back',close:'close'};const TITLE_FONT='italic 300 24px FiraSans';const TITLE_PADDING=10;const MINIMUM_FONT_SIZE_CENTERED=20;const MINIMUM_FONT_SIZE_UNCENTERED=16;const MAXIMUM_FONT_SIZE=23;module.exports=component.register('gaia-header',{extensible:false,dirObserver:true,created:function(){debug('created');this.setupShadowRoot();this.els={actionButton:this.shadowRoot.querySelector('.action-button'),titles:this.getElementsByTagName('h1')};this.els.actionButton.addEventListener('click',e=>this.onActionButtonClick(e));this.observer=new MutationObserver(this.onMutation.bind(this));this.ignoreDir=this.hasAttribute('ignore-dir');this.titleEnd=this.getAttribute('title-end');this.titleStart=this.getAttribute('title-start');this.noFontFit=this.getAttribute('no-font-fit');this.notFlush=this.hasAttribute('not-flush');this.action=this.getAttribute('action');this.unresolved={};this.pending={};this._resizeThrottlingId=null;this.onResize=this.onResize.bind(this);},attached:function(){debug('attached');this.runFontFitSoon();this.observerStart();window.addEventListener('resize',this.onResize);},detached:function(){debug('detached');window.removeEventListener('resize',this.onResize);this.observerStop();this.clearPending();},clearPending:function(){for(var key in this.pending){this.pending[key].clear();delete this.pending[key];}
window.cancelAnimationFrame(this._resizeThrottlingId);this._resizeThrottlingId=null;},runFontFit:function(){debug('run font-fit');if(this.noFontFit){return Promise.resolve();}
var titles=this.els.titles;var space=this.getTitleSpace();var styles=[].map.call(titles,el=>this.getTitleStyle(el,space));return this.setTitleStylesSoon(styles);},runFontFitSoon:function(){debug('run font-fit soon');if(this.pending.runFontFitSoon){return;}
this.pending.runFontFitSoon=this.nextTick(()=>{delete this.pending.runFontFitSoon;this.runFontFit();});},getTitleStyle:function(el,space){debug('get el style',el,space);var text=el.textContent;var styleId=space.start+text+space.end+'#'+space.value;if(!text||!text.trim()){return debug('exit: no text');}
if(getStyleId(el)===styleId){return debug('exit: no change');}
var marginStart=this.getTitleMarginStart();var textSpace=space.value-Math.abs(marginStart);var fontFitResult=this.fontFit(text,textSpace,{min:MINIMUM_FONT_SIZE_CENTERED});var overflowing=fontFitResult.overflowing;var padding={start:0,end:0};if(overflowing){debug('title overflowing');padding.start=!space.start?TITLE_PADDING:0;padding.end=!space.end?TITLE_PADDING:0;textSpace=space.value-padding.start-padding.end;fontFitResult=this.fontFit(text,textSpace);marginStart=0;}
return{id:styleId,fontSize:fontFitResult.fontSize,marginStart:marginStart,overflowing:overflowing,padding:padding};},setTitleStylesSoon:function(styles){debug('set title styles soon',styles);var key='setStyleTitlesSoon';this._titleStyles=styles;if(this.unresolved[key]){return this.unresolved[key];}
this.unresolved[key]=new Promise((resolve)=>{this.pending[key]=this.nextTick(()=>{var styles=this._titleStyles;var els=this.els.titles;[].forEach.call(els,(el,i)=>{if(!styles[i]){return debug('exit');}
this.setTitleStyle(el,styles[i]);});delete this._titleStyles;delete this.unresolved[key];delete this.pending[key];resolve();});});},setTitleStyle:function(el,style){debug('set title style',style);this.observerStop();if(this.ignoreDir){el.style.marginLeft=style.marginStart+'px';el.style.paddingLeft=style.padding.start+'px';el.style.paddingRight=style.padding.end+'px';}else{el.style.marginInlineStart=style.marginStart+'px';el.style.paddingInlineStart=style.padding.start+'px';el.style.paddingInlineEnd=style.padding.end+'px';}
el.style.fontSize=style.fontSize+'px';setStyleId(el,style.id);this.observerStart();},fontFit:function(text,space,opts={}){debug('font fit:',text,space,opts);var fontFitArgs={font:TITLE_FONT,min:opts.min||MINIMUM_FONT_SIZE_UNCENTERED,max:MAXIMUM_FONT_SIZE,text:text,space:space};return fontFit(fontFitArgs);},observerStart:function(){if(this.observing){return;}
this.observer.observe(this,{childList:true,attributes:true,subtree:true});this.observing=true;debug('observer started');},observerStop:function(){if(!this.observing){return;}
this.observer.disconnect();this.observing=false;debug('observer stopped');},onResize:function(e){debug('onResize',this._resizeThrottlingId);if(this._resizeThrottlingId!==null){return;}
this._resizeThrottlingId=window.requestAnimationFrame(()=>{this._resizeThrottlingId=null;this.runFontFitSoon();});},onMutation:function(mutations){debug('on mutation',mutations);if(!this.pending.runFontFitSoon){this.runFontFit();}},getTitleSpace:function(){var start=this.titleStart;var end=this.titleEnd;var space=this.getWidth()-start-end;var result={value:space,start:start,end:end};debug('get title space',result);return result;},getWidth:function(){var value=this.notFlush?this.clientWidth:window.innerWidth;debug('get width',value);return value;},triggerAction:function(){if(this.action){this.els.actionButton.click();}},onActionButtonClick:function(){debug('action button click');var config={detail:{type:this.action}};var e=new CustomEvent('action',config);setTimeout(()=>this.dispatchEvent(e));},getTitleMarginStart:function(){var start=this.titleStart;var end=this.titleEnd;var marginStart=end-start;debug('get title margin start',marginStart);return marginStart;},getButtonsBeforeTitle:function(){var children=this.children;var l=children.length;var els=[];for(var i=0;i<l;i++){var el=children[i];if(el.tagName==='H1'){break;}
if(!contributesToLayout(el)){continue;}
els.push(el);}
if(this.action){els.push(this.els.actionButton);}
return els;},getButtonsAfterTitle:function(){var children=this.children;var els=[];for(var i=children.length-1;i>=0;i--){var el=children[i];if(el.tagName==='H1'){break;}
if(!contributesToLayout(el)){continue;}
els.push(el);}
return els;},sumButtonWidths:function(buttons){var defaultWidth=50;var sum=buttons.reduce((prev,button)=>{var isStandardButton=button===this.els.actionButton;var width=isStandardButton?defaultWidth:button.clientWidth;return prev+width;},0);debug('sum button widths',buttons,sum);return sum;},attrs:{action:{get:function(){return this._action;},set:function(value){var action=KNOWN_ACTIONS[value];if(action===this._action){return;}
this.setAttr('action',action);this._action=action;}},titleStart:{get:function(){debug('get title-start');if('_titleStart'in this){return this._titleStart;}
var buttons=this.getButtonsBeforeTitle();var value=this.sumButtonWidths(buttons);debug('get title-start',buttons,value);return value;},set:function(value){debug('set title-start',value);value=parseInt(value,10);if(value===this._titleStart||isNaN(value)){return;}
this.setAttr('title-start',value);this._titleStart=value;debug('set');}},titleEnd:{get:function(){debug('get title-end');if('_titleEnd'in this){return this._titleEnd;}
var buttons=this.getButtonsAfterTitle();return this.sumButtonWidths(buttons);},set:function(value){debug('set title-end',value);value=parseInt(value,10);if(value===this._titleEnd||isNaN(value)){return;}
this.setAttr('title-end',value);this._titleEnd=value;}},noFontFit:{get:function(){return this._noFontFit||false;},set:function(value){debug('set no-font-fit',value);value=!!(value||value==='');if(value===this.noFontFit){return;}
this._noFontFit=value;if(value){this.setAttr('no-font-fit','');}
else{this.removeAttr('no-font-fit');}}},ignoreDir:{get:function(){return this._ignoreDir||false;},set:function(value){debug('set ignore-dir',value);value=!!(value||value==='');if(value===this.ignoreDir){return;}
this._ignoreDir=value;this.dirObserver=!value;if(value){this.setAttr('ignore-dir','');}
else{this.removeAttr('ignore-dir');}}}},template:`<div class="inner">
<button class="action-button">
<content select="[l10n-action]"></content>
</button>
<content></content>
</div>
<style>
:host {
display: block;
-moz-user-select: none;
--gaia-header-button-color:
var(--header-button-color,
var(--header-color,
var(--link-color,
inherit)));
}
/**
* [hidden]
*/
:host[hidden] {
display: none;
}
/** Reset
---------------------------------------------------------*/
::-moz-focus-inner { border: 0; }
/** Inner
---------------------------------------------------------*/
.inner {
display: flex;
min-height: 50px;
-moz-user-select: none;
background:
var(--header-background,
var(--background,
#fff));
}
/** Action Button
---------------------------------------------------------*/
/**
* 1. Hidden by default
*/
.action-button {
position: relative;
display: none; /* 1 */
width: 50px;
font-size: 30px;
margin: 0;
padding: 0;
border: 0;
outline: 0;
align-items: center;
background: none;
cursor: pointer;
transition: opacity 200ms 280ms;
color:
var(--header-action-button-color,
var(--header-icon-color,
var(--gaia-header-button-color)));
}
/**
* [action=back]
* [action=menu]
* [action=close]
*
* 1. For icon vertical-alignment
*/
[action=back] .action-button,
[action=menu] .action-button,
[action=close] .action-button {
display: flex; /* 1 */
}
/**
* :active
*/
.action-button:active {
transition: none;
opacity: 0.2;
}
/** Action Button Icon
---------------------------------------------------------*/
.action-button:before {
font-family: 'gaia-icons';
font-style: normal;
text-rendering: optimizeLegibility;
font-weight: 500;
}
[action=close] .action-button:before { content: 'close' }
[action=menu] .action-button:before { content: 'menu' }
[action=back]:-moz-dir(ltr) .action-button:before { content: 'left' }
[action=back]:-moz-dir(rtl) .action-button:before { content: 'right' }
/** Action Button Icon
---------------------------------------------------------*/
/**
* 1. To enable vertical alignment.
*/
.action-button:before {
display: block;
}
/** Action Button Text
---------------------------------------------------------*/
/**
* To provide custom localized content for
* the action-button, we allow the user
* to provide an element with the class
* .l10n-action. This node is then
* pulled inside the real action-button.
*
* Example:
*
* <gaia-header action="back">
* <span l10n-action aria-label="Back">Localized text</span>
* <h1>title</h1>
* </gaia-header>
*/
::content [l10n-action] {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
font-size: 0;
}
/** Title
---------------------------------------------------------*/
/**
* 1. Vertically center text. We can't use flexbox
* here as it breaks text-overflow ellipsis
* without an inner div.
*/
::content h1 {
flex: 1;
margin: 0;
padding: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-align: center;
line-height: 50px; /* 1 */
font-weight: 300;
font-style: italic;
font-size: 24px;
color:
var(--header-title-color,
var(--header-color,
var(--title-color,
var(--text-color,
inherit))));
}
/**
* [ignore-dir]
*
* When the <gaia-header> component has an [ignore-dir] attribute, header
* direction is forced to LTR but we still want the <h1> text to be reversed
* so that strings like '1 selected' become 'selected 1'.
*
* When we're happy for <gaia-header> to be fully RTL responsive we won't need
* these rules anymore, but this depends on all Gaia apps being ready.
*
* This should be safe to remove when bug 1179459 lands.
*/
:host[ignore-dir] {
direction: ltr;
}
:host[ignore-dir]:-moz-dir(rtl) h1 {
direction: rtl;
}
/** Buttons
---------------------------------------------------------*/
::content a,
::content button {
position: relative;
z-index: 1;
box-sizing: border-box;
display: flex;
width: auto;
height: auto;
min-width: 50px;
margin: 0;
padding: 0 10px;
outline: 0;
border: 0;
font-size: 14px;
line-height: 1;
align-items: center;
justify-content: center;
text-decoration: none;
text-align: center;
background: none;
border-radius: 0;
font-style: italic;
cursor: pointer;
transition: opacity 200ms 280ms;
color: var(--gaia-header-button-color);
}
/**
* :active
*/
::content a:active,
::content button:active {
transition: none;
opacity: 0.2;
}
/**
* [hidden]
*/
::content a[hidden],
::content button[hidden] {
display: none;
}
/**
* [disabled]
*/
::content a[disabled],
::content button[disabled] {
pointer-events: none;
color: var(--header-disabled-button-color);
}
/** Icon Buttons
---------------------------------------------------------*/
/**
* Icons are a different color to text
*/
::content .icon,
::content [data-icon] {
color:
var(--header-icon-color,
var(--gaia-header-button-color));
}
/**
* If users want their action button
* to be in the component's light-dom
* they can add an .action class
* to make it look like the
* shadow action button.
*/
::content .action {
color:
var(--header-action-button-color,
var(--header-icon-color,
var(--gaia-header-button-color)));
}
/**
* [data-icon]:empty
*
* Icon buttons with no textContent,
* should always be 50px.
*
* This is to prevent buttons being
* larger than they should be before
* icon-font has loaded.
*/
::content [data-icon]:empty {
width: 50px;
}
</style>`,nextTick:nextTick});function contributesToLayout(el){return el.localName!=='style'&&!el.hasAttribute('l10n-action');}
function setStyleId(el,id){el._styleId=id;}
function getStyleId(el){return el._styleId;}
function nextTick(fn){var cleared;Promise.resolve().then(()=>{if(!cleared){fn();}});return{clear:function(){cleared=true;}};}});})(typeof define=='function'&&define.amd?define:(function(n,w){'use strict';return typeof module=='object'?function(c){c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-header',this));},{"font-fit":1,"gaia-component":2,"gaia-icons":3}]},{},[4])(4)});

View file

@ -0,0 +1,61 @@
[data-icon="back"]:-moz-dir(ltr):before {
content: 'left';
}
[data-icon="back"]:-moz-dir(rtl):before {
content: 'right';
}
[data-icon="forward"]:-moz-dir(ltr):before {
content: 'right';
}
[data-icon="forward"]:-moz-dir(rtl):before {
content: 'left';
}
[data-icon="back-light"]:-moz-dir(ltr):before {
content: 'left-light';
}
[data-icon="back-light"]:-moz-dir(rtl):before {
content: 'right-light';
}
[data-icon="forward-light"]:-moz-dir(ltr):before {
content: 'right-light';
}
[data-icon="forward-light"]:-moz-dir(rtl):before {
content: 'left-light';
}
[data-icon="arrow-back"]:-moz-dir(ltr):before {
content: 'arrow-left';
}
[data-icon="arrow-back"]:-moz-dir(rtl):before {
content: 'arrow-right';
}
[data-icon="arrow-forward"]:-moz-dir(ltr):before {
content: 'arrow-right';
}
[data-icon="arrow-forward"]:-moz-dir(rtl):before {
content: 'arrow-left';
}
[data-icon="clear-input"]:-moz-dir(ltr):before {
content: 'clear-input-left';
}
[data-icon="clear-input"]:-moz-dir(rtl):before {
content: 'clear-input-right';
}
[data-icon="expand"]:-moz-dir(ltr):before {
content: 'expand-left';
}
[data-icon="expand"]:-moz-dir(rtl):before {
content: 'expand-right';
}
[data-icon="send"]:-moz-dir(ltr):before {
content: 'send-right';
}
[data-icon="send"]:-moz-dir(rtl):before {
content: 'send-left';
}
[data-icon="edit"]:-moz-dir(ltr):before {
content: 'edit-left';
}
[data-icon="edit"]:-moz-dir(rtl):before {
content: 'edit-right';
}

View file

@ -0,0 +1,34 @@
@font-face {
font-family: "gaia-icons";
src: url("fonts/gaia-icons.ttf") format("truetype");
font-weight: 500;
font-style: normal;
}
[data-icon]:before,
.ligature-icons {
font-family: "gaia-icons";
content: attr(data-icon);
display: inline-block;
font-weight: 500;
font-style: normal;
text-decoration: inherit;
text-transform: none;
text-rendering: optimizeLegibility;
font-size: 30px;
-webkit-font-smoothing: antialiased;
}
[data-icon]:not([data-l10n-id]):not([aria-label]):not([aria-hidden="true"]):before {
background: rgba(255, 0, 0, 0.4);
}
[data-icon]:not([data-l10n-id]):not([aria-label]):not([aria-hidden="true"]):after {
background: #333;
color: #fff;
position: absolute;
width: 20rem;
border-radius: 0.5rem;
padding: 0.5rem;
content: "Icon is not localized and is still visible to screen reader. Please add data-l10n-id or aria-label for localization or use aria-hidden to hide the icon from screen reader.";
z-index: 9999;
}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><path fill="#667174" fill-opacity=".7" d="m 18.2995,19.66 -5.056,-5.057 5.056,-5.056 c -0.31,-0.516 -0.62,-1.032 -0.93,-1.34 l -5.672,5.673 v 1.652 l 5.675,5.676 c 0.31,-0.515 0.722,-0.928 0.93,-1.547 z"/></svg>

After

Width:  |  Height:  |  Size: 294 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path fill="#667174" fill-opacity=".7" d="M11.8,19.9l4.9-4.9l-4.9-4.9c0.3-0.5,0.6-1,0.9-1.3l5.5,5.5c0,0.3,0,0.5,0,0.8c0,0.3,0,0.5,0,0.8l-5.5,5.5 C12.4,20.9,12,20.5,11.8,19.9z"/></svg>

After

Width:  |  Height:  |  Size: 243 B

View file

@ -0,0 +1,2 @@
window.GaiaButtons=(function(win){var proto=Object.create(HTMLElement.prototype);var baseurl=window.GaiaButtonsBaseurl||'/shared/elements/gaia_buttons/';proto.createdCallback=function(){ComponentUtils.style.call(this,baseurl);};return document.registerElement('gaia-buttons',{prototype:proto});})(window);

View file

@ -0,0 +1,220 @@
gaia-buttons {
display: flex;
justify-content: center;
align-items: center;
height: 7rem;
box-sizing: border-box;
pointer-events: auto;
}
gaia-buttons:not(.inline) {
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
border-top: 0.1rem solid #e7e7e7;
padding: 0;
background-color: #f4f4f4;
}
gaia-buttons:not(.inline):-moz-dir(ltr) { padding-right: 1.5rem; }
gaia-buttons:not(.inline):-moz-dir(rtl) { padding-left: 1.5rem; }
gaia-buttons.inline a,
gaia-buttons.inline button {
margin: 0;
}
button::-moz-focus-inner {
border: none;
outline: none;
}
a,
button {
position: relative;
font-family: sans-serif;
font-style: italic;
width: 100%;
height: 4rem;
margin: 0;
padding: 0 0.2rem;
box-sizing: border-box;
display: inline-block;
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
background: #d8d8d8;
border: none;
border-radius: 2rem;
font-weight: normal;
font-size: 1.6rem;
line-height: 4rem;
color: #333;
text-align: center;
text-decoration: none;
outline: none;
}
:-moz-dir(ltr) a,
:-moz-dir(ltr) button {
margin-left: 1.5rem;
}
:-moz-dir(rtl) a,
:-moz-dir(rtl) button {
margin-right: 1.5rem;
}
a.recommend,
button.recommend {
background-color: #00caf2;
color: #fff;
}
a.danger,
button.danger {
background-color: #e51e1e;
color: #fff;
}
a:active,
button:active {
background-color: #b2f2ff;
color: #fff;
}
a::-moz-selection,
button::-moz-selection {
background-color: transparent;
}
a[aria-disabled="true"],
button[disabled] {
background-color: rgba(0,0,0,0.05);
color: #c7c7c7;
pointer-events: auto;
}
a[aria-disabled="true"].recommend,
button[disabled].recommend {
background-color: #97cbd5;
color: rgba(255,255,255,0.5);
}
a[aria-disabled="true"].danger,
button[disabled].danger {
background-color: #eb7474;
color: rgba(255,255,255,0.5);
}
a[aria-disabled="true"]::-moz-selection,
button[disabled]::-moz-selection {
-moz-user-select: none;
}
[hidden] {
visibility: hidden;
}
a.icon,
button.icon {
position: relative;
}
a.icon:before,
button.icon:before {
content: "";
width: 3rem;
height: 3rem;
position: absolute;
top: 50%;
margin-top: -1.5rem;
background: transparent no-repeat center center / 100% auto;
}
:-moz-dir(ltr) a.icon:before,
:-moz-dir(ltr) button.icon:before { right: 0.5rem; }
:-moz-dir(rtl) a.icon:before,
:-moz-dir(rtl) button.icon:before { left: 0.5rem; }
a.icon-next:before,
button.icon-next:before {
background-size: 3rem;
}
:-moz-dir(ltr) a.icon-next:before,
:-moz-dir(ltr) button.icon-next:before {
background-image: url(images/right-light.svg);
}
:-moz-dir(rtl) a.icon-next:before,
:-moz-dir(rtl) button.icon-next:before {
background-image: url(images/left-light.svg);
}
a.icon-previous:before,
button.icon-previous:before {
background-size: 3rem;
}
:-moz-dir(ltr) a.icon-previous:before,
:-moz-dir(ltr) button.icon-previous:before {
left: 0.5rem;
background-image: url(images/left-light.svg);
}
:-moz-dir(rtl) a.icon-previous:before,
:-moz-dir(rtl) button.icon-previous:before {
right: 0.5rem;
background-image: url(images/right-light.svg);
}
gaia-buttons[skin="dark"] {
background: #4d4d4d;
border: none;
}
[skin="dark"] a:active,
[skin="dark"] button:active {
background-color: #00aacc;
}
[skin="dark"] a[aria-disabled="true"],
[skin="dark"] button[disabled] {
background-color: #565656;
color: rgba(255,255,255,0.4);
}
[skin="dark"] a[aria-disabled="true"].recommend,
[skin="dark"] button[disabled].recommend {
background-color: #006579;
}
[skin="dark"] a[aria-disabled="true"].danger,
[skin="dark"] button[disabled].danger {
background-color: #730f0f;
}
[transition] {
display: flex;
transition: visibility var(--transition-duration);
}
[transition][hidden] {
pointer-events: none;
}
[transition="slide"] {
transform: translateY(0);
transition: transform var(--transition-duration) ease,
visibility var(--transition-duration);
}
[transition="slide"][hidden] {
transform: translateY(100%);
}
[transition="fade"] {
opacity: 1;
transition: opacity var(--transition-duration) ease,
visibility var(--transition-duration);
}
[transition="fade"][hidden] {
opacity: 0;
}
@media (min-width: 768px) {
gaia-buttons {
height: 10rem;
}
gaia-buttons:not(.inline) {
border-top-width: 0.2rem;
}
gaia-buttons:not(.inline):-moz-dir(ltr) { padding-right: 3rem; }
gaia-buttons:not(.inline):-moz-dir(rtl) { padding-left: 3rem; }
a,
button {
font-size: 2rem;
height: 5rem;
line-height: 5rem;
border-radius: 2.5rem;
max-width: 40rem;
}
:-moz-dir(ltr) a,
:-moz-dir(ltr) button {
margin-left: 3rem;
}
:-moz-dir(rtl) a,
:-moz-dir(rtl) button {
margin-right: 3rem;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

View file

@ -0,0 +1,5 @@
;window.GaiaCheckbox=(function(win){var proto=Object.create(HTMLElement.prototype);var baseurl=window.GaiaCheckboxBaseurl||'/shared/elements/gaia_checkbox/';proto.createdCallback=function(){this.lastClick=0;this.throttleTime=250;var shadow=this.createShadowRoot();this._template=template.content.cloneNode(true);this._wrapper=this._template.getElementById('checkbox');this._wrapper.addEventListener('click',this.handleClick.bind(this));this.configureClass();this.checked=this.hasAttribute('checked');this._wrapper.setAttribute('aria-checked',this.checked);this.setAttribute('role','presentation');shadow.appendChild(this._template);ComponentUtils.style.call(this,baseurl);};proto.handleClick=function(e){e.preventDefault();e.stopImmediatePropagation();if(this.lastClick+this.throttleTime>Date.now()){return;}
this.lastClick=Date.now();var event=new MouseEvent('click',{view:window,bubbles:true,cancelable:true});this.dispatchEvent(event);if(!event.defaultPrevented){this.checked=!this.checked;this._wrapper.setAttribute('aria-checked',this.checked);}
this.dispatchEvent(new CustomEvent('change',{bubbles:true,cancelable:false}));};proto.configureClass=function(){this._wrapper.className=this.className;};proto.attributeChangedCallback=function(name,from,to){if(name==='class'){this._wrapper.className=to;}};Object.defineProperty(proto,'checked',{get:function(){return this._checked||false;},set:function(value){this._wrapper.classList.toggle('checked',value);this._checked=value;}});Object.defineProperty(proto,'name',{get:function(){return this.getAttribute('name');},set:function(value){this.setAttribute('name',value);}});var template=document.createElement('template');template.innerHTML=`<span id="checkbox" role="checkbox">
<span role="presentation"><content select="label"></content></span>
</span>`;return document.registerElement('gaia-checkbox',{prototype:proto});})(window);

View file

@ -0,0 +1,60 @@
gaia-checkbox {
display: inline-block;
width: 100%;
}
#checkbox {
display: block;
width: 100%;
height: 100%;
position: relative;
background: none;
}
#checkbox span {
font-size: 1.9rem;
font-weight: normal;
color: var(--label-color);
line-height: 3rem;
box-sizing: border-box;
display: block;
min-width: 2.2rem;
min-height: 2.2rem;
width: 100%;
padding-inline-end: 2.2rem;
white-space: normal;
}
#checkbox.inline {
display: inline-block;
vertical-align: middle;
}
#checkbox:not(.invisible) span:after {
content: '';
position: absolute;
offset-inline-end: 0;
top: 50%;
margin: -1.2rem 0 0;
margin-inline-start: -1.2rem;
width: 2.2rem;
height: 2.2rem;
}
#checkbox.inline span {
padding-inline-start: 3rem;
padding-inline-end: 0;
height: auto;
}
#checkbox.inline span:after {
offset-inline-start: 1.2rem;
offset-inline-end: unset;
margin: -1.2rem 0 0;
margin-inline-start: -1.2rem;
}
#checkbox:not(.invisible) span:after {
background: url(images/default.png) no-repeat center top / 2.2rem auto;
}
#checkbox.checked span:after {
background-position: center bottom;
}
#checkbox.danger span:after {
background-image: url(images/danger.png);
}

View file

@ -0,0 +1,12 @@
window.GaiaConfirm=(function(win){var proto=Object.create(HTMLElement.prototype);var baseurl=window.GaiaConfirmBaseurl||'/shared/elements/gaia_confirm/';function eatEvent(unless,event){if(unless&&unless.indexOf(event.target)!==-1){return;}
event.preventDefault();event.stopImmediatePropagation();}
proto.createdCallback=function(){var shadow=this.createShadowRoot();this._template=template.content.cloneNode(true);shadow.appendChild(this._template);ComponentUtils.style.call(this,baseurl);var confirm=this.querySelector('gaia-buttons .confirm');var cancel=this.querySelector('gaia-buttons .cancel');if(confirm){confirm.addEventListener('click',(e)=>{eatEvent(null,e);this.dispatchEvent(new CustomEvent('confirm'));});}
if(cancel){cancel.addEventListener('click',(e)=>{eatEvent(null,e);this.dispatchEvent(new CustomEvent('cancel'));});}};var template=document.createElement('template');template.innerHTML=`<form role="dialog" class="confirm">
<section>
<content select="h1"></content>
<content select="p"></content>
</section>
<content select="gaia-buttons">
</content>
</form>`;return document.registerElement('gaia-confirm',{prototype:proto});})(window);

View file

@ -0,0 +1,130 @@
gaia-confirm {
background: #2d2d2d;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding-bottom: 7rem;
font-size: 0;
text-align: start;
color: #fff;
display: flex;
align-items: stretch;
flex-direction: column;
justify-content: center;
transition: transform ease-in-out 0.3s, visibility 0.3s;
z-index: 2147483646;
}
gaia-confirm[hidden] {
transform: translateY(100%);
visibility: hidden;
pointer-events: none;
}
.confirm section {
height: 100%;
font-weight: 300;
font-size: 2.2rem;
color: #FAFAFA;
padding: 0 1.5rem;
box-sizing: padding-box;
width: 100%;
display: inline-block;
max-height: 100%;
vertical-align: middle;
white-space: normal;
}
h1 {
font-weight: normal;
font-size: 1.6rem;
line-height: 1.5em;
color: #fff;
margin: 0;
padding: 1rem 1.5rem 0;
overflow: hidden;
max-height: 7rem;
word-wrap: break-word;
}
p {
word-wrap: break-word;
margin: 1rem 0 0;
padding: 1rem 1.5rem;
border-top: 0.1rem solid #686868;
line-height: 3rem;
}
p img {
margin-inline-end: 2rem;
}
p img:-moz-dir(ltr) { float: left; }
p img:-moz-dir(rtl) { float: right; }
p strong {
font-weight: 300;
}
p small {
font-size: 1.4rem;
font-weight: normal;
color: #cbcbcb;
display: block;
}
dl {
border-top: 0.1rem solid #686868;
margin: 1rem 0 0;
overflow: hidden;
padding-top: 1rem;
font-size: 1.6rem;
line-height: 2.2rem;
}
dl > dt {
clear: both;
width: 7rem;
padding-inline-start: 1.5rem;
font-weight: 500;
text-align: start;
}
dl > dt:-moz-dir(ltr) { float: left; }
dl > dt:-moz-dir(rtl) { float: right; }
dl > dd {
padding-inline-end: 1.5rem;
font-weight: 300;
text-overflow: ellipsis;
vertical-align: top;
overflow: hidden;
}
figure {
margin: 1.5rem;
display: flex;
align-items: center;
}
figure img {
padding-inline-end: 1.5rem;
flex-shrink: 0;
}
figure figcaption {
font-size: 2.1rem;
font-weight: 300;
}
ul {
margin: 0;
padding: 2rem 1.5rem;
border-top: 0.1rem solid #686868;
list-style: none;
font-size: 1.6rem;
font-weight: normal;
}
ul li {
word-wrap: break-word;
line-height: 2rem;
padding-bottom: 1.5rem;
}
ul li:last-child {
padding-bottom: 0;
}
ul li ul {
border: none;
margin: 0;
padding: 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View file

@ -0,0 +1,9 @@
;window.GaiaMenu=(function(win){var proto=Object.create(HTMLElement.prototype);var baseurl=window.GaiaMenuBaseurl||'/shared/elements/gaia_menu/';proto.createdCallback=function(){var shadow=this.createShadowRoot();this._template=template.content.cloneNode(true);var cancelButton=this._template.querySelector('.gaia-menu-cancel button');cancelButton.addEventListener('click',function(){this.hide();this.dispatchEvent(new CustomEvent('gaiamenu-cancel'));}.bind(this));shadow.appendChild(this._template);ComponentUtils.style.call(this,baseurl);document.l10n.ready.then(this.localize.bind(this));document.addEventListener('DOMRetranslated',this.localize.bind(this));};proto.localize=function(){document.l10n.formatValue('gaia-menu-cancel').then(value=>{this.shadowRoot.querySelector('button').textContent=value;});};proto.show=function(){this.removeAttribute('hidden');};proto.hide=function(){this.setAttribute('hidden','hidden');};var template=document.createElement('template');template.innerHTML=`<form role="dialog" data-type="action">
<content select="header"></content>
<menu>
<content select="button"></content>
<span class="gaia-menu-cancel">
<button>Cancel</button>
</span>
</menu>
</form>`;return document.registerElement('gaia-menu',{prototype:proto});})(window);

View file

@ -0,0 +1,270 @@
:-moz-dir(ltr) [dir] { text-align: left; }
:-moz-dir(rtl) [dir] { text-align: right; }
gaia-menu {
background-color: #2d2d2d;
overflow: hidden;
position: fixed;
z-index: 100;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 0 0 7rem;
font-size: 0;
color: #fff;
display: block;
transition: transform ease-in-out var(--transition-duration),
visibility var(--transition-duration);
}
gaia-menu[hidden] {
transform: translateY(100%);
visibility: hidden;
}
gaia-menu:before {
content: '';
display: inline-block;
vertical-align: top;
width: 0.1rem;
height: 100%;
margin-inline-start: -0.1rem;
}
header {
-moz-box-sizing: border-box;
font-size: 1.6rem;
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
height: 5rem;
line-height: 4.9rem;
color: #fff;
white-space: nowrap;
text-overflow: ellipsis;
display: block;
overflow: hidden;
font-weight: normal;
padding: 0 3rem;
border-bottom: 0.1rem solid #616262;
}
header h1 {
font-size: 1.6rem;
line-height: 4.9rem;
color: #fff;
white-space: nowrap;
text-overflow: ellipsis;
display: block;
overflow: hidden;
margin: 0;
height: 100%;
font-weight: normal;
}
header menu.toolbar {
height: 100%;
margin: 0 -3rem;
margin-inline-start: 1rem;
padding: 0;
}
header:-moz-dir(ltr) menu.toolbar { float: right; }
header:-moz-dir(rtl) menu.toolbar { float: left; }
header menu.toolbar a,
header menu.toolbar button {
-moz-box-sizing: border-box;
position: relative;
width: auto;
min-width: 5rem;
height: 4.9rem;
margin-bottom: 0;
padding: 0 1rem;
border-radius: 0;
line-height: 4.9rem;
background: none;
text-align: center;
text-shadow: none;
z-index: 5;
}
header:-moz-dir(ltr) menu.toolbar a,
header:-moz-dir(ltr) menu.toolbar button {
float: left;
}
header:-moz-dir(rtl) menu.toolbar a,
header:-moz-dir(rtl) menu.toolbar button {
float: right;
}
header a,
header button {
border: none;
padding: 0;
overflow: hidden;
font-weight: 400;
font-size: 1.5rem;
line-height: 1.1em;
color: #fff;
border-radius: 0;
text-decoration: none;
}
button::-moz-focus-inner {
outline: none;
border: none;
}
header a:active .icon:after,
header button:active .icon:after,
header menu.toolbar a:active,
header menu.toolbar button:active {
background: #008aaa;
}
header menu.toolbar a[aria-disabled="true"],
header menu.toolbar button[disabled] {
opacity: 0.5;
pointer-events: none;
}
header .icon {
position: relative;
float: none;
display: inline-block;
vertical-align: top;
width: 4rem;
height: 4.9rem;
margin: 0 -1rem;
background: transparent no-repeat center center / 3rem auto;
font-size: 0;
overflow: hidden;
}
header .icon.icon-close {
background-image: url(images/icons/close.png);
}
header .icon.icon-back {
background-image: url(images/icons/back.png);
}
header > button,
header > a {
width: 5rem;
height: 4.9rem;
background: none;
overflow: visible;
margin: 0 -1rem;
margin-inline-start: -3rem;
position: relative;
}
header:-moz-dir(ltr) > button,
header:-moz-dir(ltr) > a {
float: left;
}
header:-moz-dir(rtl) > button,
header:-moz-dir(rtl) > a {
float: right;
}
header > button::-moz-focus-inner {
border: 0;
padding: 0;
}
header > button .icon,
header > a .icon {
position: static;
display: block;
width: 3rem;
height: 4.9rem;
margin: 0;
overflow: visible;
font-size: 0;
}
header > button .icon:after,
header > a .icon:after {
content: "";
position: absolute;
offset-inline-start: 0;
top: 0;
z-index: -1;
width: 3rem;
height: 4.9rem;
}
section {
color: #fff;
position: absolute;
top: 7rem;
left: 1.5rem;
right: 1.5rem;
bottom: 2rem;
font-size: 1.6rem;
overflow: scroll;
}
menu {
margin: 0;
padding: 0;
max-height: calc(100% - 13.5rem);
height: auto;
padding-top: 1.5rem;
overflow: auto;
width: auto;
border: none;
background: none;
position: absolute;
left: 0;
right: 0;
bottom: 7rem;
}
button {
width: calc(100% - 3rem);
height: 4rem;
-moz-box-sizing: border-box;
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-weight: normal;
line-height: 4rem;
outline: none;
font-size: 1.6rem;
text-shadow: none;
padding: 0 1.2rem;
margin: 0 1.5rem 1rem;
background: rgba(87, 87, 87, 0.8);
border: none;
border-radius: 0;
position: relative;
color: #fff;
font-family: sans-serif;
font-style: italic;
}
button:-moz-dir(ltr) { text-align: left; }
button:-moz-dir(rtl) { text-align: right; }
span.gaia-menu-cancel {
position: fixed;
width: 100%;
background: #4d4d4d;
height: 7rem;
offset-inline-start: 0;
bottom: 0;
}
span.gaia-menu-cancel button {
position: fixed;
bottom: 0;
offset-inline-start: 0;
color: #333;
background: #d8d8d8;
text-align: center;
border: none;
margin-bottom: 1.5rem;
border-radius: 2rem;
}
button:nth-last-child(2) {
margin-bottom: 1.5rem;
}
button:active,
span.gaia-menu-cancel button:active {
background: #00aacc;
color: #fff;
}
button[disabled] {
background-color: rgba(87, 87, 87, 0.8);
color: rgba(255, 255, 255, 0.4);
opacity: 0.5;
pointer-events: none;
}
button[disabled]:last-child {
background-color: #e7e7e7;
color: #a6a6a6;
opacity: 1;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

View file

@ -0,0 +1,9 @@
;window.GaiaRadio=(function(win){var proto=Object.create(HTMLElement.prototype);var baseurl=window.GaiaRadioBaseurl||'/shared/elements/gaia_radio/';proto.createdCallback=function(){var shadow=this.createShadowRoot();this._template=template.content.cloneNode(true);this._wrapper=this._template.getElementById('radio');this._wrapper.addEventListener('click',this.handleClick.bind(this));if(this.dataset.role){this._wrapper.setAttribute('role',this.dataset.role);}
if(!this.hasAttribute('role')){this.setAttribute('role','presentation');}
this.configureClass();shadow.appendChild(this._template);this.checked=this.hasAttribute('checked');this._wrapper.setAttribute('aria-checked',this.checked);setTimeout(function nextTick(){var label=this.querySelector('label, p');if(!label){return;}
label.addEventListener('click',this.handleClick.bind(this));}.bind(this));ComponentUtils.style.call(this,baseurl);var dirObserver=new MutationObserver(this.updateInternalDir.bind(this));dirObserver.observe(document.documentElement,{attributeFilter:['dir'],attributes:true});this.updateInternalDir();};proto.updateInternalDir=function(){var internal=this.shadowRoot.firstElementChild;if(document.documentElement.dir==='rtl'){internal.setAttribute('dir','rtl');}else{internal.removeAttribute('dir');}};proto.handleClick=function(e){e.stopImmediatePropagation();var event=new MouseEvent('click',{view:window,bubbles:true,cancelable:true});this.dispatchEvent(event);if(this.checked){return;}
if(!event.defaultPrevented){this.checked=!this.checked;}
this.dispatchEvent(new CustomEvent('change',{bubbles:true,cancelable:false}));};proto.configureClass=function(){this._wrapper.className=this.className;this._wrapper.classList.toggle('checked',this._checked);};proto.hideDetails=function(){this.shadowRoot.querySelector('.details').style.display='none';};proto.attributeChangedCallback=function(name,from,to){if(name==='class'){this._wrapper.className=to;}};Object.defineProperty(proto,'checked',{get:function(){return this._checked;},set:function(value){if(!this._template){return;}
if(value){var relevant=document.querySelectorAll('gaia-radio[name="'+this.getAttribute('name')+'"]');for(var i=0,iLen=relevant.length;i<iLen;i++){relevant[i].checked=false;}
this.setAttribute('checked',true);}else{this.removeAttribute('checked');}
this._wrapper.classList.toggle('checked',value);this._wrapper.setAttribute('aria-checked',value);this._checked=value;}});Object.defineProperty(proto,'name',{get:function(){return this.getAttribute('name');},set:function(value){this.setAttribute('name',value);}});Object.defineProperty(proto,'value',{get:function(){return this.getAttribute('value');},set:function(value){this.setAttribute('value',value);}});Object.defineProperty(proto,'type',{get:function(){return'gaia-radio';}});var template=document.createElement('template');template.innerHTML='<span role="radio" id="radio">'+'<span><content select="p,label"></content></span>'+'<div class="details"><content select="details"></content></div>'+'<div class="divider"></div>'+'</span>';return document.registerElement('gaia-radio',{prototype:proto});})(window);

View file

@ -0,0 +1,86 @@
gaia-radio {
display: inline-block;
width: 100%;
}
#radio {
display: inline-block;
vertical-align: middle;
width: 100%;
position: relative;
background: none;
}
gaia-radio.inline,
#radio.inline {
width: 5rem;
height: 100%;
}
#radio span {
font-size: 1.9rem;
color: var(--label-color);
padding: 1rem 0;
padding-inline-end: 2.4rem;
line-height: 3rem;
box-sizing: border-box;
display: block;
white-space: normal;
word-wrap: break-word;
}
#radio.truncate span {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
#radio span:after {
content: '';
position: absolute;
offset-inline-end: 0;
top: 50%;
margin: -1.1rem 0 0;
margin-inline-start: -1.1rem;
width: 2.2rem;
height: 2.2rem;
background: url(images/default.png) no-repeat center top / 2.2rem auto;
}
#radio.checked span:after {
background-position: center bottom;
}
#radio.danger span:after {
background-image: url(images/danger.png);
}
#radio.checkone span:after {
background: none;
}
#radio.checkone.checked span:after {
background: url(images/checked.png) no-repeat right center / 100%;
}
#radio.checkone.checked span {
font-weight: 500;
}
#radio.split .divider {
content: '';
position: absolute;
background-color: #E6E6E3;
offset-inline-end: 3.5rem;
width: 0.1rem;
height: calc(100% - 1rem);
top: 0.5rem;
}
gaia-radio.split label {
display: block;
width: 100%;
}
#radio div.details {
position: relative;
top: -1.5rem;
display: block;
margin: 0;
padding-top: 0.5rem;
-moz-padding-start: 0;
-moz-padding-end: 8rem;
font-size: 1.4rem;
line-height: 1.6rem;
color: #505859;
font-style: normal;
white-space: normal;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

View file

@ -0,0 +1,9 @@
;window.GaiaSwitch=(function(win){var proto=Object.create(HTMLElement.prototype);var baseurl=window.GaiaSwitchBaseurl||'/shared/elements/gaia_switch/';proto.createdCallback=function(){var shadow=this.createShadowRoot();this._template=template.content.cloneNode(true);this._input=this._template.querySelector('input[type="checkbox"]');var checked=this.getAttribute('checked');if(checked!==null){this._input.checked=true;}
var wrapper=this._template.getElementById('switch');wrapper.addEventListener('click',this.handleClick.bind(this));shadow.appendChild(this._template);ComponentUtils.style.call(this,baseurl);var dirObserver=new MutationObserver(this.updateInternalDir.bind(this));dirObserver.observe(document.documentElement,{attributeFilter:['dir'],attributes:true});this.updateInternalDir();};proto.updateInternalDir=function(){var internal=this.shadowRoot.firstElementChild;if(document.documentElement.dir==='rtl'){internal.setAttribute('dir','rtl');}else{internal.removeAttribute('dir');}};proto.handleClick=function(e){if(e&&e.target.tagName==='A'){return;}
e&&e.preventDefault();e&&e.stopImmediatePropagation();var event=new MouseEvent('click',{view:window,bubbles:true,cancelable:true});this.dispatchEvent(event);if(!event.defaultPrevented){this.checked=!this.checked;}
this.dispatchEvent(new CustomEvent('change',{bubbles:true,cancelable:false}));};proto.click=function(){this.handleClick();};Object.defineProperty(proto,'checked',{get:function(){return this._input.checked;},set:function(value){this._input.checked=value;}});Object.defineProperty(proto,'disabled',{get:function(){return this.hasAttribute('disabled');},set:function(value){if(value){this.setAttribute('disabled',true);}else{this.removeAttribute('disabled');}}});Object.defineProperty(proto,'name',{get:function(){return this.getAttribute('name');},set:function(value){this.setAttribute('name',value);}});Object.defineProperty(proto,'type',{get:function(){return'gaia-switch';}});var template=document.createElement('template');template.innerHTML=`<span id="switch">
<input type="checkbox">
<span><content select="label"></content></span>
<div class="details"><content select="details"></content></div>
<content select="a"></content>
</span>`;return document.registerElement('gaia-switch',{prototype:proto});})(window);

View file

@ -0,0 +1,91 @@
gaia-switch {
display: inline-block;
width: 100%;
}
#switch {
display: inline-block;
vertical-align: middle;
width: 100%;
position: relative;
background: none;
}
#switch span {
font-size: 1.9rem;
color: var(--label-color);
padding: 1rem 0;
line-height: 3rem;
box-sizing: border-box;
display: block;
white-space: normal;
}
#switch span:-moz-dir(ltr) { float: left; }
#switch span:-moz-dir(rtl) { float: right; }
#switch span:not(:empty) {
padding-inline-end: 6rem;
}
#switch input {
margin: 0;
opacity: 0;
position: absolute;
top: 0;
offset-inline-start: 0;
}
#switch input:checked ~ span::after {
background-position: center bottom;
}
#switch input ~ span::after {
content: '';
position: absolute;
offset-inline-end: 0;
top: 2.5rem;
width: 6rem;
margin: -1.4rem 0 0;
height: 2.7rem;
border-radius: 1.35rem;
overflow: hidden;
background-color: #e6e6e6;
background-image: url(images/background_off.png);
background-repeat: no-repeat;
background-size: 9.2rem 2.7rem;
transition: background 0.2s ease;
}
#switch input ~ span:-moz-dir(ltr)::after { background-position: -3.2rem 0; }
#switch input ~ span:-moz-dir(rtl)::after { background-position: 0 0; }
#switch input:checked ~ span:-moz-dir(ltr)::after {
background-image: url(images/background.png);
background-position: 0 0;
}
#switch input:checked ~ span:-moz-dir(rtl)::after {
background-image: url(images/background_rtl.png);
background-position: -3.2rem 0;
}
#switch input:disabled ~ span::after {
opacity: 0.4;
}
#switch input.uninit ~ span::after {
transition: none;
}
#switch div.details {
clear: both;
position: relative;
top: -1.5rem;
display: block;
margin: 0;
padding-top: 0.5rem;
padding-inline-start: 0;
padding-inline-end: 8rem;
font-size: 1.4rem;
line-height: 1.6rem;
color: #505859;
font-style: normal;
white-space: normal;
}
gaia-switch a {
position: relative;
top: -0.8rem;
font-size: 1.7rem;
line-height: 2.4rem;
font-weight: 400;
color: #35679a;
}

View file

@ -0,0 +1,13 @@
(function(exports){const PERMITTED_SCHEMES=['http','https','file','ftp','app'];function globToRegexp(pat,allowQuestion){pat=pat.replace(/[.+^${}()|[\]\\]/g,'\\$&');if(allowQuestion){pat=pat.replace(/\?/g,'.');}else{pat=pat.replace(/\?/g,'\\?');}
pat=pat.replace(/\*/g,'.*');return new RegExp('^'+pat+'$');}
function SingleMatchPattern(pat){if(pat=='<all_urls>'){this.scheme=PERMITTED_SCHEMES;this.host='*';this.path=new RegExp('.*');}else if(!pat){this.scheme=[];}else{var re=new RegExp('^(http|https|file|ftp|app|\\*)://(\\*|\\*\\.[^*/]+|[^*/]+|)(/.*)$');var match=re.exec(pat);if(!match){console.error(`Invalid match pattern: '${pat}'`);this.scheme=[];return;}
if(match[1]=='*'){this.scheme=['http','https'];}else{this.scheme=[match[1]];}
this.host=match[2];this.path=globToRegexp(match[3],false);if(this.host===''&&this.scheme[0]!=='file'){console.error(`Invalid match pattern: '${pat}'`);this.scheme=[];return;}}}
SingleMatchPattern.prototype={matches(uri,ignorePath=false){if(this.scheme.indexOf(uri.protocol.slice(0,-1))==-1){return false;}
if(this.host=='*'){}else if(this.host[0]=='*'){var suffix=this.host.substr(2);if(uri.hostname!=suffix&&!uri.hostname.endsWith('.'+suffix)){return false;}}else{if(this.host!=uri.hostname){return false;}}
if(!ignorePath&&!this.path.test(uri.pathname)){return false;}
return true;}};function MatchPattern(pat){this.pat=pat;if(!pat){this.matchers=[];}else if(pat instanceof String||typeof(pat)==='string'){this.matchers=[new SingleMatchPattern(pat)];}else{this.matchers=Array.from(pat, p => new SingleMatchPattern(p));}}
MatchPattern.prototype={matches(uri){for(var matcher of this.matchers){if(matcher.matches(uri)){return true;}}
return false;},matchesIgnoringPath(uri){for(var matcher of this.matchers){if(matcher.matches(uri,true)){return true;}}
return false;},serialize(){return this.pat;},};exports.MatchPattern=MatchPattern;})(window);

View file

@ -0,0 +1,3 @@
(function(exports){'use strict';const kEventName='statechange';const kCommunicationKey='airplaneMode.enabled';const kStatusKey='airplaneMode.status';var AirplaneModeHelper={_mozSettings:window.navigator.mozSettings,_callbacks:[],_cachedStatus:'',ready:function(cb){if(this._cachedStatus===''){var self=this;this.addEventListener(kEventName,function onChangeEvent(){if(self._cachedStatus!==''){self.removeEventListener(kEventName,onChangeEvent);cb();}});}else{cb();}},getStatus:function(){return this._cachedStatus;},addEventListener:function(eventName,callback){if(eventName===kEventName){this._callbacks.push(callback);}},removeEventListener:function(eventName,callback){if(eventName===kEventName){var index=this._callbacks.indexOf(callback);if(index>=0){this._callbacks.splice(index,1);}}},setEnabled:function(enabled){this.ready(function(){var status=this.getStatus();if(status==='enabling'||status==='disabling'){}else{if(enabled&&status==='enabled'||!enabled&&status==='disabled'){return;}
var setObj={};setObj[kCommunicationKey]=enabled;this._mozSettings.createLock().set(setObj);}}.bind(this));},init:function(){var self=this;var lock=window.navigator.mozSettings.createLock();var req=lock.get(kStatusKey);req.onsuccess=function(){self._cachedStatus=req.result[kStatusKey];self._callbacks.forEach(function(callback){callback(self._cachedStatus);});};this._mozSettings.addObserver(kStatusKey,function(evt){var currentStatus=evt.settingValue;self._cachedStatus=currentStatus;self._callbacks.forEach(function(callback){callback(currentStatus);});});}};exports.AirplaneModeHelper=AirplaneModeHelper;AirplaneModeHelper.init();})(this);

View file

@ -0,0 +1,4 @@
(function(exports){'use strict';var NETWORK_TYPES=[null,'gprs','edge','umts','is95a','is95b','1xrtt','evdo0','evdoa','hsdpa','hsupa','hspa','evdob','ehrpd','lte','hspa+','gsm'];function ah_filterByBearer(apns,type){var typeIdx=NETWORK_TYPES.indexOf(type);for(var i=0;i<apns.length;i++){var bearer=apns[i].bearer?+apns[i].bearer:0;if(bearer&&(bearer!==typeIdx)){apns.splice(i,1);}}}
function ah_getCompatible(list,mcc,mnc,type){var apns=list[mcc]?(list[mcc][mnc]||[]):[];ah_filterByBearer(apns,type);return apns;}
var ApnHelper={getCompatible:ah_getCompatible};exports.ApnHelper=ApnHelper;})(this);

View file

@ -0,0 +1,15 @@
this.asyncStorage=(function(){'use strict';var DBNAME='asyncStorage';var DBVERSION=1;var STORENAME='keyvaluepairs';var db=null;function withDatabase(f){if(db){f();}else{var openreq=indexedDB.open(DBNAME,DBVERSION);openreq.onerror=function withStoreOnError(){console.error('asyncStorage: can\'t open database:',openreq.error.name);};openreq.onupgradeneeded=function withStoreOnUpgradeNeeded(){openreq.result.createObjectStore(STORENAME);};openreq.onsuccess=function withStoreOnSuccess(){db=openreq.result;f();};}}
function withStore(type,callback,oncomplete){withDatabase(function(){var transaction=db.transaction(STORENAME,type);if(oncomplete){transaction.oncomplete=oncomplete;}
callback(transaction.objectStore(STORENAME));});}
function getItem(key,callback){var req;withStore('readonly',function getItemBody(store){req=store.get(key);req.onerror=function getItemOnError(){console.error('Error in asyncStorage.getItem(): ',req.error.name);};},function onComplete(){var value=req.result;if(value===undefined){value=null;}
callback(value);});}
function setItem(key,value,callback){withStore('readwrite',function setItemBody(store){var req=store.put(value,key);req.onerror=function setItemOnError(){console.error('Error in asyncStorage.setItem(): ',req.error.name);};},callback);}
function removeItem(key,callback){withStore('readwrite',function removeItemBody(store){var req=store.delete(key);req.onerror=function removeItemOnError(){console.error('Error in asyncStorage.removeItem(): ',req.error.name);};},callback);}
function clear(callback){withStore('readwrite',function clearBody(store){var req=store.clear();req.onerror=function clearOnError(){console.error('Error in asyncStorage.clear(): ',req.error.name);};},callback);}
function length(callback){var req;withStore('readonly',function lengthBody(store){req=store.count();req.onerror=function lengthOnError(){console.error('Error in asyncStorage.length(): ',req.error.name);};},function onComplete(){callback(req.result);});}
function key(n,callback){if(n<0){callback(null);return;}
var req;withStore('readonly',function keyBody(store){var advanced=false;req=store.openCursor();req.onsuccess=function keyOnSuccess(){var cursor=req.result;if(!cursor){return;}
if(n===0||advanced){return;}
advanced=true;cursor.advance(n);};req.onerror=function keyOnError(){console.error('Error in asyncStorage.key(): ',req.error.name);};},function onComplete(){var cursor=req.result;callback(cursor?cursor.key:null);});}
return{getItem:getItem,setItem:setItem,removeItem:removeItem,clear:clear,length:length,key:key};}());

View file

@ -0,0 +1,2 @@
;(function(exports){'use strict';exports.ComponentUtils={style:function(baseUrl){if(window.VulpesCompat){window.VulpesCompat.componentStyle(this,baseUrl).catch(console.error);return;}var style=document.createElement('style');var url=baseUrl+'style.css';var self=this;style.setAttribute('scoped','');style.innerHTML='@import url('+url+');';this.appendChild(style);this.style.visibility='hidden';style.addEventListener('load',function(){if(self.shadowRoot){self.shadowRoot.appendChild(style.cloneNode(true));}
self.style.visibility='';});}};}(window));

View file

@ -0,0 +1,3 @@
;(function(){'use strict';if(window.navigator.mozHour12||window.navigator.hour12){return;}
window.navigator.mozHour12=undefined;var _setMozHour12=function(result){if(result===null){result=undefined;}
if(window.navigator.mozHour12!==result){window.navigator.mozHour12=result;window.dispatchEvent(new CustomEvent('timeformatchange'));}};var _hour12Handler=function(event){_setMozHour12(event.settingValue);};var _kLocaleTime='locale.hour12';var req=window.navigator.mozSettings.createLock().get(_kLocaleTime);req.onsuccess=function(){_setMozHour12(req.result[_kLocaleTime]);};window.navigator.mozSettings.addObserver(_kLocaleTime,_hour12Handler);})();

View file

@ -0,0 +1,7 @@
function enumerateAll(storages,dir,options){var storageIndex=0;var ds_cursor=null;var cursor={continue:function cursor_continue(){ds_cursor.continue();}};function onsuccess(e){cursor.result=e.target.result;if(!cursor.result){storageIndex++;if(storageIndex<storages.length){enumerateNextStorage();return;}}
if(cursor.onsuccess){try{cursor.onsuccess(e);}catch(err){console.warn('enumerateAll onsuccess threw',err);}}}
function onerror(e){cursor.error=e.target.error;if(cursor.error.name==='NotFoundError'&&storageIndex!==storages.length-1){storageIndex++;enumerateNextStorage();return;}
if(cursor.onerror){try{cursor.onerror(e);}catch(err){console.warn('enumerateAll onerror threw',err);}}}
function enumerateNextStorage(){ds_cursor=storages[storageIndex].enumerate(dir,options||{});ds_cursor.onsuccess=onsuccess;ds_cursor.onerror=onerror;}
enumerateNextStorage();return cursor;}

View file

@ -0,0 +1,8 @@
(function(exports){'use strict';var NUMBER_OF_DECIMALS=2;var BYTE_SCALE=['B','KB','MB','GB','TB'];function _getFormattedSize(bytes){if(bytes===undefined||isNaN(bytes)){return Promise.resolve(null);}
var index=0;while(bytes>=1024&&index<BYTE_SCALE.length){bytes/=1024;++index;}
return document.l10n.formatValue('byteUnit-'+BYTE_SCALE[index]).then(unit=>{return document.l10n.formatValue('fileSize',{size:bytes.toFixed(NUMBER_OF_DECIMALS),unit:unit});});}
function _calcPercentage(currently,total){if(total===0){return 0;}
return parseInt((100*currently)/total);}
var DownloadFormatter={getFormattedSize:function(bytes){return _getFormattedSize(bytes);},getPercentage:function(download){return _calcPercentage(download.currentBytes,download.totalBytes);},getFileName:function(download){return download.path.split('/').pop();},getTotalSize:function(download){var bytes=download.totalBytes;return _getFormattedSize(bytes);},getDownloadedSize:function(download){var bytes=download.currentBytes;return _getFormattedSize(bytes);},getDate:function(download){var date;try{date=download.startTime;}catch(ex){date=new Date();console.error(ex);}
var formatter=mozIntl._gaia.RelativeDate(navigator.languages);return formatter.format(date);},getUUID:function(download){return download.id||this.getFileName(download);}};exports.DownloadFormatter=DownloadFormatter;}(this));

View file

@ -0,0 +1,28 @@
var DownloadHelper=(function(){var CODE={FILE_NOT_FOUND:'FILE_NOT_FOUND',DEVICE_STORAGE:'DEVICE_STORAGE',MIME_TYPE_NOT_SUPPORTED:'MIME_TYPE_NOT_SUPPORTED',INVALID_STATE:'INVALID_STATE',NO_SDCARD:'NO_SDCARD',NO_PROVIDER:'NO_PROVIDER',UNMOUNTED_SDCARD:'UNMOUNTED_SDCARD'};var Request=function(){this.done=function(result){if(typeof this.onsuccess==='function'){this.result=result;window.setTimeout(function(){this.onsuccess({target:this});}.bind(this),0);}};this.failed=function(error){if(typeof this.onerror==='function'){this.error=error;window.setTimeout(function(){this.onerror({target:this});}.bind(this),0);}};};var STORAGE_NAME_BY_DEFAULT='sdcard';var STORAGE_NAME_KEY='device.storage.writable.name';var storageName=STORAGE_NAME_BY_DEFAULT;LazyLoader.load('shared/js/settings_listener.js',function settingsLoaded(){SettingsListener.observe(STORAGE_NAME_KEY,STORAGE_NAME_BY_DEFAULT,function setStorageName(evt){var settingValue=evt.settingValue;if(settingValue){storageName=settingValue;}});});function sendError(req,message,code){req.failed({message:message,code:code});console.error(message);}
function getBlob(download){var req=new Request();var storage=getVolume(download.storageName);var storeAvailableReq=storage.available();storeAvailableReq.onsuccess=function available_onsuccess(e){var path=download.storagePath;switch(storeAvailableReq.result){case'unavailable':sendError(req,' Could not open the file: '+path+' from '+
download.storageName,CODE.NO_SDCARD);break;case'shared':sendError(req,' Could not open the file: '+path+' from '+
download.storageName,CODE.UNMOUNTED_SDCARD);break;default:try{var storeGetReq=storage.get(path);storeGetReq.onsuccess=function store_onsuccess(){req.done(storeGetReq.result);};storeGetReq.onerror=function store_onerror(){sendError(req,storeGetReq.error.name+' Could not open the file: '+path+' from '+
download.storageName,CODE.FILE_NOT_FOUND);};}catch(ex){sendError(req,'Error getting the file '+path+' from '+
download.storageName,CODE.DEVICE_STORAGE);}}};storeAvailableReq.onerror=function available_onerror(){sendError(req,'Error getting storage state ',CODE.DEVICE_STORAGE);};return req;}
var Action=function Action(params){this.req=params.request;this.name=params.actionType.activityName;};Action.prototype={run:function a_run(){var activity=new MozActivity({name:this.name,data:this.data});activity.onsuccess=this._onsuccess.bind(this);activity.onerror=this._onerror.bind(this);},_onsuccess:function a_onsuccess(){this.req.done();},_onerror:function a_onerror(evt){this.req.failed({message:evt.target.error.name});}};var OpenAction=function OpenAction(params){Action.call(this,params);this.data={url:params.download.path,filename:DownloadFormatter.getFileName(params.download),type:params.type,blob:params.blob};};OpenAction.prototype={__proto__:Action.prototype};var ShareAction=function ShareAction(params){Action.call(this,params);this.data={type:params.type.split('/')[0]+'/*',blobs:[params.blob],filenames:[DownloadFormatter.getFileName(params.download)]};};ShareAction.prototype={__proto__:Action.prototype,_onerror:function sa_onerror(evt){if(evt.target.error.name!=='NO_PROVIDER'){return;}
sendError(this.req,'No provider to share file',CODE.NO_PROVIDER);}};var InfoAction=function InfoAction(params){Action.call(this,params);this.data={name:DownloadFormatter.getFileName(params.download),type:params.type,blob:params.blob,size:params.download.totalBytes,path:params.download.path};};InfoAction.prototype={__proto__:Action.prototype,run:function ia_run(){this.req.done(this.data);}};var ActionsFactory={TYPE:{OPEN:{activityName:'open',actionClass:OpenAction},SHARE:{activityName:'share',actionClass:ShareAction},INFO:{actionClass:InfoAction},WALLPAPER:{activityName:'setwallpaper',actionClass:ShareAction},RINGTONE:{activityName:'setringtone',actionClass:ShareAction}},create:function af_create(params){return new params.actionType.actionClass(params);}};function getType(download){var fileName=DownloadFormatter.getFileName(download);var type=MimeMapper.guessTypeFromFileProperties(fileName,download.contentType);return type;}
function runAction(actionType,download){var req=new Request();window.setTimeout(function launching(){var state=download.state;if(state==='succeeded'||state==='finalized'){LazyLoader.load(['shared/js/mime_mapper.js','shared/js/download/download_formatter.js'],function loaded(){var type=getType(download);if(type.length===0){type=download.contentType;if(actionType!==ActionsFactory.TYPE.OPEN&&actionType!==ActionsFactory.TYPE.INFO){sendError(req,'Mime type not supported: '+type,CODE.MIME_TYPE_NOT_SUPPORTED);return;}}
var blobReq=getBlob(download);blobReq.onsuccess=function(){ActionsFactory.create({actionType:actionType,download:download,type:type,blob:blobReq.result,request:req}).run();};blobReq.onerror=function(){req.failed(blobReq.error);};});return;}
sendError(req,'Becareful, the download is not finished!',CODE.INVALID_STATE);},0);return req;}
function remove(download){var req=new Request();var incompleteDownload=download.state!=='succeeded';setTimeout(function(){if(incompleteDownload){if(!navigator.mozDownloadManager){sendError(req,'DownloadManager not present',CODE.INVALID_STATE);}else{download.pause().then(function(){navigator.mozDownloadManager.remove(download).then(function success(){req.done(download);},function error(){sendError(req,'DownloadManager doesnt know about this download',CODE.INVALID_STATE);});},function(){sendError(req,'Failed to pause download before removal',CODE.INVALID_STATE);});}}else{req.done(download);}},0);return incompleteDownload?req:doRemoveFromPhone(req,download);}
function doRemoveFromPhone(deleteRequest,download){var req=new Request();deleteRequest.onsuccess=function(){var storage=getVolume(download.storageName);var storeAvailableReq=storage.available();storeAvailableReq.onsuccess=function available_onsuccess(e){var path=download.path;switch(storeAvailableReq.result){case'unavailable':sendError(req,' Could not delete the file: '+path+' from '+
storageName,CODE.NO_SDCARD);break;case'shared':sendError(req,' Could not delete the file: '+path+' from '+
storageName,CODE.UNMOUNTED_SDCARD);break;default:var storeDeleteReq=storage.delete(download.storagePath);storeDeleteReq.onsuccess=function store_onsuccess(){if(download.state==='succeeded'){LazyLoader.load(['/shared/js/download/download_store.js'],function(){DownloadStore.remove(download);});}
req.done(storeDeleteReq.result);};storeDeleteReq.onerror=function store_onerror(){sendError(req,storeDeleteReq.error.name+' Could not remove the file: '+download.path+' from '+
storageName,CODE.FILE_NOT_FOUND);};}};storeAvailableReq.onerror=function available_onerror(){sendError(req,'Error getting storage state ',CODE.DEVICE_STORAGE);};};deleteRequest.onerror=function(error){sendError(req,error.message,error.code);};return req;}
function handlerError(error,download,cb){LazyLoader.load('shared/js/download/download_ui.js',(function loaded(){var req;var show=DownloadUI.show;if(error.message&&(error.message.endsWith('canceled')||error.message.endsWith('cancelled'))){cb&&cb(null);return;}
switch(error.code){case CODE.NO_SDCARD:case CODE.UNMOUNTED_SDCARD:case CODE.FILE_NOT_FOUND:case CODE.NO_PROVIDER:req=show(DownloadUI.TYPE[error.code],download,true);req.onconfirm=cb;break;case CODE.MIME_TYPE_NOT_SUPPORTED:req=show(DownloadUI.TYPE.UNSUPPORTED_FILE_TYPE,download,true);req.onconfirm=function tuftOnConfirm(){showRemoveFileUI(download,cb);};break;default:req=show(DownloadUI.TYPE.FILE_OPEN_ERROR,download,true);req.onconfirm=function tfoeOnConfirm(){showRemoveFileUI(download,cb);};break;}
req.oncancel=cb;}));}
function showRemoveFileUI(download,cb){var req=DownloadUI.show(DownloadUI.TYPE.DELETE,download,true);req.oncancel=cb;req.onconfirm=function doRemove(){if(typeof cb==='function'){cb(download);}else{remove(download);}};}
function getFreeSpace(cb){var storage=navigator.getDeviceStorage(storageName);if(!storage){console.error('Cannot get free space size in sdcard');cb(null);return;}
var req=storage.freeSpace();req.onsuccess=function(e){cb(e.target.result);};req.onerror=function(){cb(null);};}
function getVolume(volumeName){var volumes=navigator.getDeviceStorages('sdcard');if(!volumeName||volumeName===''){return volumes[0];}
for(var i=0;i<volumes.length;++i){if(volumes[i].storageName===volumeName){return volumes[i];}}
return volumes[0];}
return{open:function(download){return runAction(ActionsFactory.TYPE.OPEN,download);},share:function(download){return runAction(ActionsFactory.TYPE.SHARE,download);},wallpaper:function(download){return runAction(ActionsFactory.TYPE.WALLPAPER,download);},ringtone:function(download){return runAction(ActionsFactory.TYPE.RINGTONE,download);},info:function(download){return runAction(ActionsFactory.TYPE.INFO,download);},remove:remove,get CODE(){return CODE;},handlerError:handlerError,getFreeSpace:getFreeSpace};}());

View file

@ -0,0 +1,31 @@
var DownloadStore=(function(){var datastore;const DATASTORE_NAME='download_store';var downloadListDB;var downloadList=[];var lastRevisionId;const LIST_DB='download_list';const LIST_STORE='download_list';const LIST_KEY=0;const REVISION_KEY=1;var Request=function(){this.done=function(result){if(typeof this.onsuccess==='function'){this.result=result;window.setTimeout(function(){this.onsuccess({target:this});}.bind(this),0);}};this.failed=function(error){if(typeof this.onerror==='function'){this.error=error;window.setTimeout(function(){this.onerror({target:this});}.bind(this),0);}};};function promisify(request){return new Promise(function(resolve,reject){request.onsuccess=(event)=>{resolve(event.target.result);};request.onerror=(event)=>{reject(event.target.errorCode);};});}
var readyState;function init(success,fail){if(readyState==='initialized'){success();return;}
if(readyState==='initializing'){document.addEventListener('ds-initialized',function oninitalized(){document.removeEventListener('ds-initialized',oninitalized);success();});return;}
readyState='initializing';if(!navigator.getDataStores){var messageError='Data store: DataStore API is not working';console.error(messageError);fail({message:messageError});return;}
navigator.getDataStores(DATASTORE_NAME).then(function(ds){var messageError='Download Store: Cannot get access to the DataStore';if(ds.length<1){console.error(messageError);throw({message:messageError});}
datastore=ds[0];}).then(function(){return openDownloadListIndexedDB();}).then(function(db){downloadListDB=db;var listStore=downloadListDB.transaction(LIST_STORE,'readonly').objectStore(LIST_STORE);return Promise.all([promisify(listStore.get(LIST_KEY)).then((value)=>{downloadList=value;}),promisify(listStore.get(REVISION_KEY)).then((value)=>{lastRevisionId=value;})]);}).then(function(){readyState='initialized';const LEGACY_INDEX_ID=1;if(downloadList&&downloadList.includes(LEGACY_INDEX_ID)){return promisify(get(LEGACY_INDEX_ID)).then((download)=>{if('byTimestamp'in download){downloadList.splice(downloadList.indexOf(LEGACY_INDEX_ID),1);}});}}).then(function(){notifyOpenSuccess(success);}).catch(function(e){console.error('Error while opening the Download Store: ',e.message);fail(e);});}
function openDownloadListIndexedDB(){return new Promise(function(resolve,reject){var request=indexedDB.open(LIST_DB);request.onsuccess=function(event){var db=event.target.result;resolve(db);};request.onerror=function(event){reject(event.target.errorCode);};request.onupgradeneeded=function(event){var db=event.target.result;promisify(db.createObjectStore(LIST_STORE)).then(()=>{var listStore=db.transaction(LIST_STORE,'readwrite').objectStore(LIST_STORE);return Promise.all([promisify(listStore.add([],LIST_KEY)),promisify(listStore.add(0,REVISION_KEY))]);}).catch(reject);};request.onblocked=function(event){reject(event.target.errorCode);};});}
function notifyOpenSuccess(cb){window.setTimeout(cb,0);document.dispatchEvent(new CustomEvent('ds-initialized'));}
var fieldsToPropagate=['url','path','totalBytes','contentType','startTime','state','storageName','storagePath'];function cookDownload(download){var ret=Object.create(null);fieldsToPropagate.forEach(function(field){ret[field]=download[field];});ret.finalizeTime=new Date();return ret;}
function defaultError(req){return defaultErrorCb.bind(null,req);}
function defaultErrorCb(request,error){request.failed(error);}
function defaultSuccess(req){return defaultSuccessCb.bind(null,req);}
function defaultSuccessCb(request,result){request.done(result);}
function updateDownloadList(){var cursor=datastore.sync(lastRevisionId);function cursorResolve(task){switch(task.operation){case'done':lastRevisionId=task.revisionId;var listStore=downloadListDB.transaction(LIST_STORE,'readwrite').objectStore(LIST_STORE);return Promise.all([promisify(listStore.put(downloadList,LIST_KEY)),promisify(listStore.put(lastRevisionId,REVISION_KEY))]);case'clear':downloadList=[];break;case'add':downloadList.push(task.id);break;case'update':break;case'remove':var i=downloadList.indexOf(task.id);if(i>=0){downloadList.splice(i,1);}
break;}
return cursor.next().then(cursorResolve);}
return cursor.next().then(cursorResolve);}
function doAdd(download,req){var downloadCooked=cookDownload(download);datastore.add(downloadCooked).then(function(id){downloadCooked.id=id;datastore.put(downloadCooked,id).then(function(){req.done(downloadCooked);},defaultError(req));},defaultError(req));}
function add(download){var req=new Request();window.setTimeout(function(){init(doAdd.bind(null,download,req),req.failed.bind(req));});return req;}
function doGet(id,req){datastore.get(id).then(function(download){req.done(download);},defaultError(req));}
function get(id){var req=new Request();window.setTimeout(function(){init(doGet.bind(null,id,req),req.failed.bind(req));});return req;}
function doGetAll(req){updateDownloadList().then(function(){datastore.get.apply(datastore,downloadList).then(defaultSuccess(req),defaultError(req));},defaultError(req));}
function getAll(){var req=new Request();window.setTimeout(function(){init(doGetAll.bind(null,req),req.failed.bind(req));});return req;}
function doRemove(id,req){datastore.remove(id).then(function(success){if(success){defaultSuccess(req);}else{req.failed({message:'The download with id: '+id+'does not exist'});}},defaultError(req));}
function remove(download){var req=new Request();window.setTimeout(function(){init(doRemove.bind(null,download.id,req),req.failed.bind(req));});return req;}
function doAddListener(listener){datastore.addEventListener('change',listener);}
function addListener(listener){var req=new Request();window.setTimeout(function(){init(doAddListener.bind(null,listener),req.failed.bind(req));});return req;}
function doRemoveListener(listener){datastore.removeEventListener('change',listener);}
function removeListener(listener){var req=new Request();window.setTimeout(function(){init(doRemoveListener.bind(null,listener),req.failed.bind(req));});return req;}
return{get:get,getAll:getAll,add:add,remove:remove,addListener:addListener,removeListener:removeListener};}());

View file

@ -0,0 +1,24 @@
var DownloadUI=(function(){var DownloadType=function(name,classes,isPlainMessage){this.name=name;this.classes=classes;this.isPlainMessage=isPlainMessage;this.numberOfButtons=classes.indexOf('full')!==-1?1:2;};var ERRORS={NO_MEMORY:2152857616,NO_SDCARD:2152857618,UNMOUNTED_SDCARD:2152857621};var TYPES={STOP:new DownloadType('stop',['danger'],true),STOPPED:new DownloadType('stopped',['recommend'],true),FAILED:new DownloadType('failed',['recommend']),DELETE:new DownloadType('delete',['danger']),DELETE_ALL:new DownloadType('delete_all',['danger']),UNSUPPORTED_FILE_TYPE:new DownloadType('unsupported_file_type',['danger']),FILE_NOT_FOUND:new DownloadType('file_not_found',['recommend','full'],true),FILE_OPEN_ERROR:new DownloadType('file_open_error',['danger']),NO_SDCARD:new DownloadType('no_sdcard_found_2',['recommend','full'],true),UNMOUNTED_SDCARD:new DownloadType('unmounted_sdcard_2',['recommend','full'],true),NO_PROVIDER:new DownloadType('no_provider',['recommend','full'],true),NO_MEMORY:new DownloadType('no_memory',['recommend','full'],true)};var DownloadAction=function(id,type){this.id=id;this.name=id.toLowerCase();this.title=this.name+'_downloaded_file';this.type=type;};var ACTIONS={OPEN:new DownloadAction('OPEN','confirm'),SHARE:new DownloadAction('SHARE','confirm'),WALLPAPER:new DownloadAction('WALLPAPER','confirm'),RINGTONE:new DownloadAction('RINGTONE','confirm')};var confirm=null;var actionMenu=null;var Request=function(){this.cancel=function(){removeContainers();if(typeof this.oncancel==='function'){this.oncancel();}};this.confirm=function(result){removeContainers();if(typeof this.onconfirm==='function'){this.result=result;this.onconfirm({target:this});}};};function removeContainers(){removeConfirm();removeActionMenu();}
function addConfirm(){if(confirm!==null){confirm.parentNode.removeChild(confirm);}
confirm=document.createElement('form');confirm.id='downloadConfirmUI';confirm.setAttribute('role','dialog');confirm.setAttribute('data-type','confirm');confirm.setAttribute('data-z-index-level','100');var screen=document.getElementById('screen');var container=screen||document.body;container.appendChild(confirm);}
function removeConfirm(){if(confirm===null){return;}
confirm.innerHTML='';confirm.style.display='none';}
window.addEventListener('home',removeContainers);window.addEventListener('holdhome',removeContainers);function l10n(element,l10nid,l10nargs){if(l10nargs){element.setAttribute('data-l10n-args',JSON.stringify(l10nargs));}
element.setAttribute('data-l10n-id',l10nid);return element;}
function createConfirm(type,req,downloads){addConfirm();var dialog=document.createElement('section');var header=document.createElement('h1');l10n(header,type.name+'_download_title');dialog.appendChild(header);var message=document.createElement('p');if(type.isPlainMessage){l10n(message,type.name+'_download_message');}else{var args=Object.create(null);if(type===TYPES.DELETE_ALL){args.number=downloads.length;}else{args.name=DownloadFormatter.getFileName(downloads[0]);}
l10n(message,type.name+'_download_message',args);}
dialog.appendChild(message);var menu=document.createElement('menu');menu.dataset.items=type.numberOfButtons;if(type.numberOfButtons===2){var lButton=document.createElement('button');lButton.type='button';lButton.setAttribute('data-l10n-id',type.name+'_download_left_button');lButton.onclick=function l_cancel(){lButton.onclick=null;req.cancel();};menu.appendChild(lButton);}
var rButton=document.createElement('button');rButton.type='button';type.classes.forEach(function(clazz){rButton.classList.add(clazz);});rButton.setAttribute('data-l10n-id',type.name+'_download_right_button');rButton.onclick=function r_confirm(){rButton.onclick=null;req.confirm();};menu.appendChild(rButton);dialog.appendChild(menu);confirm.appendChild(dialog);confirm.style.display='block';}
function addActionMenu(){if(actionMenu!==null){document.body.removeChild(actionMenu);}
actionMenu=document.createElement('gaia-menu');actionMenu.id='downloadActionMenuUI';actionMenu.className='actions';}
function removeActionMenu(){if(actionMenu===null){return;}
actionMenu.hide();document.body.removeChild(actionMenu);actionMenu=null;}
function createActionMenu(req,download){var actions=[ACTIONS.OPEN,ACTIONS.SHARE];var fileName=DownloadFormatter.getFileName(download);var type=MimeMapper.guessTypeFromFileProperties(fileName,download.contentType);if(type.length>0){if(type.startsWith('image/')){actions.push(ACTIONS.WALLPAPER);}else if(type.startsWith('audio/')){actions.push(ACTIONS.RINGTONE);}}
doCreateActionMenu(req,fileName,actions);}
function doCreateActionMenu(req,fileName,actions){addActionMenu();var header=document.createElement('header');header.textContent=fileName;actionMenu.appendChild(header);actions.forEach(function addActionButton(action){var button=document.createElement('button');button.id=action.id;l10n(button,action.title);button.dataset.type=action.type;actionMenu.appendChild(button);button.addEventListener('click',function buttonCliked(evt){button.removeEventListener('click',buttonCliked);req[evt.target.dataset.type](ACTIONS[evt.target.id]);});});document.body.appendChild(actionMenu);actionMenu.removeAttribute('hidden');}
var styleSheets=['shared/style/buttons.css','shared/style/headers.css','shared/style/confirm.css'];function show(type,downloads,ignoreStyles){var req=new Request();downloads=Array.isArray(downloads)?downloads:[downloads];window.setTimeout(function(){var libs=['shared/js/download/download_formatter.js'];if(!ignoreStyles){libs.push.apply(libs,styleSheets);}
if(type===null){type=TYPES.STOPPED;var download=downloads[0];if(download.state==='finalized'||download.state==='stopped'&&download.error!==null){type=TYPES.FAILED;}}
LazyLoader.load(libs,createConfirm.call(this,type,req,downloads));},0);return req;}
function showActions(download){var req=new Request();window.setTimeout(function(){LazyLoader.load(['shared/js/mime_mapper.js','shared/js/download/download_formatter.js','shared/js/component_utils.js','shared/elements/gaia_menu/script.js'],createActionMenu.call(this,req,download));},0);return req;}
return{show:show,showActions:showActions,hide:removeContainers,get ERRORS(){return ERRORS;},get TYPE(){return TYPES;}};}());

View file

@ -0,0 +1,4 @@
;(function(){'use strict';function dump_off(msg,optionalObject){}
function dump_on(msg,optionalObject){var output=msg;if(optionalObject){try{output+=JSON.stringify(optionalObject);}catch(e){}}
if(dump){var appName=document.location.hostname.replace(/\..*$/,'');dump('['+appName+'] '+output+'\n');}else{console.log(output);}}
window.DUMP=dump_off;var settings=window.navigator.mozSettings;var reqGaiaDebug=settings.createLock().get('debug.gaia.enabled');reqGaiaDebug.onsuccess=function gaiaDebug(){window.DUMP=reqGaiaDebug.result['debug.gaia.enabled']?dump_on:dump_off;};settings.addObserver('debug.gaia.enabled',function(event){window.DUMP=event.settingValue?dump_on:dump_off;dump_on(event.settingValue?'Enabling DUMP':'Disabling DUMP');});}());

View file

@ -0,0 +1,18 @@
'use strict';(function(exports){var datastore;var storeName='homescreen_settings';var readyState;var listeners=Object.create(null);function init(){return new Promise(function doInit(resolve,reject){if(readyState==='initialized'){resolve();return;}
if(readyState==='initializing'){document.addEventListener('vps-initialized',function oninitalized(){document.removeEventListener('vps-initialized',oninitalized);resolve();});return;}
readyState='initializing';if(!navigator.getDataStores){console.error('Home screen settings store: '+'DataStore API is not working');reject({name:'NO_DATASTORE'});readyState='failed';return;}
navigator.getDataStores(storeName).then(function(ds){if(ds.length<1){console.error('Home screen settings store: '+'Cannot get access to the Store');reject({name:'NO_ACCESS_TO_DATASTORE'});readyState='failed';return;}
datastore=ds[0];datastore.addEventListener('change',onchangeHandler);readyState='initialized';document.dispatchEvent(new CustomEvent('vps-initialized'));resolve();},reject);});}
function onchangeHandler(event){var operation=event.operation;var callbacks=listeners[operation];callbacks&&callbacks.forEach(function iterCallback(callback){datastore.get(event.id).then(function got(result){callback.method.call(callback.context||this,{type:operation,target:{name:event.id,value:result}});});});}
function addEventListener(type,callback){var context;if(!(type in listeners)){listeners[type]=[];}
var cb=callback;if(typeof cb==='object'){context=cb;cb=cb.handleEvent;}
if(cb){listeners[type].push({method:cb,context:context});init();}}
function removeEventListener(type,callback){if(!(type in listeners)){return false;}
var callbacks=listeners[type];var length=callbacks.length;for(var i=0;i<length;i++){var thisCallback=callback;if(typeof thisCallback==='object'){thisCallback=callback.handleEvent;}
if(callbacks[i]&&callbacks[i].method===thisCallback){callbacks.splice(i,1);return true;}}
return false;}
function get(id){return new Promise(function doGet(resolve,reject){init().then(function onInitialized(){datastore.get(id).then(resolve,reject);},reject);});}
function put(id,value){return new Promise(function doAdd(resolve,reject){init().then(function onInitialized(){datastore.put(value,id).then(function success(){resolve();},reject);},reject);});}
function setStoreName(name){if(readyState==='initializing'){document.addEventListener('vps-initialized',function deferSetStoreName(){document.removeEventListener('vps-initialized',deferSetStoreName);setStoreName(name);});return;}
readyState='uninitialized';storeName=name;}
exports.homescreenSettings={get:get,put:put,addEventListener:addEventListener,removeEventListener:removeEventListener,setStoreName:setStoreName};}(window));

View file

@ -0,0 +1,7 @@
(function(exports){var _iccManager=navigator.mozIccManager;var _iccProxy=null;Object.defineProperty(exports,'IccHelper',{configurable:true,get:function(){return _iccProxy;},set:function(value){_iccProxy=value;}});if(_iccManager&&_iccManager.getIccById){var activeIccObj=null;var eventListeners={};var cachedEventListeners={};var events=['cardstatechange','iccinfochange','stkcommand','stksessionend'];var getters=['iccInfo','cardState'];var methods=['sendStkResponse','sendStkMenuSelection','sendStkTimerExpiration','sendStkEventDownload'];var domRequests=['getCardLock','unlockCardLock','setCardLock','getCardLockRetryCount','readContacts','updateContact','iccOpenChannel','iccExchangeAPDU','iccCloseChannel'];var getterTemplate=function(name){return function(){if(activeIccObj){return activeIccObj[name];}else{return null;}};};var methodTemplate=function(name){return function(){if(activeIccObj){return activeIccObj[name].apply(activeIccObj,arguments);}};};var createIccProxy=function(){var iccProxy={addEventListener:function(eventName,callback){if(typeof callback!=='function'){return;}
if(events.indexOf(eventName)===-1){return;}
var listeners=eventListeners[eventName];if(listeners==null){listeners=eventListeners[eventName]=[];}
if(listeners.indexOf(callback)===-1){listeners.push(callback);}},removeEventListener:function(eventName,callback){var listeners=eventListeners[eventName];if(listeners){var index=listeners.indexOf(callback);if(index!==-1){listeners.splice(index,1);}}}};getters.forEach(function(getter){Object.defineProperty(iccProxy,getter,{enumerable:true,get:getterTemplate(getter)});});methods.forEach(function(method){iccProxy[method]=methodTemplate(method);});domRequests.forEach(function(request){iccProxy[request]=methodTemplate(request);});events.forEach(function(eventName){Object.defineProperty(iccProxy,'on'+eventName,{enumerable:true,set:function(newListener){var oldListener=cachedEventListeners[eventName];if(oldListener){iccProxy.removeEventListener(eventName,oldListener);}
cachedEventListeners[eventName]=newListener;if(newListener){iccProxy.addEventListener(eventName,newListener);}},get:function(){return cachedEventListeners[eventName];}});});return iccProxy;};_iccProxy=createIccProxy();if(_iccManager.iccIds&&_iccManager.iccIds.length){activeIccObj=_iccManager.getIccById(_iccManager.iccIds[0]);if(activeIccObj){events.forEach(function(eventName){activeIccObj.addEventListener(eventName,function(event){var listeners=eventListeners[eventName];if(listeners){listeners.forEach(function(listener){listener(event);});}});});}}
_iccManager.oniccdetected=function(event){if(_iccProxy.cardState==null){activeIccObj=_iccManager.getIccById(event.iccId);if(activeIccObj){events.forEach(function(eventName){activeIccObj.addEventListener(eventName,function(event){var listeners=eventListeners[eventName];if(listeners){listeners.forEach(function(listener){listener(event);});}});});['cardstatechange','iccinfochange'].forEach(function(eventName){if(eventListeners[eventName]){eventListeners[eventName].forEach(function(listener){listener();});}});}}};}else{_iccProxy=_iccManager;}})(window);

View file

@ -0,0 +1,25 @@
(function(exports){var InputApp=function(domApp,dynamicInputs){this.domApp=domApp;this.dynamicInputs=dynamicInputs||{};if(!this.domApp.manifest){throw new Error('InputApp: should not be constructed before DOMApplication '+'has manifest ready.');}};InputApp.prototype.getInputs=function(){var dict={};var inputId;for(inputId in this.domApp.manifest.inputs){dict[inputId]=this.domApp.manifest.inputs[inputId];delete dict[inputId].nameL10nId;}
for(inputId in this.dynamicInputs){if(inputId in dict){break;}
dict[inputId]=this.dynamicInputs[inputId];dict[inputId].isDynamic=true;}
if(this.domApp.manifest.type==='certified'){if('emoji'in dict){dict.emoji.nameL10nId='keyboard-layout-emoji';}}
return dict;};var InputAppListSettings=function(){this._values={enable3rdPartyApps:undefined,dynamicInputs:undefined};this._bindCallback=null;this.ready=false;this._promise=null;};InputAppListSettings.prototype.onchange=null;InputAppListSettings.prototype.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED='keyboard.3rd-party-app.enabled';InputAppListSettings.prototype.SETTINGS_KEY_DYNAMIC_INPUTS='keyboard.dynamic-inputs';InputAppListSettings.prototype.start=function(){if(navigator.mozSettings){this._bindCallback=this.callback.bind(this);navigator.mozSettings.addObserver(this.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED,this._bindCallback);navigator.mozSettings.addObserver(this.SETTINGS_KEY_DYNAMIC_INPUTS,this._bindCallback);}
this.getSettings().then(function(){this.ready=true;}.bind(this));};InputAppListSettings.prototype.getSettings=function(){if(this.ready){return this.getSettingsSync();}
return this.getSettingsAsync();};InputAppListSettings.prototype.getSettingsSync=function(){if(!this.ready){console.warn('getSettingsSync: getSettingsSync called before ready.');}
return this._values;};InputAppListSettings.prototype.getSettingsAsync=function(){if(this._promise){return this._promise;}
var lock=navigator.mozSettings.createLock();var p=this._promise=Promise.all([lock.get(this.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED),lock.get(this.SETTINGS_KEY_DYNAMIC_INPUTS)]).then(function(values){this._values.enable3rdPartyApps=values[0][this.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED];this._values.dynamicInputs=values[1][this.SETTINGS_KEY_DYNAMIC_INPUTS];return this._values;}.bind(this)).catch(function(e){console.error('InputAppListSettings: Fail to get setting.',e);this._promise=null;this._values.enable3rdPartyApps=false;this._values.dynamicInputs={};return this._values;}.bind(this));return p;};InputAppListSettings.prototype.callback=function(obj){switch(obj.settingName){case this.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED:this._values.enable3rdPartyApps=obj.settingValue;break;case this.SETTINGS_KEY_DYNAMIC_INPUTS:this._values.dynamicInputs=obj.settingValue;break;}
if(typeof this.onchange==='function'){this.onchange(this._values);}};InputAppListSettings.prototype.stop=function(){this._values={enable3rdPartyApps:undefined,dynamicInputs:undefined};this.ready=false;this._promise=null;if(navigator.mozSettings){navigator.mozSettings.removeObserver(this.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED,this._bindCallback);navigator.mozSettings.removeObserver(this.SETTINGS_KEY_DYNAMIC_INPUTS,this._bindCallback);this._bindCallback=null;}};var InputAppList=function(){this.ready=false;this._inputApps=null;this.settings=null;this._getListPromise=null;};InputAppList.prototype.onready=null;InputAppList.prototype.onupdate=null;InputAppList.prototype.SETTINGS_KEY_THIRD_PARTY_APP_ENABLED='keyboard.3rd-party-app.enabled';InputAppList.prototype.start=function(){if(navigator.mozApps&&navigator.mozApps.mgmt){navigator.mozApps.mgmt.addEventListener('install',this);navigator.mozApps.mgmt.addEventListener('uninstall',this);}
this.settings=new InputAppListSettings();this.settings.onchange=this._refresh.bind(this);this.settings.start();this.getList().then(function(){this.ready=true;if(typeof this.onready==='function'){return this.onready(this._inputApps);}}.bind(this)).catch(function(e){console.error(e);});};InputAppList.prototype.getList=function(){if(this._getListPromise){return this._getListPromise;}
var p=this._getListPromise=Promise.all([this.settings.getSettings(),this._getAllApps()]).then(this._setInputApps.bind(this)).then(function(){return this._inputApps;}.bind(this)).catch(function(e){this._getListPromise=null;console.error(e);}.bind(this));return p;};InputAppList.prototype.getListSync=function(){if(!this.ready){console.warn('InputAppList: getListSync called when list is not ready.');}
return this._inputApps;};InputAppList.prototype.handleEvent=function(evt){var updated=false;switch(evt.type){case'install':var app=evt.application;if(app.downloading){app.addEventListener('downloadsuccess',this);return;}
updated=this._addInputApp(app);break;case'downloadsuccess':updated=this._addInputApp(evt.target);break;case'uninstall':updated=this._removeInputApp(evt.application);break;}
if(updated&&typeof this.onupdate==='function'){this.onupdate(this._inputApps);}};InputAppList.prototype.stop=function(){this.ready=false;this._inputApps=null;this.settings=null;this._getListPromise=null;if(navigator.mozApps&&navigator.mozApps.mgmt){navigator.mozApps.mgmt.removeEventListener('install',this);navigator.mozApps.mgmt.removeEventListener('uninstall',this);}};InputAppList.prototype._getAllApps=function(){if(!navigator.mozApps||!navigator.mozApps.mgmt){console.error('InputAppList: mozApps.mgmt not available.');return[];}
return Promise.resolve(navigator.mozApps.mgmt.getAll()).catch(function(e){console.error('InputAppList: Fail to get app list.',e);return[];});};InputAppList.prototype._setInputApps=function(values){var apps=values[1];var dynamicInputs=this.settings.getSettingsSync().dynamicInputs||{};var inputApps=apps.filter(this._isInputApp,this).map(function(domApp){var inputApp=new InputApp(domApp,dynamicInputs[domApp.manifestURL]);return inputApp;});if(inputApps.length===0){console.error('InputAppList: No input apps installed?');}
this._inputApps=inputApps;};InputAppList.prototype._addInputApp=function(domApp){if(!this._isInputApp(domApp)){return false;}
this._inputApps.push(new InputApp(domApp));return true;};InputAppList.prototype._removeInputApp=function(domApp){var index=this._inputApps.findIndex(function(appInList){return(appInList.domApp.manifestURL===domApp.manifestURL);});if(index===-1){return false;}
this._inputApps.splice(index,1);return true;};InputAppList.prototype._isInputApp=function(domApp){if(!domApp.manifest||'input'!==domApp.manifest.role){return false;}
if(domApp.manifest.type!=='certified'&&domApp.manifest.type!=='privileged'){return false;}
var settingValues=this.settings.getSettingsSync();if(!settingValues.enable3rdPartyApps&&domApp.manifest.type!=='certified'){console.warn('InputAppList: '+'A 3rd-party input app is installed but the feature is not enabled.',domApp.manifestURL);return false;}
if(domApp.manifest.permissions&&(typeof domApp.manifest.permissions.input!=='object')){return false;}
if(typeof domApp.manifest.inputs!=='object'){return false;}
return true;};InputAppList.prototype._refresh=function(){this._getListPromise=null;this.getList().then(function(){if(typeof this.onupdate==='function'){return this.onupdate(this._inputApps);}}.bind(this)).catch(function(e){console.error(e);});};exports.InputAppListSettings=InputAppListSettings;exports.InputAppList=InputAppList;exports.InputApp=InputApp;}(window));

View file

@ -0,0 +1,280 @@
;var _createClass=(function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if('value'in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}
(function(){'use strict';function emit(listeners,...args){const type=args.shift();if(listeners['*']){listeners['*'].slice().forEach(listener=>listener.apply(this,args));}
if(listeners[type]){listeners[type].slice().forEach(listener=>listener.apply(this,args));}}
function addEventListener(listeners,type,listener){if(!(type in listeners)){listeners[type]=[];}
listeners[type].push(listener);}
function removeEventListener(listeners,type,listener){const typeListeners=listeners[type];const pos=typeListeners.indexOf(listener);if(pos===-1){return;}
typeListeners.splice(pos,1);}
let Client=(function(){function Client(remote){_classCallCheck(this,Client);this.id=this;this.remote=remote;const listeners={};this.on=(...args)=>addEventListener(listeners,...args);this.emit=(...args)=>emit(listeners,...args);}
_createClass(Client,[{key:'method',value:function method(name,...args){return this.remote[name](...args);}}]);return Client;})();function broadcast(type,data){Array.from(this.ctxs.keys()).forEach(client=>client.emit(type,data));}
function L10nError(message,id,lang){this.name='L10nError';this.message=message;this.id=id;this.lang=lang;}
L10nError.prototype=Object.create(Error.prototype);L10nError.prototype.constructor=L10nError;function load(type,url){return new Promise(function(resolve,reject){const xhr=new XMLHttpRequest();if(xhr.overrideMimeType){xhr.overrideMimeType(type);}
xhr.open('GET',url,true);if(type==='application/json'){xhr.responseType='json';}
xhr.addEventListener('load',function io_onload(e){if(e.target.status===200||e.target.status===0){resolve(e.target.response||e.target.responseText);}else{reject(new L10nError('Not found: '+url));}});xhr.addEventListener('error',reject);xhr.addEventListener('timeout',reject);try{xhr.send(null);}catch(e){if(e.name==='NS_ERROR_FILE_NOT_FOUND'){reject(new L10nError('Not found: '+url));}else{throw e;}}});}
const io={extra:function(code,ver,path,type){return navigator.mozApps.getLocalizationResource(code,ver,path,type);},app:function(code,ver,path,type){switch(type){case'text':return load('text/plain',path);case'json':return load('application/json',path);default:throw new L10nError('Unknown file type: '+type);}}};function fetchResource(res,{code,src,ver}){const url=res.replace('{locale}',code);const type=res.endsWith('.json')?'json':'text';return io[src](code,ver,url,type);}
const KNOWN_MACROS=['plural'];const MAX_PLACEABLE_LENGTH=2500;const FSI='⁨';const PDI='⁩';const resolutionChain=new WeakSet();function format(ctx,lang,args,entity){if(typeof entity==='string'){return[{},entity];}
if(resolutionChain.has(entity)){throw new L10nError('Cyclic reference detected');}
resolutionChain.add(entity);let rv;try{rv=resolveValue({},ctx,lang,args,entity.value,entity.index);}finally{resolutionChain.delete(entity);}
return rv;}
function resolveIdentifier(ctx,lang,args,id){if(KNOWN_MACROS.indexOf(id)>-1){return[{},ctx._getMacro(lang,id)];}
if(args&&args.hasOwnProperty(id)){if(typeof args[id]==='string'||typeof args[id]==='number'&&!isNaN(args[id])){return[{},args[id]];}else{throw new L10nError('Arg must be a string or a number: '+id);}}
if(id==='__proto__'){throw new L10nError('Illegal id: '+id);}
const entity=ctx._getEntity(lang,id);if(entity){return format(ctx,lang,args,entity);}
throw new L10nError('Unknown reference: '+id);}
function subPlaceable(locals,ctx,lang,args,id){let newLocals,value;try{[newLocals,value]=resolveIdentifier(ctx,lang,args,id);}catch(err){return[{error:err},FSI+'{{ '+id+' }}'+PDI];}
if(typeof value==='number'){const formatter=ctx._getNumberFormatter(lang);return[newLocals,formatter.format(value)];}
if(typeof value==='string'){if(value.length>=MAX_PLACEABLE_LENGTH){throw new L10nError('Too many characters in placeable ('+value.length+', max allowed is '+MAX_PLACEABLE_LENGTH+')');}
return[newLocals,FSI+value+PDI];}
return[{},FSI+'{{ '+id+' }}'+PDI];}
function interpolate(locals,ctx,lang,args,arr){return arr.reduce(function([localsSeq,valueSeq],cur){if(typeof cur==='string'){return[localsSeq,valueSeq+cur];}else{const[,value]=subPlaceable(locals,ctx,lang,args,cur.name);return[localsSeq,valueSeq+value];}},[locals,'']);}
function resolveSelector(ctx,lang,args,expr,index){let selectorName;if(index[0].type==='call'&&index[0].expr.type==='prop'&&index[0].expr.expr.name==='cldr'){selectorName='plural';}else{selectorName=index[0].name;}
const selector=resolveIdentifier(ctx,lang,args,selectorName)[1];if(typeof selector!=='function'){return selector;}
const argValue=index[0].args?resolveIdentifier(ctx,lang,args,index[0].args[0].name)[1]:undefined;if(selectorName==='plural'){if(argValue===0&&'zero'in expr){return'zero';}
if(argValue===1&&'one'in expr){return'one';}
if(argValue===2&&'two'in expr){return'two';}}
return selector(argValue);}
function resolveValue(locals,ctx,lang,args,expr,index){if(!expr){return[locals,expr];}
if(typeof expr==='string'||typeof expr==='boolean'||typeof expr==='number'){return[locals,expr];}
if(Array.isArray(expr)){return interpolate(locals,ctx,lang,args,expr);}
if(index){const selector=resolveSelector(ctx,lang,args,expr,index);if(selector in expr){return resolveValue(locals,ctx,lang,args,expr[selector]);}}
const defaultKey=expr.__default||'other';if(defaultKey in expr){return resolveValue(locals,ctx,lang,args,expr[defaultKey]);}
throw new L10nError('Unresolvable value');}
const locales2rules={'af':3,'ak':4,'am':4,'ar':1,'asa':3,'az':0,'be':11,'bem':3,'bez':3,'bg':3,'bh':4,'bm':0,'bn':3,'bo':0,'br':20,'brx':3,'bs':11,'ca':3,'cgg':3,'chr':3,'cs':12,'cy':17,'da':3,'de':3,'dv':3,'dz':0,'ee':3,'el':3,'en':3,'eo':3,'es':3,'et':3,'eu':3,'fa':0,'ff':5,'fi':3,'fil':4,'fo':3,'fr':5,'fur':3,'fy':3,'ga':8,'gd':24,'gl':3,'gsw':3,'gu':3,'guw':4,'gv':23,'ha':3,'haw':3,'he':2,'hi':4,'hr':11,'hu':0,'id':0,'ig':0,'ii':0,'is':3,'it':3,'iu':7,'ja':0,'jmc':3,'jv':0,'ka':0,'kab':5,'kaj':3,'kcg':3,'kde':0,'kea':0,'kk':3,'kl':3,'km':0,'kn':0,'ko':0,'ksb':3,'ksh':21,'ku':3,'kw':7,'lag':18,'lb':3,'lg':3,'ln':4,'lo':0,'lt':10,'lv':6,'mas':3,'mg':4,'mk':16,'ml':3,'mn':3,'mo':9,'mr':3,'ms':0,'mt':15,'my':0,'nah':3,'naq':7,'nb':3,'nd':3,'ne':3,'nl':3,'nn':3,'no':3,'nr':3,'nso':4,'ny':3,'nyn':3,'om':3,'or':3,'pa':3,'pap':3,'pl':13,'ps':3,'pt':3,'rm':3,'ro':9,'rof':3,'ru':11,'rwk':3,'sah':0,'saq':3,'se':7,'seh':3,'ses':0,'sg':0,'sh':11,'shi':19,'sk':12,'sl':14,'sma':7,'smi':7,'smj':7,'smn':7,'sms':7,'sn':3,'so':3,'sq':3,'sr':11,'ss':3,'ssy':3,'st':3,'sv':3,'sw':3,'syr':3,'ta':3,'te':3,'teo':3,'th':0,'ti':4,'tig':3,'tk':3,'tl':4,'tn':3,'to':0,'tr':0,'ts':3,'tzm':22,'uk':11,'ur':3,'ve':3,'vi':0,'vun':3,'wa':4,'wae':3,'wo':0,'xh':3,'xog':3,'yo':0,'zh':0,'zu':3};function isIn(n,list){return list.indexOf(n)!==-1;}
function isBetween(n,start,end){return typeof n===typeof start&&start<=n&&n<=end;}
const pluralRules={'0':function(){return'other';},'1':function(n){if(isBetween(n%100,3,10)){return'few';}
if(n===0){return'zero';}
if(isBetween(n%100,11,99)){return'many';}
if(n===2){return'two';}
if(n===1){return'one';}
return'other';},'2':function(n){if(n!==0&&n%10===0){return'many';}
if(n===2){return'two';}
if(n===1){return'one';}
return'other';},'3':function(n){if(n===1){return'one';}
return'other';},'4':function(n){if(isBetween(n,0,1)){return'one';}
return'other';},'5':function(n){if(isBetween(n,0,2)&&n!==2){return'one';}
return'other';},'6':function(n){if(n===0){return'zero';}
if(n%10===1&&n%100!==11){return'one';}
return'other';},'7':function(n){if(n===2){return'two';}
if(n===1){return'one';}
return'other';},'8':function(n){if(isBetween(n,3,6)){return'few';}
if(isBetween(n,7,10)){return'many';}
if(n===2){return'two';}
if(n===1){return'one';}
return'other';},'9':function(n){if(n===0||n!==1&&isBetween(n%100,1,19)){return'few';}
if(n===1){return'one';}
return'other';},'10':function(n){if(isBetween(n%10,2,9)&&!isBetween(n%100,11,19)){return'few';}
if(n%10===1&&!isBetween(n%100,11,19)){return'one';}
return'other';},'11':function(n){if(isBetween(n%10,2,4)&&!isBetween(n%100,12,14)){return'few';}
if(n%10===0||isBetween(n%10,5,9)||isBetween(n%100,11,14)){return'many';}
if(n%10===1&&n%100!==11){return'one';}
return'other';},'12':function(n){if(isBetween(n,2,4)){return'few';}
if(n===1){return'one';}
return'other';},'13':function(n){if(isBetween(n%10,2,4)&&!isBetween(n%100,12,14)){return'few';}
if(n!==1&&isBetween(n%10,0,1)||isBetween(n%10,5,9)||isBetween(n%100,12,14)){return'many';}
if(n===1){return'one';}
return'other';},'14':function(n){if(isBetween(n%100,3,4)){return'few';}
if(n%100===2){return'two';}
if(n%100===1){return'one';}
return'other';},'15':function(n){if(n===0||isBetween(n%100,2,10)){return'few';}
if(isBetween(n%100,11,19)){return'many';}
if(n===1){return'one';}
return'other';},'16':function(n){if(n%10===1&&n!==11){return'one';}
return'other';},'17':function(n){if(n===3){return'few';}
if(n===0){return'zero';}
if(n===6){return'many';}
if(n===2){return'two';}
if(n===1){return'one';}
return'other';},'18':function(n){if(n===0){return'zero';}
if(isBetween(n,0,2)&&n!==0&&n!==2){return'one';}
return'other';},'19':function(n){if(isBetween(n,2,10)){return'few';}
if(isBetween(n,0,1)){return'one';}
return'other';},'20':function(n){if((isBetween(n%10,3,4)||n%10===9)&&!(isBetween(n%100,10,19)||isBetween(n%100,70,79)||isBetween(n%100,90,99))){return'few';}
if(n%1000000===0&&n!==0){return'many';}
if(n%10===2&&!isIn(n%100,[12,72,92])){return'two';}
if(n%10===1&&!isIn(n%100,[11,71,91])){return'one';}
return'other';},'21':function(n){if(n===0){return'zero';}
if(n===1){return'one';}
return'other';},'22':function(n){if(isBetween(n,0,1)||isBetween(n,11,99)){return'one';}
return'other';},'23':function(n){if(isBetween(n%10,1,2)||n%20===0){return'one';}
return'other';},'24':function(n){if(isBetween(n,3,10)||isBetween(n,13,19)){return'few';}
if(isIn(n,[2,12])){return'two';}
if(isIn(n,[1,11])){return'one';}
return'other';}};function getPluralRule(code){const index=locales2rules[code.replace(/-.*$/,'')];if(!(index in pluralRules)){return function(){return'other';};}
return pluralRules[index];}
const L20nIntl=typeof Intl!=='undefined'?Intl:{NumberFormat:function(){return{format:function(v){return v;}};}};let Context=(function(){function Context(env,langs,resIds){_classCallCheck(this,Context);this.langs=langs;this.resIds=resIds;this.env=env;this.emit=(type,evt)=>env.emit(type,evt,this);}
_createClass(Context,[{key:'_formatTuple',value:function _formatTuple(lang,args,entity,id,key){try{return format(this,lang,args,entity);}catch(err){err.id=key?id+'::'+key:id;err.lang=lang;this.emit('resolveerror',err);return[{error:err},err.id];}}},{key:'_formatEntity',value:function _formatEntity(lang,args,entity,id){const[,value]=this._formatTuple(lang,args,entity,id);const formatted={value,attrs:null};if(entity.attrs){formatted.attrs=Object.create(null);for(let key in entity.attrs){const[,attrValue]=this._formatTuple(lang,args,entity.attrs[key],id,key);formatted.attrs[key]=attrValue;}}
return formatted;}},{key:'_formatValue',value:function _formatValue(lang,args,entity,id){return this._formatTuple(lang,args,entity,id)[1];}},{key:'fetch',value:function fetch(langs=this.langs){if(langs.length===0){return Promise.resolve(langs);}
return Promise.all(this.resIds.map(resId=>this.env._getResource(langs[0],resId))).then(()=>langs);}},{key:'_resolve',value:function _resolve(langs,keys,formatter,prevResolved){const lang=langs[0];if(!lang){return reportMissing.call(this,keys,formatter,prevResolved);}
let hasUnresolved=false;const resolved=keys.map((key,i)=>{if(prevResolved&&prevResolved[i]!==undefined){return prevResolved[i];}
const[id,args]=Array.isArray(key)?key:[key,undefined];const entity=this._getEntity(lang,id);if(entity){return formatter.call(this,lang,args,entity,id);}
this.emit('notfounderror',new L10nError('"'+id+'"'+' not found in '+lang.code,id,lang));hasUnresolved=true;});if(!hasUnresolved){return resolved;}
return this.fetch(langs.slice(1)).then(nextLangs=>this._resolve(nextLangs,keys,formatter,resolved));}},{key:'formatEntities',value:function formatEntities(...keys){return this.fetch().then(langs=>this._resolve(langs,keys,this._formatEntity));}},{key:'formatValues',value:function formatValues(...keys){return this.fetch().then(langs=>this._resolve(langs,keys,this._formatValue));}},{key:'_getEntity',value:function _getEntity(lang,id){const cache=this.env.resCache;for(let i=0,resId;resId=this.resIds[i];i++){const resource=cache.get(resId+lang.code+lang.src);if(resource instanceof L10nError){continue;}
if(id in resource){return resource[id];}}
return undefined;}},{key:'_getNumberFormatter',value:function _getNumberFormatter(lang){if(!this.env.numberFormatters){this.env.numberFormatters=new Map();}
if(!this.env.numberFormatters.has(lang)){const formatter=L20nIntl.NumberFormat(lang);this.env.numberFormatters.set(lang,formatter);return formatter;}
return this.env.numberFormatters.get(lang);}},{key:'_getMacro',value:function _getMacro(lang,id){switch(id){case'plural':return getPluralRule(lang.code);default:return undefined;}}}]);return Context;})();function reportMissing(keys,formatter,resolved){const missingIds=new Set();keys.forEach((key,i)=>{if(resolved&&resolved[i]!==undefined){return;}
const id=Array.isArray(key)?key[0]:key;missingIds.add(id);resolved[i]=formatter===this._formatValue?id:{value:id,attrs:null};});this.emit('notfounderror',new L10nError('"'+Array.from(missingIds).join(', ')+'"'+' not found in any language',missingIds));return resolved;}
var MAX_PLACEABLES=100;var PropertiesParser={patterns:null,entryIds:null,emit:null,init:function(){this.patterns={comment:/^\s*#|^\s*$/,entity:/^([^=\s]+)\s*=\s*(.*)$/,multiline:/[^\\]\\$/,index:/\{\[\s*(\w+)(?:\(([^\)]*)\))?\s*\]\}/i,unicode:/\\u([0-9a-fA-F]{1,4})/g,entries:/[^\r\n]+/g,controlChars:/\\([\\\n\r\t\b\f\{\}\"\'])/g,placeables:/\{\{\s*([^\s]*?)\s*\}\}/};},parse:function(emit,source){if(!this.patterns){this.init();}
this.emit=emit;var entries={};var lines=source.match(this.patterns.entries);if(!lines){return entries;}
for(var i=0;i<lines.length;i++){var line=lines[i];if(this.patterns.comment.test(line)){continue;}
while(this.patterns.multiline.test(line)&&i<lines.length){line=line.slice(0,-1)+lines[++i].trim();}
var entityMatch=line.match(this.patterns.entity);if(entityMatch){try{this.parseEntity(entityMatch[1],entityMatch[2],entries);}catch(e){if(!this.emit){throw e;}}}}
return entries;},parseEntity:function(id,value,entries){var name,key;var pos=id.indexOf('[');if(pos!==-1){name=id.substr(0,pos);key=id.substring(pos+1,id.length-1);}else{name=id;key=null;}
var nameElements=name.split('.');if(nameElements.length>2){throw this.error('Error in ID: "'+name+'".'+' Nested attributes are not supported.');}
var attr;if(nameElements.length>1){name=nameElements[0];attr=nameElements[1];if(attr[0]==='$'){throw this.error('Attribute can\'t start with "$"');}}else{attr=null;}
this.setEntityValue(name,attr,key,this.unescapeString(value),entries);},setEntityValue:function(id,attr,key,rawValue,entries){var value=rawValue.indexOf('{{')>-1?this.parseString(rawValue):rawValue;var isSimpleValue=typeof value==='string';var root=entries;var isSimpleNode=typeof entries[id]==='string';if(!entries[id]&&(attr||key||!isSimpleValue)){entries[id]=Object.create(null);isSimpleNode=false;}
if(attr){if(isSimpleNode){const val=entries[id];entries[id]=Object.create(null);entries[id].value=val;}
if(!entries[id].attrs){entries[id].attrs=Object.create(null);}
if(!entries[id].attrs&&!isSimpleValue){entries[id].attrs[attr]=Object.create(null);}
root=entries[id].attrs;id=attr;}
if(key){isSimpleNode=false;if(typeof root[id]==='string'){const val=root[id];root[id]=Object.create(null);root[id].index=this.parseIndex(val);root[id].value=Object.create(null);}
root=root[id].value;id=key;isSimpleValue=true;}
if(isSimpleValue){if(id in root){throw this.error('Duplicated id: '+id);}
root[id]=value;}else{if(!root[id]){root[id]=Object.create(null);}
root[id].value=value;}},parseString:function(str){var chunks=str.split(this.patterns.placeables);var complexStr=[];var len=chunks.length;var placeablesCount=(len-1)/2;if(placeablesCount>=MAX_PLACEABLES){throw this.error('Too many placeables ('+placeablesCount+', max allowed is '+MAX_PLACEABLES+')');}
for(var i=0;i<chunks.length;i++){if(chunks[i].length===0){continue;}
if(i%2===1){complexStr.push({type:'idOrVar',name:chunks[i]});}else{complexStr.push(chunks[i]);}}
return complexStr;},unescapeString:function(str){if(str.lastIndexOf('\\')!==-1){str=str.replace(this.patterns.controlChars,'$1');}
return str.replace(this.patterns.unicode,function(match,token){return String.fromCodePoint(parseInt(token,16));});},parseIndex:function(str){var match=str.match(this.patterns.index);if(!match){throw new L10nError('Malformed index');}
if(match[2]){return[{type:'call',expr:{type:'prop',expr:{type:'glob',name:'cldr'},prop:'plural',cmpt:false},args:[{type:'idOrVar',name:match[2]}]}];}else{return[{type:'idOrVar',name:match[1]}];}},error:function(msg,type='parsererror'){const err=new L10nError(msg);if(this.emit){this.emit(type,err);}
return err;}};const MAX_PLACEABLES$1=100;var L20nParser={parse:function(emit,string){this._source=string;this._index=0;this._length=string.length;this.entries=Object.create(null);this.emit=emit;return this.getResource();},getResource:function(){this.getWS();while(this._index<this._length){try{this.getEntry();}catch(e){if(e instanceof L10nError){this.getJunkEntry();if(!this.emit){throw e;}}else{throw e;}}
if(this._index<this._length){this.getWS();}}
return this.entries;},getEntry:function(){if(this._source[this._index]==='<'){++this._index;const id=this.getIdentifier();if(this._source[this._index]==='['){++this._index;return this.getEntity(id,this.getItemList(this.getExpression,']'));}
return this.getEntity(id);}
if(this._source.startsWith('/*',this._index)){return this.getComment();}
throw this.error('Invalid entry');},getEntity:function(id,index){if(!this.getRequiredWS()){throw this.error('Expected white space');}
const ch=this._source[this._index];const hasIndex=index!==undefined;const value=this.getValue(ch,hasIndex,hasIndex);let attrs;if(value===undefined){if(ch==='>'){throw this.error('Expected ">"');}
attrs=this.getAttributes();}else{const ws1=this.getRequiredWS();if(this._source[this._index]!=='>'){if(!ws1){throw this.error('Expected ">"');}
attrs=this.getAttributes();}}
++this._index;if(id in this.entries){throw this.error('Duplicate entry ID "'+id,'duplicateerror');}
if(!attrs&&!index&&typeof value==='string'){this.entries[id]=value;}else{this.entries[id]={value,attrs,index};}},getValue:function(ch=this._source[this._index],index=false,required=true){switch(ch){case'\'':case'"':return this.getString(ch,1);case'{':return this.getHash(index);}
if(required){throw this.error('Unknown value type');}
return;},getWS:function(){let cc=this._source.charCodeAt(this._index);while(cc===32||cc===10||cc===9||cc===13){cc=this._source.charCodeAt(++this._index);}},getRequiredWS:function(){const pos=this._index;let cc=this._source.charCodeAt(pos);while(cc===32||cc===10||cc===9||cc===13){cc=this._source.charCodeAt(++this._index);}
return this._index!==pos;},getIdentifier:function(){const start=this._index;let cc=this._source.charCodeAt(this._index);if(cc>=97&&cc<=122||cc>=65&&cc<=90||cc===95){cc=this._source.charCodeAt(++this._index);}else{throw this.error('Identifier has to start with [a-zA-Z_]');}
while(cc>=97&&cc<=122||cc>=65&&cc<=90||cc>=48&&cc<=57||cc===95){cc=this._source.charCodeAt(++this._index);}
return this._source.slice(start,this._index);},getUnicodeChar:function(){for(let i=0;i<4;i++){let cc=this._source.charCodeAt(++this._index);if(cc>96&&cc<103||cc>64&&cc<71||cc>47&&cc<58){continue;}
throw this.error('Illegal unicode escape sequence');}
this._index++;return String.fromCharCode(parseInt(this._source.slice(this._index-4,this._index),16));},stringRe:/"|'|{{|\\/g,getString:function(opchar,opcharLen){const body=[];let placeables=0;this._index+=opcharLen;const start=this._index;let bufStart=start;let buf='';while(true){this.stringRe.lastIndex=this._index;const match=this.stringRe.exec(this._source);if(!match){throw this.error('Unclosed string literal');}
if(match[0]==='"'||match[0]==='\''){if(match[0]!==opchar){this._index+=opcharLen;continue;}
this._index=match.index+opcharLen;break;}
if(match[0]==='{{'){if(placeables>MAX_PLACEABLES$1-1){throw this.error('Too many placeables, maximum allowed is '+MAX_PLACEABLES$1);}
placeables++;if(match.index>bufStart||buf.length>0){body.push(buf+this._source.slice(bufStart,match.index));buf='';}
this._index=match.index+2;this.getWS();body.push(this.getExpression());this.getWS();this._index+=2;bufStart=this._index;continue;}
if(match[0]==='\\'){this._index=match.index+1;const ch2=this._source[this._index];if(ch2==='u'){buf+=this._source.slice(bufStart,match.index)+this.getUnicodeChar();}else if(ch2===opchar||ch2==='\\'){buf+=this._source.slice(bufStart,match.index)+ch2;this._index++;}else if(this._source.startsWith('{{',this._index)){buf+=this._source.slice(bufStart,match.index)+'{{';this._index+=2;}else{throw this.error('Illegal escape sequence');}
bufStart=this._index;}}
if(body.length===0){return buf+this._source.slice(bufStart,this._index-opcharLen);}
if(this._index-opcharLen>bufStart||buf.length>0){body.push(buf+this._source.slice(bufStart,this._index-opcharLen));}
return body;},getAttributes:function(){const attrs=Object.create(null);while(true){this.getAttribute(attrs);const ws1=this.getRequiredWS();const ch=this._source.charAt(this._index);if(ch==='>'){break;}else if(!ws1){throw this.error('Expected ">"');}}
return attrs;},getAttribute:function(attrs){const key=this.getIdentifier();let index;if(this._source[this._index]==='['){++this._index;this.getWS();index=this.getItemList(this.getExpression,']');}
this.getWS();if(this._source[this._index]!==':'){throw this.error('Expected ":"');}
++this._index;this.getWS();const hasIndex=index!==undefined;const value=this.getValue(undefined,hasIndex);if(key in attrs){throw this.error('Duplicate attribute "'+key,'duplicateerror');}
if(!index&&typeof value==='string'){attrs[key]=value;}else{attrs[key]={value,index};}},getHash:function(index){const items=Object.create(null);++this._index;this.getWS();let defKey;while(true){const[key,value,def]=this.getHashItem();items[key]=value;if(def){if(defKey){throw this.error('Default item redefinition forbidden');}
defKey=key;}
this.getWS();const comma=this._source[this._index]===',';if(comma){++this._index;this.getWS();}
if(this._source[this._index]==='}'){++this._index;break;}
if(!comma){throw this.error('Expected "}"');}}
if(defKey){items.__default=defKey;}else if(!index){throw this.error('Unresolvable Hash Value');}
return items;},getHashItem:function(){let defItem=false;if(this._source[this._index]==='*'){++this._index;defItem=true;}
const key=this.getIdentifier();this.getWS();if(this._source[this._index]!==':'){throw this.error('Expected ":"');}
++this._index;this.getWS();return[key,this.getValue(),defItem];},getComment:function(){this._index+=2;const start=this._index;const end=this._source.indexOf('*/',start);if(end===-1){throw this.error('Comment without a closing tag');}
this._index=end+2;},getExpression:function(){let exp=this.getPrimaryExpression();while(true){let ch=this._source[this._index];if(ch==='.'||ch==='['){++this._index;exp=this.getPropertyExpression(exp,ch==='[');}else if(ch==='('){++this._index;exp=this.getCallExpression(exp);}else{break;}}
return exp;},getPropertyExpression:function(idref,computed){let exp;if(computed){this.getWS();exp=this.getExpression();this.getWS();if(this._source[this._index]!==']'){throw this.error('Expected "]"');}
++this._index;}else{exp=this.getIdentifier();}
return{type:'prop',expr:idref,prop:exp,cmpt:computed};},getCallExpression:function(callee){this.getWS();return{type:'call',expr:callee,args:this.getItemList(this.getExpression,')')};},getPrimaryExpression:function(){const ch=this._source[this._index];switch(ch){case'$':++this._index;return{type:'var',name:this.getIdentifier()};case'@':++this._index;return{type:'glob',name:this.getIdentifier()};default:return{type:'id',name:this.getIdentifier()};}},getItemList:function(callback,closeChar){const items=[];let closed=false;this.getWS();if(this._source[this._index]===closeChar){++this._index;closed=true;}
while(!closed){items.push(callback.call(this));this.getWS();let ch=this._source.charAt(this._index);switch(ch){case',':++this._index;this.getWS();break;case closeChar:++this._index;closed=true;break;default:throw this.error('Expected "," or "'+closeChar+'"');}}
return items;},getJunkEntry:function(){const pos=this._index;let nextEntity=this._source.indexOf('<',pos);let nextComment=this._source.indexOf('/*',pos);if(nextEntity===-1){nextEntity=this._length;}
if(nextComment===-1){nextComment=this._length;}
let nextEntry=Math.min(nextEntity,nextComment);this._index=nextEntry;},error:function(message,type='parsererror'){const pos=this._index;let start=this._source.lastIndexOf('<',pos-1);const lastClose=this._source.lastIndexOf('>',pos-1);start=lastClose>start?lastClose+1:start;const context=this._source.slice(start,pos+10);const msg=message+' at pos '+pos+': `'+context+'`';const err=new L10nError(msg);if(this.emit){this.emit(type,err);}
return err;}};function walkEntry(entry,fn){if(typeof entry==='string'){return fn(entry);}
const newEntry=Object.create(null);if(entry.value){newEntry.value=walkValue(entry.value,fn);}
if(entry.index){newEntry.index=entry.index;}
if(entry.attrs){newEntry.attrs=Object.create(null);for(let key in entry.attrs){newEntry.attrs[key]=walkEntry(entry.attrs[key],fn);}}
return newEntry;}
function walkValue(value,fn){if(typeof value==='string'){return fn(value);}
if(value.type){return value;}
const newValue=Array.isArray(value)?[]:Object.create(null);const keys=Object.keys(value);for(let i=0,key;key=keys[i];i++){newValue[key]=walkValue(value[key],fn);}
return newValue;}
function createGetter(id,name){let _pseudo=null;return function getPseudo(){if(_pseudo){return _pseudo;}
const reAlphas=/[a-zA-Z]/g;const reVowels=/[aeiouAEIOU]/g;const reWords=/[^\W0-9_]+/g;const reExcluded=/(%[EO]?\w|\{\s*.+?\s*\}|&[#\w]+;|<\s*.+?\s*>)/;const charMaps={'fr-x-psaccent':'ȦƁƇḒḖƑƓĦĪĴĶĿḾȠǾƤɊŘŞŦŬṼẆẊẎẐ[\\]^_`ȧƀƈḓḗƒɠħīĵķŀḿƞǿƥɋřşŧŭṽẇẋẏẑ','ar-x-psbidi':'∀ԐↃpƎɟפHIſӼ˥WNOԀÒᴚS⊥∩ɅMXʎZ[\\]ᵥ_,ɐqɔpǝɟƃɥıɾʞʅɯuodbɹsʇnʌʍxʎz'};const mods={'fr-x-psaccent':val=>val.replace(reVowels,match=>match+match.toLowerCase()),'ar-x-psbidi':val=>val.replace(reWords,match=>'‮'+match+'‬')};const replaceChars=(map,val)=>val.replace(reAlphas,match=>map.charAt(match.charCodeAt(0)-65));const transform=val=>replaceChars(charMaps[id],mods[id](val));const apply=(fn,val)=>{if(!val){return val;}
const parts=val.split(reExcluded);const modified=parts.map(function(part){if(reExcluded.test(part)){return part;}
return fn(part);});return modified.join('');};return _pseudo={name:transform(name),process:str=>apply(transform,str)};};}
const pseudo=Object.defineProperties(Object.create(null),{'fr-x-psaccent':{enumerable:true,get:createGetter('fr-x-psaccent','Runtime Accented')},'ar-x-psbidi':{enumerable:true,get:createGetter('ar-x-psbidi','Runtime Bidi')}});let Env=(function(){function Env(fetchResource){_classCallCheck(this,Env);this.fetchResource=fetchResource;this.resCache=new Map();this.resRefs=new Map();this.numberFormatters=null;this.parsers={properties:PropertiesParser,l20n:L20nParser};const listeners={};this.emit=emit.bind(this,listeners);this.addEventListener=addEventListener.bind(this,listeners);this.removeEventListener=removeEventListener.bind(this,listeners);}
_createClass(Env,[{key:'createContext',value:function createContext(langs,resIds){const ctx=new Context(this,langs,resIds);resIds.forEach(resId=>{const usedBy=this.resRefs.get(resId)||0;this.resRefs.set(resId,usedBy+1);});return ctx;}},{key:'destroyContext',value:function destroyContext(ctx){ctx.resIds.forEach(resId=>{const usedBy=this.resRefs.get(resId)||0;if(usedBy>1){return this.resRefs.set(resId,usedBy-1);}
this.resRefs.delete(resId);this.resCache.forEach((val,key)=>key.startsWith(resId)?this.resCache.delete(key):null);});}},{key:'_parse',value:function _parse(syntax,lang,data){const parser=this.parsers[syntax];if(!parser){return data;}
const emit=(type,err)=>this.emit(type,amendError(lang,err));return parser.parse.call(parser,emit,data);}},{key:'_create',value:function _create(lang,entries){if(lang.src!=='pseudo'){return entries;}
const pseudoentries=Object.create(null);for(let key in entries){pseudoentries[key]=walkEntry(entries[key],pseudo[lang.code].process);}
return pseudoentries;}},{key:'_getResource',value:function _getResource(lang,res){const cache=this.resCache;const id=res+lang.code+lang.src;if(cache.has(id)){return cache.get(id);}
const syntax=res.substr(res.lastIndexOf('.')+1);const saveEntries=data=>{const entries=this._parse(syntax,lang,data);cache.set(id,this._create(lang,entries));};const recover=err=>{err.lang=lang;this.emit('fetcherror',err);cache.set(id,err);};const langToFetch=lang.src==='pseudo'?{code:'en-US',src:'app',ver:lang.ver}:lang;const resource=this.fetchResource(res,langToFetch).then(saveEntries,recover);cache.set(id,resource);return resource;}}]);return Env;})();function amendError(lang,err){err.lang=lang;return err;}
function prioritizeLocales(def,availableLangs,requested){let supportedLocale;for(let i=0;i<requested.length;i++){const locale=requested[i];if(availableLangs.indexOf(locale)!==-1){supportedLocale=locale;break;}}
if(!supportedLocale||supportedLocale===def){return[def];}
return[supportedLocale,def];}
function negotiateLanguages({appVersion,defaultLang,availableLangs},additionalLangs,prevLangs,requestedLangs){const allAvailableLangs=Object.keys(availableLangs).concat(Object.keys(additionalLangs)).concat(Object.keys(pseudo));const newLangs=prioritizeLocales(defaultLang,allAvailableLangs,requestedLangs);const langs=newLangs.map(code=>({code:code,src:getLangSource(appVersion,availableLangs,additionalLangs,code),ver:appVersion}));return{langs,haveChanged:!arrEqual(prevLangs,newLangs)};}
function arrEqual(arr1,arr2){return arr1.length===arr2.length&&arr1.every((elem,i)=>elem===arr2[i]);}
function getMatchingLangpack(appVersion,langpacks){for(let i=0,langpack;langpack=langpacks[i];i++){if(langpack.target===appVersion){return langpack;}}
return null;}
function getLangSource(appVersion,availableLangs,additionalLangs,code){if(additionalLangs&&additionalLangs[code]){const lp=getMatchingLangpack(appVersion,additionalLangs[code]);if(lp&&(!(code in availableLangs)||parseInt(lp.revision)>availableLangs[code])){return'extra';}}
if(code in pseudo&&!(code in availableLangs)){return'pseudo';}
return'app';}
let Remote=(function(){function Remote(fetchResource,broadcast){_classCallCheck(this,Remote);this.broadcast=broadcast;this.env=new Env(fetchResource);this.ctxs=new Map();}
_createClass(Remote,[{key:'registerView',value:function registerView(view,resources,meta,additionalLangs,requestedLangs){const{langs}=negotiateLanguages(meta,additionalLangs,[],requestedLangs);this.ctxs.set(view,this.env.createContext(langs,resources));return langs;}},{key:'unregisterView',value:function unregisterView(view){this.ctxs.delete(view);return true;}},{key:'formatEntities',value:function formatEntities(view,keys){return this.ctxs.get(view).formatEntities(...keys);}},{key:'formatValues',value:function formatValues(view,keys){return this.ctxs.get(view).formatValues(...keys);}},{key:'changeLanguages',value:function changeLanguages(view,meta,additionalLangs,requestedLangs){const oldCtx=this.ctxs.get(view);const prevLangs=oldCtx.langs;const newLangs=negotiateLanguages(meta,additionalLangs,prevLangs,requestedLangs);this.ctxs.set(view,this.env.createContext(newLangs.langs,oldCtx.resIds));return newLangs;}},{key:'requestLanguages',value:function requestLanguages(requestedLangs){this.broadcast('languageschangerequest',requestedLangs);}},{key:'getName',value:function getName(code){return pseudo[code].name;}},{key:'processString',value:function processString(code,str){return pseudo[code].process(str);}}]);return Remote;})();const observerConfig={attributes:true,characterData:false,childList:true,subtree:true,attributeFilter:['data-l10n-id','data-l10n-args']};const observers=new WeakMap();function initMutationObserver(view){observers.set(view,{roots:new Set(),observer:new MutationObserver(mutations=>translateMutations(view,mutations))});}
function translateRoots(view){return Promise.all([...observers.get(view).roots].map(root=>_translateFragment(view,root)));}
function observe(view,root){const obs=observers.get(view);if(obs){obs.roots.add(root);obs.observer.observe(root,observerConfig);}}
function disconnect(view,root,allRoots){const obs=observers.get(view);if(obs){obs.observer.disconnect();if(allRoots){return;}
obs.roots.delete(root);obs.roots.forEach(other=>obs.observer.observe(other,observerConfig));}}
function reconnect(view){const obs=observers.get(view);if(obs){obs.roots.forEach(root=>obs.observer.observe(root,observerConfig));}}
const reOverlay=/<|&#?\w+;/;const allowed={elements:['a','em','strong','small','s','cite','q','dfn','abbr','data','time','code','var','samp','kbd','sub','sup','i','b','u','mark','ruby','rt','rp','bdi','bdo','span','br','wbr'],attributes:{global:['title','aria-label','aria-valuetext','aria-moz-hint'],a:['download'],area:['download','alt'],input:['alt','placeholder'],menuitem:['label'],menu:['label'],optgroup:['label'],option:['label'],track:['label'],img:['alt'],textarea:['placeholder'],th:['abbr']}};function overlayElement(element,translation){const value=translation.value;if(typeof value==='string'){if(!reOverlay.test(value)){element.textContent=value;}else{const tmpl=element.ownerDocument.createElement('template');tmpl.innerHTML=value;overlay(element,tmpl.content);}}
for(let key in translation.attrs){const attrName=camelCaseToDashed(key);if(isAttrAllowed({name:attrName},element)){element.setAttribute(attrName,translation.attrs[key]);}}}
function overlay(sourceElement,translationElement){const result=translationElement.ownerDocument.createDocumentFragment();let k,attr;let childElement;while(childElement=translationElement.childNodes[0]){translationElement.removeChild(childElement);if(childElement.nodeType===childElement.TEXT_NODE){result.appendChild(childElement);continue;}
const index=getIndexOfType(childElement);const sourceChild=getNthElementOfType(sourceElement,childElement,index);if(sourceChild){overlay(sourceChild,childElement);result.appendChild(sourceChild);continue;}
if(isElementAllowed(childElement)){const sanitizedChild=childElement.ownerDocument.createElement(childElement.nodeName);overlay(sanitizedChild,childElement);result.appendChild(sanitizedChild);continue;}
result.appendChild(translationElement.ownerDocument.createTextNode(childElement.textContent));}
sourceElement.textContent='';sourceElement.appendChild(result);if(translationElement.attributes){for(k=0,attr;attr=translationElement.attributes[k];k++){if(isAttrAllowed(attr,sourceElement)){sourceElement.setAttribute(attr.name,attr.value);}}}}
function isElementAllowed(element){return allowed.elements.indexOf(element.tagName.toLowerCase())!==-1;}
function isAttrAllowed(attr,element){const attrName=attr.name.toLowerCase();const tagName=element.tagName.toLowerCase();if(allowed.attributes.global.indexOf(attrName)!==-1){return true;}
if(!allowed.attributes[tagName]){return false;}
if(allowed.attributes[tagName].indexOf(attrName)!==-1){return true;}
if(tagName==='input'&&attrName==='value'){const type=element.type.toLowerCase();if(type==='submit'||type==='button'||type==='reset'){return true;}}
return false;}
function getNthElementOfType(context,element,index){let nthOfType=0;for(let i=0,child;child=context.children[i];i++){if(child.nodeType===child.ELEMENT_NODE&&child.tagName===element.tagName){if(nthOfType===index){return child;}
nthOfType++;}}
return null;}
function getIndexOfType(element){let index=0;let child;while(child=element.previousElementSibling){if(child.tagName===element.tagName){index++;}}
return index;}
function camelCaseToDashed(string){if(string==='ariaValueText'){return'aria-valuetext';}
return string.replace(/[A-Z]/g,function(match){return'-'+match.toLowerCase();}).replace(/^-/,'');}
const reHtml=/[&<>]/g;const htmlEntities={'&':'&amp;','<':'&lt;','>':'&gt;'};function setAttributes(element,id,args){element.setAttribute('data-l10n-id',id);if(args){element.setAttribute('data-l10n-args',JSON.stringify(args));}}
function getAttributes(element){return{id:element.getAttribute('data-l10n-id'),args:JSON.parse(element.getAttribute('data-l10n-args'))};}
function getTranslatables(element){const nodes=Array.from(element.querySelectorAll('[data-l10n-id]'));if(typeof element.hasAttribute==='function'&&element.hasAttribute('data-l10n-id')){nodes.push(element);}
return nodes;}
function translateMutations(view,mutations){const targets=new Set();for(let mutation of mutations){switch(mutation.type){case'attributes':targets.add(mutation.target);break;case'childList':for(let addedNode of mutation.addedNodes){if(addedNode.nodeType===addedNode.ELEMENT_NODE){if(addedNode.childElementCount){getTranslatables(addedNode).forEach(targets.add.bind(targets));}else{if(addedNode.hasAttribute('data-l10n-id')){targets.add(addedNode);}}}}
break;}}
if(targets.size===0){return;}
translateElements(view,Array.from(targets));}
function _translateFragment(view,frag){return translateElements(view,getTranslatables(frag));}
function getElementsTranslation(view,elems){const keys=elems.map(elem=>{const id=elem.getAttribute('data-l10n-id');const args=elem.getAttribute('data-l10n-args');return args?[id,JSON.parse(args.replace(reHtml,match=>htmlEntities[match]))]:id;});return view.formatEntities(...keys);}
function translateElements(view,elements){return getElementsTranslation(view,elements).then(translations=>applyTranslations(view,elements,translations));}
function applyTranslations(view,elems,translations){disconnect(view,null,true);for(let i=0;i<elems.length;i++){overlayElement(elems[i],translations[i]);}
reconnect(view);}
if(typeof NodeList==='function'&&!NodeList.prototype[Symbol.iterator]){NodeList.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator];}
function documentReady(){if(document.readyState!=='loading'){return Promise.resolve();}
return new Promise(resolve=>{document.addEventListener('readystatechange',function onrsc(){document.removeEventListener('readystatechange',onrsc);resolve();});});}
function getDirection(code){const tag=code.split('-')[0];return['ar','he','fa','ps','ur'].indexOf(tag)>=0?'rtl':'ltr';}
if(navigator.languages===undefined){navigator.languages=[navigator.language];}
function getResourceLinks(head){return Array.prototype.map.call(head.querySelectorAll('link[rel="localization"]'),el=>el.getAttribute('href'));}
function getMeta(head){let availableLangs=Object.create(null);let defaultLang=null;let appVersion=null;const metas=Array.from(head.querySelectorAll('meta[name="availableLanguages"],'+'meta[name="defaultLanguage"],'+'meta[name="appVersion"]'));for(let meta of metas){const name=meta.getAttribute('name');const content=meta.getAttribute('content').trim();switch(name){case'availableLanguages':availableLangs=getLangRevisionMap(availableLangs,content);break;case'defaultLanguage':const[lang,rev]=getLangRevisionTuple(content);defaultLang=lang;if(!(lang in availableLangs)){availableLangs[lang]=rev;}
break;case'appVersion':appVersion=content;}}
return{defaultLang,availableLangs,appVersion};}
function getLangRevisionMap(seq,str){return str.split(',').reduce((seq,cur)=>{const[lang,rev]=getLangRevisionTuple(cur);seq[lang]=rev;return seq;},seq);}
function getLangRevisionTuple(str){const[lang,rev]=str.trim().split(':');return[lang,parseInt(rev)];}
const viewProps=new WeakMap();let View=(function(){function View(client,doc){_classCallCheck(this,View);this.pseudo={'fr-x-psaccent':createPseudo(this,'fr-x-psaccent'),'ar-x-psbidi':createPseudo(this,'ar-x-psbidi')};const initialized=documentReady().then(()=>init(this,client));this._interactive=initialized.then(()=>client);this.ready=initialized.then(langs=>translateView(this,langs));initMutationObserver(this);viewProps.set(this,{doc:doc,ready:false});client.on('languageschangerequest',requestedLangs=>this.requestLanguages(requestedLangs));}
_createClass(View,[{key:'requestLanguages',value:function requestLanguages(requestedLangs,isGlobal){const method=isGlobal?client=>client.method('requestLanguages',requestedLangs):client=>changeLanguages(this,client,requestedLangs);return this._interactive.then(method);}},{key:'handleEvent',value:function handleEvent(){return this.requestLanguages(navigator.languages);}},{key:'formatEntities',value:function formatEntities(...keys){return this._interactive.then(client=>client.method('formatEntities',client.id,keys));}},{key:'formatValue',value:function formatValue(id,args){return this._interactive.then(client=>client.method('formatValues',client.id,[[id,args]])).then(values=>values[0]);}},{key:'formatValues',value:function formatValues(...keys){return this._interactive.then(client=>client.method('formatValues',client.id,keys));}},{key:'translateFragment',value:function translateFragment(frag){return _translateFragment(this,frag);}},{key:'observeRoot',value:function observeRoot(root){observe(this,root);}},{key:'disconnectRoot',value:function disconnectRoot(root){disconnect(this,root);}}]);return View;})();View.prototype.setAttributes=setAttributes;View.prototype.getAttributes=getAttributes;function createPseudo(view,code){return{getName:()=>view._interactive.then(client=>client.method('getName',code)),processString:str=>view._interactive.then(client=>client.method('processString',code,str))};}
function init(view,client){const doc=viewProps.get(view).doc;const resources=getResourceLinks(doc.head);const meta=getMeta(doc.head);view.observeRoot(doc.documentElement);return getAdditionalLanguages().then(additionalLangs=>client.method('registerView',client.id,resources,meta,additionalLangs,navigator.languages));}
function changeLanguages(view,client,requestedLangs){const doc=viewProps.get(view).doc;const meta=getMeta(doc.head);return getAdditionalLanguages().then(additionalLangs=>client.method('changeLanguages',client.id,meta,additionalLangs,requestedLangs)).then(({langs,haveChanged})=>haveChanged?translateView(view,langs):undefined);}
function getAdditionalLanguages(){if(navigator.mozApps&&navigator.mozApps.getAdditionalLanguages){return navigator.mozApps.getAdditionalLanguages().catch(()=>Object.create(null));}
return Promise.resolve(Object.create(null));}
function translateView(view,langs){const props=viewProps.get(view);const html=props.doc.documentElement;if(props.ready){return translateRoots(view).then(()=>setAllAndEmit(html,langs));}
const translated=langs[0].code===html.getAttribute('lang')?Promise.resolve():translateRoots(view).then(()=>setLangDir(html,langs));return translated.then(()=>{setLangs(html,langs);props.ready=true;});}
function setLangs(html,langs){const codes=langs.map(lang=>lang.code);html.setAttribute('langs',codes.join(' '));}
function setLangDir(html,langs){const code=langs[0].code;html.setAttribute('lang',code);html.setAttribute('dir',getDirection(code));}
function setAllAndEmit(html,langs){setLangDir(html,langs);setLangs(html,langs);html.parentNode.dispatchEvent(new CustomEvent('DOMRetranslated',{bubbles:false,cancelable:false}));}
const remote=new Remote(fetchResource,broadcast);const client=new Client(remote);document.l10n=new View(client,document);window.addEventListener('languagechange',document.l10n);document.addEventListener('additionallanguageschange',document.l10n);navigator.mozL10n={setAttributes:document.l10n.setAttributes,getAttributes:document.l10n.getAttributes,formatValue:(...args)=>document.l10n.formatValue(...args),translateFragment:(...args)=>document.l10n.translateFragment(...args),once:cb=>document.l10n.ready.then(cb),ready:cb=>document.l10n.ready.then(()=>{document.addEventListener('DOMRetranslated',cb);cb();})};})();

View file

@ -0,0 +1,53 @@
(function(exports){var BASE_TYPES=new Set(['text','url','email','password','number','option']);var SETTINGS_KEYS={ENABLED:'keyboard.enabled-layouts',DEFAULT:'keyboard.default-layouts'};var DEPRECATE_KEYBOARD_SETTINGS={en:'keyboard.layouts.english','en-Dvorak':'keyboard.layouts.dvorak',cs:'keyboard.layouts.czech',fr:'keyboard.layouts.french',de:'keyboard.layouts.german',hu:'keyboard.layouts.hungarian',nb:'keyboard.layouts.norwegian',my:'keyboard.layouts.myanmar',sl:'keyboard.layouts.slovak',tr:'keyboard.layouts.turkish',ro:'keyboard.layouts.romanian',ru:'keyboard.layouts.russian',ar:'keyboard.layouts.arabic',he:'keyboard.layouts.hebrew','zh-Hant-Zhuyin':'keyboard.layouts.zhuyin','zh-Hans-Pinyin':'keyboard.layouts.pinyin',el:'keyboard.layouts.greek','jp-kanji':'keyboard.layouts.japanese',pl:'keyboard.layouts.polish','pt-BR':'keyboard.layouts.portuguese',sr:'keyboard.layouts.serbian',es:'keyboard.layouts.spanish',ca:'keyboard.layouts.catalan'};var MULTI_LAYOUT_MAP={sr:['sr-Cyrl','sr-Latn']};var defaultKeyboardManifestURL='app://keyboard.gaiamobile.org/manifest.webapp';var currentSettings={defaultLayouts:{}};currentSettings.defaultLayouts[defaultKeyboardManifestURL]={en:true,number:true};currentSettings.enabledLayouts=map2dClone(currentSettings.defaultLayouts);function map2dIs(manifestURL,layoutId){return!!(this[manifestURL]&&this[manifestURL][layoutId]);}
function map2dSet(manifestURL,layoutId){if(!this[manifestURL]){this[manifestURL]={};}
this[manifestURL][layoutId]=true;}
function map2dUnset(manifestURL,layoutId){if(!this[manifestURL]){return;}
delete this[manifestURL][layoutId];if(!Object.keys(this[manifestURL]).length){delete this[manifestURL];}}
function map2dClone(obj){var result={};for(var key1 in obj){result[key1]={};for(var key2 in obj[key1]){result[key1][key2]=obj[key1][key2];}}
return result;}
var watchQueries=[];var defaultLayoutConfig;function kh_updateWatchers(reason){if(watchQueries.length){KeyboardHelper.getApps(function withApps(){watchQueries.forEach(function eachWatchQuery(watch){KeyboardHelper.getLayouts(watch.query,function withLayouts(layouts){watch.callback(layouts,reason);});});});}}
var waitingForSettings=[];var loadedSettings=new Set();function kh_loadedSetting(setting){loadedSettings.add(setting);if(loadedSettings.size>=Object.keys(SETTINGS_KEYS).length){waitingForSettings.forEach(function(callback){callback();});waitingForSettings=[];kh_updateWatchers({settings:true});}}
function kh_withSettings(callback){if(loadedSettings.size>=Object.keys(SETTINGS_KEYS).length){callback();}else{waitingForSettings.push(callback);}}
function kh_getSettings(){loadedSettings=new Set();var lock=window.navigator.mozSettings.createLock();lock.get(SETTINGS_KEYS.DEFAULT).onsuccess=kh_parseDefault;lock.get(SETTINGS_KEYS.ENABLED).onsuccess=kh_parseEnabled;}
function kh_parseDefault(){var value=this.result[SETTINGS_KEYS.DEFAULT];if(value){currentSettings.defaultLayouts=value;}
kh_loadedSetting(SETTINGS_KEYS.DEFAULT);}
function kh_parseEnabled(){var value=this.result[SETTINGS_KEYS.ENABLED];var needsSave=false;if(!value){currentSettings.enabledLayouts=map2dClone(currentSettings.defaultLayouts);needsSave=true;}else{var type=typeof value;if(type==='string'){try{currentSettings.enabledLayouts={};var oldSettings=JSON.parse(value);oldSettings.forEach(function(layout){if(layout.enabled){var manifestURL=layout.manifestURL;if(!manifestURL){manifestURL=layout.appOrigin+'/manifest.webapp';}
map2dSet.call(currentSettings.enabledLayouts,manifestURL,layout.layoutId);}});}catch(e){currentSettings.enabledLayouts=map2dClone(currentSettings.defaultLayouts);needsSave=true;}}else{currentSettings.enabledLayouts=value;}}
kh_loadedSetting(SETTINGS_KEYS.ENABLED);if(needsSave){KeyboardHelper.saveToSettings();}}
function kh_migrateDeprecatedSettings(deprecatedSettings){var settingEntry=DEPRECATE_KEYBOARD_SETTINGS.en;if(deprecatedSettings[settingEntry]===undefined){return;}
currentSettings.enabledLayouts[defaultKeyboardManifestURL]={number:true};var hasEnabledLayout=false;for(var key in DEPRECATE_KEYBOARD_SETTINGS){settingEntry=DEPRECATE_KEYBOARD_SETTINGS[key];if(deprecatedSettings[settingEntry]){hasEnabledLayout=true;if(key in MULTI_LAYOUT_MAP){MULTI_LAYOUT_MAP[key].forEach(function enableLayout(layoutId){map2dSet.call(currentSettings.enabledLayouts,defaultKeyboardManifestURL,layoutId);});}else{map2dSet.call(currentSettings.enabledLayouts,defaultKeyboardManifestURL,key);}}}
if(!hasEnabledLayout){map2dSet.call(currentSettings.enabledLayouts,defaultKeyboardManifestURL,'en');}
var deprecatedSettingsQuery={};for(key in DEPRECATE_KEYBOARD_SETTINGS){settingEntry=DEPRECATE_KEYBOARD_SETTINGS[key];deprecatedSettingsQuery[settingEntry]=null;}
window.navigator.mozSettings.createLock().set(deprecatedSettingsQuery);KeyboardHelper.saveToSettings();}
function kh_loadJSON(href,callback){if(!callback){return;}
var xhr=new XMLHttpRequest();xhr.onerror=function(){console.error('Failed to fetch file: '+href,xhr.statusText);};xhr.onload=function(){callback(xhr.response);};xhr.open('GET',href,true);xhr.responseType='json';xhr.send();}
function kh_getMultiSettings(settings,callback){var results={};try{var lock=navigator.mozSettings.createLock();}
catch(e){console.warn('Exception in mozSettings.createLock():',e,'\nUsing default values');for(var p in settings){results[p]=settings[p];}
callback(results);}
var settingNames=Object.keys(settings);var numSettings=settingNames.length;var numResults=0;for(var i=0;i<numSettings;i++){requestSetting(settingNames[i]);}
function requestSetting(name){var request;try{request=lock.get(name);}
catch(e){console.warn('Exception querying setting',name,':',e,'\nUsing default value');recordResult(name,settings[name]);return;}
request.onsuccess=function(){var value=request.result[name];if(value===undefined){value=settings[name];}
recordResult(name,value);};request.onerror=function(evt){console.warn('Error querying setting',name,':',evt.error);recordResult(name,settings[name]);};}
function recordResult(name,value){results[name]=value;numResults++;if(numResults===numSettings){callback(results);}}}
function KeyboardLayout(options){for(var key in options){this[key]=options[key];}}
Object.defineProperties(KeyboardLayout.prototype,{'default':{get:function kh_getLayoutIsDefault(){return map2dIs.call(currentSettings.defaultLayouts,this.app.manifestURL,this.layoutId);}},enabled:{get:function kh_getLayoutIsEnabled(){return map2dIs.call(currentSettings.enabledLayouts,this.app.manifestURL,this.layoutId);},set:function kh_setLayoutIsDefault(value){var method=value?map2dSet:map2dUnset;method.call(currentSettings.enabledLayouts,this.app.manifestURL,this.layoutId);}}});var kh_SettingsHelper={};Object.defineProperties(kh_SettingsHelper,{'default':{get:function(){return map2dClone(currentSettings.defaultLayouts);},set:function(value){currentSettings.defaultLayouts=map2dClone(value);},enumerable:true},'enabled':{get:function(){return map2dClone(currentSettings.enabledLayouts);},set:function(value){currentSettings.enabledLayouts=map2dClone(value);},enumerable:true}});var KeyboardHelper=exports.KeyboardHelper={settings:kh_SettingsHelper,fallbackLayoutNames:{password:'en'},fallbackLayouts:{},inputAppList:null,init:function kh_init(){watchQueries=[];this.inputAppList=new InputAppList();this.inputAppList.onupdate=kh_updateWatchers.bind(undefined,{apps:true});this.inputAppList.start();var settings=window.navigator.mozSettings;if(settings){kh_getSettings();settings.addObserver(SETTINGS_KEYS.ENABLED,kh_getSettings);settings.addObserver(SETTINGS_KEYS.DEFAULT,kh_getSettings);var deprecatedSettingsQuery={};for(var key in DEPRECATE_KEYBOARD_SETTINGS){var settingEntry=DEPRECATE_KEYBOARD_SETTINGS[key];deprecatedSettingsQuery[settingEntry]=undefined;}
kh_getMultiSettings(deprecatedSettingsQuery,kh_migrateDeprecatedSettings);}
window.addEventListener('applicationinstallsuccess',this);},handleEvent:function(event){kh_updateWatchers({apps:true});},isKeyboardType:function kh_isKeyboardType(type){return BASE_TYPES.has(type);},setLayoutEnabled:function kh_setLayoutEnabled(manifestURL,layoutId,enabled){var method=enabled?map2dSet:map2dUnset;method.call(currentSettings.enabledLayouts,manifestURL,layoutId);},getLayoutEnabled:function kh_getLayoutEnabled(manifestURL,layoutId){return map2dIs.call(currentSettings.enabledLayouts,manifestURL,layoutId);},setLayoutIsDefault:function kh_setLayoutIsDefault(manifestURL,layoutId,enabled){var method=enabled?map2dSet:map2dUnset;method.call(currentSettings.defaultLayouts,manifestURL,layoutId);},getLayoutIsDefault:function kh_getLayoutIsDefault(manifestURL,layoutId){return map2dIs.call(currentSettings.defaultLayouts,manifestURL,layoutId);},checkDefaults:function kh_checkDefaults(callback){var layoutsEnabled=[];var missingTypes=[];['text','url','number'].forEach(function eachType(type){var enabled;this.getLayouts({type:type,enabled:true},function(layouts){enabled=layouts.length;});if(!enabled){missingTypes.push(type);this.getLayouts({type:type,'default':true},function(layouts){if(layouts[0]){layouts[0].enabled=true;layoutsEnabled.push(layouts[0]);}});}},this);if(layoutsEnabled.length){if(callback){callback(layoutsEnabled,missingTypes);}}},saveToSettings:function ke_saveToSettings(){var toSet={};toSet[SETTINGS_KEYS.ENABLED]=currentSettings.enabledLayouts;toSet[SETTINGS_KEYS.DEFAULT]=currentSettings.defaultLayouts;window.navigator.mozSettings.createLock().set(toSet);},getApps:function kh_getApps(callback){var cleanupSettings=function(inputApps){Object.keys(currentSettings.enabledLayouts).concat(Object.keys(currentSettings.defaultLayouts)).forEach(function(manifestURL){if(!inputApps.some(function(inputApp){return(inputApp.domApp.manifestURL===manifestURL);})){delete currentSettings.enabledLayouts[manifestURL];delete currentSettings.defaultLayouts[manifestURL];}});};if(this.inputAppList.ready){var inputApps=this.inputAppList.getListSync();cleanupSettings(inputApps);callback(inputApps);return;}
this.inputAppList.getList().then(function(inputApps){cleanupSettings(inputApps);callback(inputApps);})['catch'](function(e){console.error(e);});},getLayouts:function kh_getLayouts(options,callback){if(typeof options==='function'){callback=options;options={};}
function withApps(inputApps){var fallbackLayoutNames={};for(var group in this.fallbackLayoutNames){fallbackLayoutNames[group]=this.fallbackLayoutNames[group];}
this.fallbackLayouts={};var layouts=inputApps.reduce(function eachApp(result,inputApp){var domApp=inputApp.domApp;var manifest=new ManifestHelper(domApp.manifest);var inputs=inputApp.getInputs();for(var layoutId in inputs){var inputManifest=inputs[layoutId];if(!inputManifest.types){console.warn(domApp.manifestURL,layoutId,'did not declare type.');continue;}
var layout=new KeyboardLayout({app:domApp,inputApp:inputApp,manifest:manifest,inputManifest:inputManifest,layoutId:layoutId});if(domApp.manifestURL===defaultKeyboardManifestURL){for(var group in fallbackLayoutNames){if(layoutId===fallbackLayoutNames[group]){this.fallbackLayouts[group]=layout;delete fallbackLayoutNames[group];}}}
if(options['default']&&!layout['default']){continue;}
if(options.enabled&&!layout.enabled){continue;}
if(options.type){options.type=[].concat(options.type);if(!options.type.some(function(type){return inputManifest.types.indexOf(type)!==-1;})){continue;}}
result.push(layout);}
if(options['default']){result.sort(function(a,b){return a.inputManifest.types.length-b.inputManifest.types.length;});}
return result;}.bind(this),[]);kh_withSettings(callback.bind(null,layouts));}
this.getApps(withApps.bind(this));},stopWatching:function(){watchQueries=[];},watchLayouts:function(query,callback){if(typeof query==='function'){callback=query;query={};}
var watch={query:query,callback:callback};watchQueries.push(watch);this.getLayouts(query,function initialCall(layouts){watch.layouts=layouts;callback(layouts,{apps:true,settings:true});});},getDefaultLayoutConfig:function kh_getDefaultLayoutConfig(callback){if(!callback){return;}
if(defaultLayoutConfig){callback(defaultLayoutConfig);}else{var KEYBOARDS='/shared/resources/keyboard_layouts.json';kh_loadJSON(KEYBOARDS,function loadKeyboardLayouts(data){if(data){defaultLayoutConfig=data;callback(defaultLayoutConfig);}});}},changeDefaultLayouts:function kh_changeDefaultLayouts(language,reset){this.getDefaultLayoutConfig(function gotDefaultLayouts(keyboards){var newKbLayouts=keyboards.layout[language];var kbManifestURL=defaultKeyboardManifestURL;currentSettings.defaultLayouts={};var langIndependentLayouts=keyboards.langIndependentLayouts;for(var i=langIndependentLayouts.length-1;i>=0;i--){this.setLayoutIsDefault(kbManifestURL,langIndependentLayouts[i].layoutId,true);}
if(reset){currentSettings.enabledLayouts=map2dClone(currentSettings.defaultLayouts);}
for(i=newKbLayouts.length-1;i>=0;i--){this.setLayoutIsDefault(kbManifestURL,newKbLayouts[i].layoutId,true);this.setLayoutEnabled(kbManifestURL,newKbLayouts[i].layoutId,true);}
this.saveToSettings();}.bind(this));}};KeyboardHelper.init();}(window));

View file

@ -0,0 +1,11 @@
(function(exports){var LOCALES_FILE='/shared/resources/languages.json';function readFile(file,callback){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest();xhr.onreadystatechange=function loadFile(){if(xhr.readyState===4){if(xhr.status===0||xhr.status===200){resolve(xhr.response);}else{reject(xhr.statusText);}}};xhr.open('GET',file,true);xhr.responseType='json';xhr.send();});}
function onError(name){console.error('Error checking setting '+name);}
function readSetting(name,callback){var settings=window.navigator.mozSettings;if(!settings||!settings.createLock){return callback(null);}
return settings.createLock().get(name).then(function(res){return res[name];},onError.bind(null,name));}
exports.LanguageList={_languages:null,_readFile:readFile,_readSetting:readSetting,_extendPseudo:function(languages,currentLang,pseudoEnabled){if(!pseudoEnabled){for(var code in languages){var isCurrent=(code===currentLang);if(code.indexOf('-x-ps')>-1&&!isCurrent){delete languages[code];}}}
if(!document.l10n){return Promise.resolve(languages);}
var runtimePseudoCodes=Object.keys(document.l10n.pseudo).filter(code=>!(code in languages)&&(code===currentLang||pseudoEnabled));function obj(arr1,arr2){const zipped=[];arr1.forEach(x=>{arr2.forEach(y=>{zipped.push([x,y]);});});return zipped.reduce((obj,[x,y])=>Object.assign(obj,{[x]:y}),{});}
return Promise.all(runtimePseudoCodes.map(code=>document.l10n.pseudo[code].getName())).then(names=>Object.assign(languages,obj(runtimePseudoCodes,names)));},_extendAdditional:function(languages,ver,additional){for(var lang in additional){for(var i=0,locale;locale=additional[lang][i];i++){if(locale.target===ver){languages[lang]=locale.name;break;}}}},_removeWithNoSpeech:function(languages,srEnabled){if(srEnabled){var speechLangs=new Set(window.speechSynthesis.getVoices().map(v=>v.lang.split('-')[0]));for(var langName in languages){if(!speechLangs.has(langName.split('-')[0])){delete languages[langName];}}}},_copyObj:function(obj){var copy=Object.create(null);for(var prop in obj){copy[prop]=obj[prop];}
return copy;},_parseVersion:function(ver){return ver.split('.').slice(0,2).join('.');},_build:function(){return Promise.all([this._languages||(this._languages=this._readFile(LOCALES_FILE)),this._readSetting('language.current'),this._readSetting('devtools.pseudolocalization.enabled')]).then(([langsFromFile,current,pseudoEnabled])=>{var langs=this._copyObj(langsFromFile);return Promise.all([this._extendPseudo(langs,current,pseudoEnabled),this._readSetting('langpack.channel'),current,this._readSetting('accessibility.screenreader'),navigator.mozApps.getAdditionalLanguages()]);}).then(([langs,ver,current,srEnabled,addl])=>{this._extendAdditional(langs,this._parseVersion(ver),addl);this._removeWithNoSpeech(langs,srEnabled);return[langs,current];});},get:function(callback){if(!callback){return;}
this._build().then(Function.prototype.apply.bind(callback,null));},wrapBidi:function(langCode,langName){var rtlList=['ar','he','fa','ps','ar-x-psbidi','ur'];var lEmbedBegin=(rtlList.indexOf(langCode)>=0)?'\u202b':'\u202a';var lEmbedEnd='\u202c';return lEmbedBegin+langName+lEmbedEnd;}};}(window));

View file

@ -0,0 +1,11 @@
;var LazyLoader=(function(){function LazyLoader(){this._loaded={};this._isLoading={};}
LazyLoader.prototype={_js:function(file,callback){var script=document.createElement('script');script.src=file;script.async=false;script.addEventListener('load',callback);document.head.appendChild(script);this._isLoading[file]=script;},_css:function(file,callback){var style=document.createElement('link');style.type='text/css';style.rel='stylesheet';style.href=file;document.head.appendChild(style);callback();},_html:function(domNode,callback){if(domNode.getAttribute('is')){this.load(['/shared/js/html_imports.js'],function(){HtmlImports.populate(callback);}.bind(this));return;}
for(var i=0;i<domNode.childNodes.length;i++){if(domNode.childNodes[i].nodeType==document.COMMENT_NODE){domNode.innerHTML=domNode.childNodes[i].nodeValue;break;}}
window.dispatchEvent(new CustomEvent('lazyload',{detail:domNode}));callback();},getJSON:function(file,mozSystem){return new Promise(function(resolve,reject){var xhr;if(mozSystem){xhr=new XMLHttpRequest({mozSystem:true});}else{xhr=new XMLHttpRequest();}
xhr.open('GET',file,true);xhr.responseType='json';xhr.onerror=function(error){reject(error);};xhr.onload=function(){if(xhr.response!==null){resolve(xhr.response);}else{reject(new Error('No valid JSON object was found ('+
xhr.status+' '+xhr.statusText+')'));}};xhr.send();});},load:function(files,callback){var deferred={};deferred.promise=new Promise(resolve=>{deferred.resolve=resolve;});if(!Array.isArray(files)){files=[files];}
var loadsRemaining=files.length,self=this;function perFileCallback(file){if(self._isLoading[file]){delete self._isLoading[file];}
self._loaded[file]=true;if(--loadsRemaining===0){deferred.resolve();if(callback){callback();}}}
for(var i=0;i<files.length;i++){var file=files[i];if(this._loaded[file.id||file]){perFileCallback(file);}else if(this._isLoading[file]){this._isLoading[file].addEventListener('load',perFileCallback.bind(null,file));}else{var method,idx;if(typeof file==='string'){method=file.match(/\.([^.]+)$/)[1];idx=file;}else{method='html';idx=file.id;}
this['_'+method](file,perFileCallback.bind(null,idx));}}
return deferred.promise;}};return new LazyLoader();}());

View file

@ -0,0 +1,6 @@
(function(exports){'use strict';function ManifestHelper_get(prop){var manifest=this;var value=manifest[prop];var lang=document.documentElement.lang||'';if(manifest.locales){[lang,lang.substr(0,lang.indexOf('-'))].some(function tryLanguage(lang){if(this[lang]&&this[lang][prop]){value=this[lang][prop];return true;}},manifest.locales);}
if(typeof value==='object'&&!(value instanceof Array)){value=new ManifestHelper(value);}
return value;}
function ManifestHelper(manifest){for(var prop in manifest){Object.defineProperty(this,prop,{get:ManifestHelper_get.bind(manifest,prop),enumerable:true});}}
Object.defineProperty(ManifestHelper.prototype,'displayName',{get:function displayName(){return this.short_name||this.name;}});exports.ManifestHelper=ManifestHelper;}(window));

View file

@ -0,0 +1,3 @@
var MimeMapper={_typeToExtensionMap:{'image/jpeg':'jpg','image/png':'png','image/gif':'gif','image/bmp':'bmp','audio/mpeg':'mp3','audio/mp4':'m4a','audio/ogg':'ogg','audio/webm':'webm','audio/3gpp':'3gp','audio/amr':'amr','video/mp4':'mp4','video/mpeg':'mpg','video/ogg':'ogg','video/webm':'webm','video/3gpp':'3gp','video/3gpp2':'3g2','application/pdf':'pdf','application/vcard':'vcf','text/vcard':'vcf','text/x-vcard':'vcf'},_extensionToTypeMap:{'jpg':'image/jpeg','jpeg':'image/jpeg','jpe':'image/jpeg','png':'image/png','gif':'image/gif','bmp':'image/bmp','mp3':'audio/mpeg','m4a':'audio/mp4','m4b':'audio/mp4','m4p':'audio/mp4','m4r':'audio/mp4','aac':'audio/aac','opus':'audio/ogg','amr':'audio/amr','mp4':'video/mp4','mpeg':'video/mpeg','mpg':'video/mpeg','ogv':'video/ogg','ogx':'video/ogg','webm':'video/webm','3gp':'video/3gpp','3g2':'video/3gpp2','ogg':'video/ogg','pdf':'application/pdf','vcf':'text/vcard'},_parseExtension:function(filename){var array=filename.split('.');return array.length>1?array.pop():'';},isSupportedType:function(mimetype){return(mimetype in this._typeToExtensionMap);},isSupportedExtension:function(extension){return(extension in this._extensionToTypeMap);},isFilenameMatchesType:function(filename,mimetype){var extension=this._parseExtension(filename);var guessedType=this.guessTypeFromExtension(extension);return(guessedType==mimetype);},guessExtensionFromType:function(mimetype){return this._typeToExtensionMap[mimetype];},guessTypeFromExtension:function(extension){return this._extensionToTypeMap[extension];},guessTypeFromFileProperties:function(filename,mimetype){var extension=this._parseExtension(filename);var type=this.isSupportedType(mimetype)?mimetype:this.guessTypeFromExtension(extension);return type||'';},ensureFilenameMatchesType:function(filename,mimetype){if(!this.isFilenameMatchesType(filename,mimetype)){var guessedExt=this.guessExtensionFromType(mimetype);if(guessedExt){filename+='.'+guessedExt;}}
return filename;}};

View file

@ -0,0 +1,4 @@
var MobileInfo={brazil:{carriers:{'00':'NEXTEL','02':'TIM','03':'TIM','04':'TIM','05':'CLARO','06':'VIVO','07':'CTBC','08':'TIM','10':'VIVO','11':'VIVO','15':'SERCOMTEL','16':'OI','23':'VIVO','24':'OI','31':'OI','32':'CTBC','33':'CTBC','34':'CTBC','37':'AEIOU'},regions:{'11':'SP','12':'SP','13':'SP','14':'SP','15':'SP','16':'SP','17':'SP','18':'SP','19':'SP','21':'RJ','22':'RJ','24':'RJ','27':'ES','28':'ES','31':'MG','32':'MG','33':'MG','34':'MG','35':'MG','37':'MG','38':'MG','41':'PR','42':'PR','43':'PR','44':'PR','45':'PR','46':'PR','47':'SC','48':'SC','49':'SC','51':'RS','53':'RS','54':'RS','55':'RS','61':'DF','62':'GO','63':'TO','64':'GO','65':'MT','66':'MT','67':'MS','68':'AC','69':'RO','71':'BA','73':'BA','74':'BA','75':'BA','77':'BA','79':'SE','81':'PE','82':'AL','83':'PB','84':'RN','85':'CE','86':'PI','87':'PE','88':'CE','89':'PI','91':'PA','92':'AM','93':'PA','94':'PA','95':'RR','96':'AP','97':'AM','98':'MA','99':'MA'}}};var MobileOperator={BRAZIL_MCC:'724',BRAZIL_CELLBROADCAST_CHANNEL:50,userFacingInfo:function mo_userFacingInfo(mobileConnection){var network=mobileConnection.voice.network;var iccid=mobileConnection.iccId;var iccObj=navigator.mozIccManager.getIccById(iccid);var iccInfo=iccObj?iccObj.iccInfo:null;var operator=network?(network.shortName||network.longName):null;if(operator&&iccInfo&&iccInfo.isDisplaySpnRequired&&iccInfo.spn){if(iccInfo.isDisplayNetworkNameRequired&&operator!==iccInfo.spn){operator=operator+' '+iccInfo.spn;}else{operator=iccInfo.spn;}}
var carrier,region;if(this.isBrazil(mobileConnection)){var lac=mobileConnection.voice.cell.gsmLocationAreaCode%100;var carriers=MobileInfo.brazil.carriers;var regions=MobileInfo.brazil.regions;carrier=carriers[network.mnc]||(this.BRAZIL_MCC+network.mnc);region=(regions[lac]?regions[lac]+' '+lac:'');}
return{'operator':operator,'carrier':carrier,'region':region};},isBrazil:function mo_isBrazil(mobileConnection){var cell=mobileConnection.voice.cell;var net=mobileConnection.voice.network;return net?(net.mcc===this.BRAZIL_MCC&&cell&&cell.gsmLocationAreaCode):null;}};

View file

@ -0,0 +1,35 @@
;(function(global){'use strict';global.mozIntl={formatList:function(list){return navigator.mozL10n.formatValue('listSeparator_middle').then(sep=>list.join(sep));},DateTimeFormat:function(locales,options){const resolvedOptions=Object.assign({},options);if(resolvedOptions.dayperiod){if(resolvedOptions.hour===undefined){resolvedOptions.hour='numeric';}}
if(resolvedOptions.hour!==undefined&&resolvedOptions.hour12===undefined){resolvedOptions.hour12=navigator.mozHour12;}
if(resolvedOptions.dayperiod===undefined&&resolvedOptions.hour12===true){resolvedOptions.dayperiod=true;}
var intlFormat=new Intl.DateTimeFormat(locales,resolvedOptions);resolvedOptions.locale=intlFormat.resolvedOptions().locale;resolvedOptions.hour12=intlFormat.resolvedOptions().hour12;var hourFormatter;if(resolvedOptions.dayperiod!==undefined&&resolvedOptions.hour12===true){hourFormatter=Intl.DateTimeFormat(locales,{hour:'numeric',hour12:false});}
return{resolvedOptions(){return resolvedOptions;},format:function(date,tokenFormats){var dayPeriod;var string=intlFormat.format(date);if(resolvedOptions.dayperiod===false&&resolvedOptions.hour12===true){dayPeriod=getDayPeriodTokenForDate(date,hourFormatter);string=string.replace(dayPeriod,'').trim();}else if(resolvedOptions.dayperiod===true&&options.hour===undefined){dayPeriod=getDayPeriodTokenForDate(date,hourFormatter);const hour=date.toLocaleString(navigator.languages,{hour12:true,hour:'numeric'}).replace(dayPeriod,'').trim();string=string.replace(hour,'').trim();}
for(var token in tokenFormats){if(token==='dayperiod'&&resolvedOptions.hour12===false){continue;}
const localOptions={[token]:resolvedOptions[token],};var formatter=global.mozIntl.DateTimeFormat(navigator.languages,localOptions);var tokenString=formatter.format(date);string=string.replace(tokenString,tokenFormats[token]);}
return string;},};},calendarInfo:function(token){switch(token){case'firstDayOfTheWeek':return navigator.mozL10n.formatValue('firstDayOfTheWeek').then(firstDayOfTheWeek=>parseInt(firstDayOfTheWeek)%7);default:throw new Error('Unknown token: '+token);}},DurationFormat:function(locales=navigator.languages,options={}){const resolvedOptions=Object.assign({locale:locales[0],maxUnit:'hour',minUnit:'second',},options);const numFormatter=Intl.NumberFormat(locales,{style:'decimal',useGrouping:false,minimumIntegerDigits:2});const maxUnitIdx=getDurationUnitIdx(resolvedOptions.maxUnit,0);const minUnitIdx=getDurationUnitIdx(resolvedOptions.minUnit,durationFormatOrder.length-1);return navigator.mozL10n.formatValue('durationPattern').then(fmt=>({resolvedOptions:function(){return resolvedOptions;},format:function(input){const minValue=durationFormatElements[resolvedOptions.minUnit].value;input=Math.round(input/minValue)*minValue;const duration=splitIntoTimeUnits(input,maxUnitIdx,minUnitIdx);var string=trimDurationPattern(fmt,resolvedOptions.maxUnit,resolvedOptions.minUnit);for(var unit in duration){const token=durationFormatElements[unit].token;string=string.replace(token,numFormatter.format(duration[unit]));}
if(input<0){return'-'+string;}
return string;}}));},RelativeTimeFormat:function(locales,options){return{resolvedOptions:function(){return options;},format:function(x){const{unit,value}=relativeTimeFormatId(x,options);return navigator.mozL10n.formatValue(unit,{value});},};},UnitFormat:function(locales,options){const unitGroup=getUnitFormatGroupName(options.unit);if(unitGroup===undefined){throw new RangeError(`invalid value ${options.unit} for option unit`);}
if(!unitFormatGroups[unitGroup].styles.includes(options.style)){throw new RangeError(`invalid value ${options.style} for option style`);}
const unit=`${unitGroup}-${options.unit}-${options.style}`;return{format:function(x){return document.l10n.formatValue(unit,{value:x});},};},_gaia:{relativePart:function(milliseconds){const units=computeTimeUnits(milliseconds);const unit=getBestMatchUnit(units);return{unit:unit+'s',value:Math.abs(units[unit])};},RelativeDate:function(locales,options){const style=options&&options.style||'long';const maxFormatter=Intl.DateTimeFormat(locales,{year:'numeric',month:'numeric',day:'numeric'});const relativeFmtOptions={unit:'bestFit',style:style,minUnit:'minute',};return{format:function(time,maxDiff){maxDiff=maxDiff||86400*10;const secDiff=(Date.now()-time)/1000;if(isNaN(secDiff)){return navigator.mozL10n.formatValue('incorrectDate');}
if(secDiff>maxDiff){return Promise.resolve(maxFormatter.format(time));}
const{unit,value}=relativeTimeFormatId(time,relativeFmtOptions);return navigator.mozL10n.formatValue(unit,{value});},formatElement:function(element,time,maxDiff){maxDiff=maxDiff||86400*10;const secDiff=(Date.now()-time)/1000;if(isNaN(secDiff)){element.setAttribute('data-l10n-id','incorrectDate');}
element.removeAttribute('data-l10n-id');if(secDiff>maxDiff){element.textContent=maxFormatter.format(time);}
const{unit,value}=relativeTimeFormatId(time,relativeFmtOptions);navigator.mozL10n.setAttributes(element,unit,{value});},};},getFormattedUnit:function(type,style,v){if(!unitFormatData.hasOwnProperty(type)){throw new RangeError(`invalid type ${type}`);}
if(!unitFormatGroups[type].styles.includes(style)){throw new RangeError(`invalid style ${style} for type ${type}`);}
var units=unitFormatData[type];var scale=0;for(let i=1;i<units.length;i++){if(v<units[i].value*unitFormatGroups[type].rounding){scale=i-1;break;}else if(i===units.length-1){scale=i;}}
var value=Math.round(v/units[scale].value*100)/100;return global.mozIntl.UnitFormat(navigator.languages,{unit:units[scale].name,style:style}).format(value);},}};const durationFormatOrder=['hour','minute','second','millisecond'];const durationFormatElements={'hour':{value:3600000,token:'hh'},'minute':{value:60000,token:'mm'},'second':{value:1000,token:'ss'},'millisecond':{value:10,token:'SS'}};const unitFormatData={'duration':[{'name':'second','value':1},{'name':'minute','value':60},{'name':'hour','value':60*60},{'name':'day','value':24*60*60},{'name':'month','value':30*24*60*60},],'digital':[{'name':'byte','value':1},{'name':'kilobyte','value':1024},{'name':'megabyte','value':1024*1024},{'name':'gigabyte','value':1024*1024*1024},{'name':'terabyte','value':1024*1024*1024*1024},],};const unitFormatGroups={'duration':{'units':['second','minute','hour','day','month'],'styles':['narrow'],'rounding':1},'digital':{'units':['byte','kilobyte','megabyte','gigabyte','terabyte'],'styles':['short'],'rounding':0.8}};function getDurationUnitIdx(name,defaultValue){if(!name){return defaultValue;}
const pos=durationFormatOrder.indexOf(name);if(pos===-1){throw new Error('Unknown unit type: '+name);}
return pos;}
function splitIntoTimeUnits(v,maxUnitIdx,minUnitIdx){const units={};var input=Math.abs(v);for(var i=maxUnitIdx;i<=minUnitIdx;i++){const key=durationFormatOrder[i];const{value}=durationFormatElements[key];units[key]=i==minUnitIdx?Math.round(input/value):Math.floor(input/value);input-=units[key]*value;}
return units;}
function trimDurationPattern(string,maxUnit,minUnit){const maxToken=durationFormatElements[maxUnit].token;const minToken=durationFormatElements[minUnit].token;string=string.substring(string.indexOf(maxToken),string.indexOf(minToken)+minToken.length);return string;}
function getDayPeriodTokenForDate(date,hourFormatter){const hourToken=hourFormatter.format(date);const newDate=new Date(date);newDate.setHours(parseInt(hourToken));return new Intl.DateTimeFormat(navigator.language, {hour:'numeric', hour12:true}).formatToParts(newDate).find(part => part.type === 'dayPeriod').value;}
function computeTimeUnits(v){const units={};const millisecond=Math.round(v);const second=Math.round(millisecond/1000);const minute=Math.round(second/60);const hour=Math.round(minute/60);const day=Math.round(hour/24);const rawYear=day*400/146097;units.millisecond=millisecond;units.second=second;units.minute=minute;units.hour=hour;units.day=day;units.week=Math.round(day/7);units.month=Math.round(rawYear*12);units.quarter=Math.round(rawYear*4);units.year=Math.round(rawYear);return units;}
function getBestMatchUnit(units){if(Math.abs(units.minute)<45){return'minute';}
if(Math.abs(units.hour)<22){return'hour';}
if(Math.abs(units.day)<7){return'day';}
if(Math.abs(units.week)<4){return'week';}
if(Math.abs(units.month)<11){return'month';}
return'year';}
function relativeTimeFormatId(x,options){const ms=x-Date.now();const units=computeTimeUnits(ms);const unit=options.unit==='bestFit'?getBestMatchUnit(units):options.unit;const v=units[unit];const tl=v<0?'-ago':'-until';const style=options.style||'long';const entry=unit+'s'+tl+'-'+style;return{unit:entry,value:Math.abs(v)};}
function getUnitFormatGroupName(unitName){for(let groupName in unitFormatGroups){if(unitFormatGroups[groupName].units.includes(unitName)){return groupName;}}
return undefined;}})(this);

View file

@ -0,0 +1,29 @@
(function(exports){if(exports.ForwardLock){return;}
const mimeSubtype='vnd.mozilla.oma.drm.fl';const SECRET_SETTINGS_ID='oma.drm.forward_lock.secret.key';var secret=null;function xor(buffer,key){var words=new Uint32Array(buffer,0,buffer.byteLength>>2);for(var i=0,n=words.length;i<n;i++){words[i]^=key;}}
function lockBuffer(secret,content,type,metadata){var header='LOCKED 1 '+escape(type)+'\n';if(metadata){for(var p in metadata){header+=escape(p)+':'+escape(metadata[p])+'\n';}}
header+='\0';var buffer=new Uint8Array(new Uint8Array(content)).buffer;xor(buffer,secret);return new Blob([header,buffer],{type:type.split('/')[0]+'/'+mimeSubtype});}
function lockBlob(secret,blob,metadata,callback){var reader=new FileReader();reader.readAsArrayBuffer(blob);reader.onload=function(){callback(lockBuffer(secret,reader.result,blob.type,metadata));};}
function unlockBlob(secret,blob,callback,errorCallback){if(!secret){return error('no secret supplied');}
var reader=new FileReader();reader.readAsArrayBuffer(blob);reader.onload=function(){var buffer=reader.result;var bytes=new Uint8Array(buffer);var header='';var contentStart;for(var i=0;i<bytes.length;i++){if(bytes[i]===0){contentStart=i+1;break;}
header+=String.fromCharCode(bytes[i]);}
if(!header.startsWith('LOCKED')){return error('Bad magic number');}
if(header.substring(6,9)!==' 1 '){return error('Unsupported version number');}
if(!contentStart){return error('No content');}
var eol=header.indexOf('\n');if(eol===-1){return error('malformed header');}
var type=unescape(header.substring(9,eol).trim());var metadata={};var lines=header.substring(eol+1).split('\n');for(var j=0;j<lines.length;j++){var line=lines[j];if(!line){continue;}
var[key,value]=line.split(':');if(!key||!value){return error('malformed metadata');}
metadata[unescape(key)]=unescape(value);}
var content=buffer.slice(contentStart);xor(content,secret);var blob=new Blob([content],{type:type});try{callback(blob,metadata);}
catch(e){console.error('Exception in content callback',e);}};function error(msg){msg='LCKA.decrypt(): '+msg;if(errorCallback){try{errorCallback(msg);}
catch(e){console.error('Exception in error callback',e);}}
else{console.error(msg);}}}
function getKey(callback){try{if(secret!==null){report(secret);return;}
var lock=navigator.mozSettings.createLock();var getreq=lock.get(SECRET_SETTINGS_ID);getreq.onsuccess=function(){secret=getreq.result[SECRET_SETTINGS_ID]||null;report(secret);};getreq.onerror=function(){console.error('Error getting ForwardLock setting',getreq.error);report(null);};}
catch(e){console.error('Exception in ForwardLock.getKey():',e);report(null);}
function report(secret){if(callback){try{callback(secret);}
catch(e){console.error('Exception in ForwardLock.getKey() callback',e);}}}}
function getOrCreateKey(callback){getKey(function(key){if(key!==null){report(key);return;}
secret=((Math.random()*0xFFFFFFFF)|0)+1;var setting={};setting[SECRET_SETTINGS_ID]=secret;var setreq=navigator.mozSettings.createLock().set(setting);setreq.onsuccess=function(){report(secret);};setreq.onerror=function(){console.error('Failed to set key in ForwardLock.getOrCreateKey()',setreq.error.name);secret=null;};});function report(secret){if(callback){try{callback(secret);}
catch(e){console.error('Exception in ForwardLock.getOrCreateKey() callback');}}}}
exports.ForwardLock={lockBuffer:lockBuffer,lockBlob:lockBlob,unlockBlob:unlockBlob,mimeSubtype:mimeSubtype,getKey:getKey,getOrCreateKey:getOrCreateKey};}(window));

View file

@ -0,0 +1,14 @@
(function(exports){'use strict';const SET_DIGEST_VALUE='lockscreen.passcode-lock.digest.value';const SET_DIGEST_SALT='lockscreen.passcode-lock.digest.salt';const SET_DIGEST_ITERATIONS='lockscreen.passcode-lock.digest.iterations';const SET_DIGEST_ALGORITHM='lockscreen.passcode-lock.digest.algorithm';const DEFAULT_ALGORITHM='SHA-1';const DEFAULT_ITERATIONS=1000;const PBKDF2_OUTPUT_LENGTH=160;function _encode(str){return new TextEncoder('utf-8').encode(str);}
function _toTypedArray(obj){var a=[];for(var key of Object.keys(obj)){a.push(obj[key]);}
return new Uint8Array(a);}
function _deriveBits(pwKey,salt,iterations,algorithm){var params={name:'PBKDF2',hash:algorithm,salt:salt,iterations:iterations};return crypto.subtle.deriveBits(params,pwKey,PBKDF2_OUTPUT_LENGTH);}
function _makeDigest(pass,salt,iterations,algorithm){var bytes=_encode(pass);var promise=crypto.subtle.importKey('raw',bytes,'PBKDF2',false,['deriveBits']);promise=promise.then((pwKey)=>{return _deriveBits(pwKey,salt,iterations,algorithm);});promise=promise.catch((error)=>{console.error('PasscodeHelper: _derive_bits() failed!',error);throw error;});return promise;}
function setPasscode(newPass){var salt=crypto.getRandomValues(new Uint8Array(8));var promise=_makeDigest(newPass,salt,DEFAULT_ITERATIONS,DEFAULT_ALGORITHM);promise=promise.then((digest)=>{return _storeNewPasscode(digest,salt);});promise=promise.catch((error)=>{console.error('PasscodeHelper: Could not make digest:',error);throw error;});return promise;}
function _storeNewPasscode(digest,salt){var digestUint8=new Uint8Array(digest);var newSettings={[SET_DIGEST_SALT]:salt,[SET_DIGEST_VALUE]:digestUint8,[SET_DIGEST_ITERATIONS]:DEFAULT_ITERATIONS,[SET_DIGEST_ALGORITHM]:DEFAULT_ALGORITHM,};var lock=navigator.mozSettings.createLock();var req=lock.set(newSettings);return req.then(()=>{return digestUint8;},(error)=>{console.error('PasscodeHelper: Couldnt store new digest',error);throw error;});}
function checkPasscode(testPass){var lock=navigator.mozSettings.createLock();var storedParams=Promise.all([lock.get(SET_DIGEST_SALT),lock.get(SET_DIGEST_ITERATIONS),lock.get(SET_DIGEST_ALGORITHM),lock.get(SET_DIGEST_VALUE)]);return storedParams.then((values)=>{return _makeAndCompare(...values,testPass);}).catch((error)=>{console.error('PasscodeHelper: Couldnt get digest Settings:',error);throw error;});}
function _makeAndCompare(salt,iterations,algorithm,storedDigest,testPass){var _salt=_toTypedArray(salt[SET_DIGEST_SALT]);var _iterations=iterations[SET_DIGEST_ITERATIONS];var _algorithm=algorithm[SET_DIGEST_ALGORITHM];var _storedDigest=_toTypedArray(storedDigest[SET_DIGEST_VALUE]);var promise=_makeDigest(testPass,_salt,_iterations,_algorithm);promise=promise.then((digest)=>{var typedDigest=new Uint8Array(digest);return _compareDigests(_storedDigest,typedDigest);});promise=promise.catch((error)=>{console.error('PasscodeHelper: Couldnt create digest',error);throw error;});return promise;}
function _compareDigests(buf1,buf2){if(buf1.byteLength!==buf2.byteLength){return false;}
for(var i=0;i<buf1.byteLength;i++){if(buf1[i]!==buf2[i]){return false;}}
return true;}
exports.PasscodeHelper={set:setPasscode,check:checkPasscode};})(this);

View file

@ -0,0 +1,3 @@
(function(root,factory){'use strict';if(typeof define==='function'&&define.amd){define(factory);}else if(typeof exports==='object'){module.exports=factory();}else{root.Sanitizer=factory();}}(this,function(){'use strict';var Sanitizer={_entity:/[&<>"'/]/g,_entities:{'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;','\'':'&apos;','/':'&#x2F;'},getEntity:function(s){return Sanitizer._entities[s];},escapeHTML:function(strings,...values){var result='';for(var i=0;i<strings.length;i++){result+=strings[i];if(i<values.length){result+=String(values[i]).replace(Sanitizer._entity,Sanitizer.getEntity);}}
return result;},createSafeHTML:function(strings,...values){var escaped=Sanitizer.escapeHTML(strings,...values);return{__html:escaped,toString:function(){return'[object WrappedHTMLObject]';},info:'This is a wrapped HTML object. See https://developer.mozilla.or'+'g/en-US/Firefox_OS/Security/Security_Automation for more.'};},unwrapSafeHTML:function(...htmlObjects){var markupList=htmlObjects.map(function(obj){return obj.__html;});return markupList.join('');}};return Sanitizer;}));

View file

@ -0,0 +1 @@
{"search_providers":{"yahoo":{"title":"Yahoo","search":{"url":"https://search.yahoo.com/yhs/search","params":{"p":"{searchTerms}"}},"suggest":{"url":"https://search.yahoo.com/sugg/ff","params":{"command":"{searchTerms}","output":"fxjson"}}},"ddg":{"title":"DuckDuckGo","search":{"url":"https://duckduckgo.com/","params":{"t":"ffos","q":"{searchTerms}"}},"suggest":{"url":"https://ac.duckduckgo.com/ac/","params":{"q":"{searchTerms}","type":"list"}}},"google":{"title":"Google","search":{"url":"https://www.google.com/search","params":{"q":"{searchTerms}"}},"suggest":{"url":"https://www.google.com/complete/search","params":{"q":"{searchTerms}","client":"firefox"}}},"bing":{"title":"Bing","search":{"url":"https://www.bing.com/search","params":{"q":"{searchTerms}"}},"suggest":{"url":"https://www.bing.com/osjson.aspx","params":{"query":"{searchTerms}"}}}},"simConfigs":{"310-000":{"en-US":{"defaultEngine":"yahoo"}},"311-000":{"en-US":{"defaultEngine":"yahoo"}},"312-000":{"en-US":{"defaultEngine":"yahoo"}},"313-000":{"en-US":{"defaultEngine":"yahoo"}},"316-000":{"en-US":{"defaultEngine":"yahoo"}}},"partnerConfig":{},"defaultEngines":{"defaultEngine":"google","providers":{"yahoo":{},"google":{},"bing":{},"ddg":{}}},"locales":{}}

View file

@ -0,0 +1,4 @@
(function(exports){'use strict';var SettingsHelper=function(key,defaultValue){var SETTINGS_KEY=key;var _settings=navigator.mozSettings;var _value=null;var _defaultValue=defaultValue;var _isReady=false;var _callbacks=[];var _return=function sh_return(callback){if(!callback){return;}
callback.apply(null,Array.prototype.slice.call(arguments,1));};var _ready=function sh_ready(callback){if(!callback){return;}
if(_isReady){callback();}else{_callbacks.push(callback);}};var _getValue=function sh_getValue(callback){var req=_settings.createLock().get(SETTINGS_KEY);req.onsuccess=function(){_return(callback,req.result[SETTINGS_KEY]);};req.onerror=function(){console.error('Error getting '+SETTINGS_KEY+'.');_return(callback,null);};};var _setValue=function sh_setValue(value,callback){var obj={};obj[SETTINGS_KEY]=value;var req=_settings.createLock().set(obj);req.onsuccess=function(){_return(callback);};req.onerror=function(){console.error('Error setting '+SETTINGS_KEY+'.');_return(callback);};};var _valuechanged=function sh_valuehanged(e){_value=e.settingValue;};var _init=function sh_init(callback){_getValue(function(value){_value=value?value:_defaultValue;_return(callback);});_settings.addObserver(SETTINGS_KEY,_valuechanged);};_init(function(){_isReady=true;_callbacks.forEach(function(callback){callback();});});return{get:function(callback){_ready(function(){_return(callback,_value?_value:_defaultValue);});},set:function(value,callback){_ready(function(){_setValue(value,_return.bind(null,callback));});},uninit:function(){_settings.removeObserver(SETTINGS_KEY,_valuechanged);}};};exports.SettingsHelper=SettingsHelper;})(this);

View file

@ -0,0 +1,5 @@
var SettingsListener={_lock:null,_observers:[],getSettingsLock:function sl_getSettingsLock(){if(this._lock&&!this._lock.closed){return this._lock;}
var settings=window.navigator.mozSettings;return(this._lock=settings.createLock());},observe:function sl_observe(name,defaultValue,callback){var settings=window.navigator.mozSettings;if(!settings){window.setTimeout(function(){callback(defaultValue);});return;}
var req;try{req=this.getSettingsLock().get(name);}catch(e){console.warn('Stale lock in settings_listener.js.','See https://bugzilla.mozilla.org/show_bug.cgi?id=793239');this._lock=null;req=this.getSettingsLock().get(name);}
req.addEventListener('success',(function onsuccess(){callback(typeof(req.result[name])!='undefined'?req.result[name]:defaultValue);}));var settingChanged=function settingChanged(evt){callback(evt.settingValue);};settings.addObserver(name,settingChanged);this._observers.push({name:name,callback:callback,observer:settingChanged});},unobserve:function sl_unobserve(name,callback){var settings=window.navigator.mozSettings;var that=this;this._observers.forEach(function(value,index){if(value.name===name&&value.callback===callback){settings.removeObserver(name,value.observer);that._observers.splice(index,1);}});}};

View file

@ -0,0 +1,5 @@
function SettingsURL(){this._url=null;this._isBlob=false;}
SettingsURL.prototype={set:function(value){if(this._isBlob){window.URL.revokeObjectURL(this._url);}
if(value instanceof Blob){this._isBlob=true;this._url=window.URL.createObjectURL(value);}else{this._isBlob=false;this._url=value;}
return this._url;},get:function(){return this._url;}};

View file

@ -0,0 +1,4 @@
(function(exports){var SimSettingsHelper={EMPTY_OPTION_TEXT:'--',EMPTY_OPTION_VALUE:-2,ALWAYS_ASK_OPTION_VALUE:-1,_callbacks:{outgoingCall:[],outgoingMessages:[],outgoingData:[]},observe:function(serviceName,callback){var serviceCallbacks=this._callbacks[serviceName];if(serviceCallbacks){serviceCallbacks.push(callback);}},unobserve:function(serviceName,callback){var serviceCallbacks=this._callbacks[serviceName];if(serviceCallbacks){var index=serviceCallbacks.indexOf(callback);if(index>-1){serviceCallbacks.splice(index,1);}}},getCardIndexFrom:function(serviceName,callback){this._get(serviceName)._onWhichCard(callback);},_get:function(serviceName){this.settingKeys=[];switch(serviceName){case'outgoingCall':this.settingKeys.push('ril.telephony.defaultServiceId');break;case'outgoingMessages':this.settingKeys.push('ril.sms.defaultServiceId');break;case'outgoingData':this.settingKeys.push('ril.data.defaultServiceId');break;}
return this;},_onWhichCard:function(callback){this.settingKeys.forEach(function(key){this._getFromSettingsDB(key,callback);}.bind(this));},_getFromSettingsDB:function(key,callback){var settings=window.navigator.mozSettings;var getReq=settings.createLock().get(key);var done=function done(){if(callback){var previousCardIndex=getReq.result[key]||0;callback(previousCardIndex);}};getReq.onsuccess=done;getReq.onerror=done;},setServiceOnCard:function(serviceName,cardIndex){this._set(serviceName)._on(+cardIndex);},_set:function(serviceName){this.settingKeys=[];switch(serviceName){case'outgoingCall':this.settingKeys.push('ril.telephony.defaultServiceId');this.settingKeys.push('ril.voicemail.defaultServiceId');break;case'outgoingMessages':this.settingKeys.push('ril.sms.defaultServiceId');break;case'outgoingData':this.settingKeys.push('ril.mms.defaultServiceId');this.settingKeys.push('ril.data.defaultServiceId');break;}
return this;},_on:function(cardIndex){this.settingKeys.forEach(function(key){this._setToSettingsDB(key,cardIndex);}.bind(this));},_setToSettingsDB:function(key,newValue,callback){var done=function done(){if(callback){callback();}};var settings=window.navigator.mozSettings;var getReq=settings.createLock().get(key);getReq.onsuccess=function(){var oldValue=getReq.result[key];if(oldValue!==newValue){var setObject={};setObject[key]=newValue;var setReq=settings.createLock().set(setObject);setReq.onsuccess=done;setReq.onerror=done;}else{done();}};getReq.onerror=done;},_addSettingsObservers:function(){var self=this;navigator.mozSettings.addObserver('ril.telephony.defaultServiceId',function(event){self._callbacks.outgoingCall.forEach(function(cb){cb(event.settingValue);});});navigator.mozSettings.addObserver('ril.sms.defaultServiceId',function(event){self._callbacks.outgoingMessages.forEach(function(cb){cb(event.settingValue);});});navigator.mozSettings.addObserver('ril.data.defaultServiceId',function(event){self._callbacks.outgoingData.forEach(function(cb){cb(event.settingValue);});});}};SimSettingsHelper._addSettingsObservers();exports.SimSettingsHelper=SimSettingsHelper;})(window);

View file

@ -0,0 +1,6 @@
(function(window){var _start=Date.now();var DEBUG=false;window.SIMSlot=function SIMSlot(conn,index,card){this.index=index;this.conn=conn;if(card){this.update(card);}
this.publish('created');};SIMSlot.EVENTS=['cardstatechange','iccinfochange','stkcommand','stksessionend'];SIMSlot.METHODS=['sendStkResponse','sendStkMenuSelection','sendStkTimerExpiration','sendStkEventDownload'];SIMSlot.DOM_REQUEST_METHODS=['getCardLock','unlockCardLock','setCardLock','getCardLockRetryCount','readContacts','updateContact','iccOpenChannel','iccExchangeAPDU','iccCloseChannel'];SIMSlot.ABSENT_TYPES=['permanentBlocked'];SIMSlot.LOCK_TYPES=['pinRequired','pukRequired','networkLocked','corporateLocked','serviceProviderLocked','network1Locked','network2Locked','hrpdNetworkLocked','ruimCorporateLocked','ruimServiceProviderLocked'];SIMSlot.prototype.update=function ss_update(iccObj){this.simCard=iccObj;this.constructor.EVENTS.forEach(function iterater(evt){iccObj.addEventListener(evt,this);},this);this.constructor.DOM_REQUEST_METHODS.forEach(function iterator(domRequest){this[domRequest]=function(){return iccObj[domRequest].apply(iccObj,arguments);};},this);this.constructor.METHODS.forEach(function iterator(method){this[method]=function(){return iccObj[method].apply(iccObj,arguments);};},this);this.publish('updated');};SIMSlot.prototype.EVENT_PREFIX='simslot-';SIMSlot.prototype.CLASS_NAME='SIMSLOT';SIMSlot.prototype.publish=function ss_publish(eventName){this.debug(' publish: '+eventName);window.dispatchEvent(new CustomEvent(this.EVENT_PREFIX+eventName,{detail:this}));};SIMSlot.prototype.handleEvent=function ss_handleEvent(evt){switch(evt.type){default:this.publish(evt.type);if(this.simCard){this.debug(this.simCard.cardState);}
break;}};SIMSlot.prototype.debug=function(){if(DEBUG){console.log('['+this.CLASS_NAME+']'+'['+(this.index)+']'+'['+(new Date().getTime()/1000-_start).toFixed(3)+']'+
Array.slice(arguments).concat());}};SIMSlot.prototype.isAbsent=function ss_isAbsent(){return(!this.simCard||this.constructor.ABSENT_TYPES.indexOf(this.simCard.cardState)>=0||this.simCard&&this.simCard.iccInfo&&this.simCard.iccInfo.iccid===null);};SIMSlot.prototype.getSmsc=function ss_getSmsc(cb){var mobileMessage=window.navigator.mozMobileMessage;if(!mobileMessage){console.error('can\'t access mozMobileMessage');cb(null);}else{mobileMessage.getSmscAddress(this.index).then((result)=>{var smsc;if(typeof result==='string'||result instanceof String){smsc=result.split(',')[0].replace(/"/g,'');}else{smsc=result.address;}
cb(smsc);},(error)=>{console.error(error);cb(null);});}};SIMSlot.prototype.isUnknownState=function ss_isUnknownState(){var empty=(this.simCard.cardState==='');var unknown=(this.simCard.cardState==='unknown');return!this.simCard.cardState||unknown||empty;};SIMSlot.prototype.isLocked=function ss_isLocked(){return this.constructor.LOCK_TYPES.indexOf(this.simCard.cardState)>=0;};SIMSlot.prototype.getCardState=function ss_getCardState(){return this.simCard.cardState;};}(window));

View file

@ -0,0 +1,10 @@
(function(window){var IccManager=navigator.mozIccManager;window.SIMSlotManager={length:0,_instances:[],TIMEOUT_FOR_SIM2:2000,_timerForSIM2:null,ready:false,init:function ssm_init(){if(!IccManager){return;}
this._conns=Array.prototype.slice.call(navigator.mozMobileConnections);this.length=this._conns.length;if(this._conns.length===0){return;}
var allSIMCardDetected=true;this._conns.forEach(function iterator(conn,index){var slot=new SIMSlot(conn,index,IccManager.getIccById(conn.iccId));this._instances.push(slot);if(slot.isAbsent()){allSIMCardDetected=false;}},this);if(allSIMCardDetected){this.publishSIMSlotIsReady();}else if(this.isMultiSIM()&&this.hasOnlyOneSIMCardDetected()){this.waitForSecondSIM();}
IccManager.addEventListener('iccdetected',this);window.dispatchEvent(new CustomEvent('simslotmanagerstarted'));},isMultiSIM:function(){return(this.length>1);},isSIMCardAbsent:function ssm_isSIMCardAbsent(index){var slot=this.get(index);if(slot){return slot.isAbsent();}else{return true;}},hasOnlyOneSIMCardDetected:function(){var sim0Absent=this.isSIMCardAbsent(0);var sim1Absent=this.isSIMCardAbsent(1);var hasOneSim=(sim0Absent&&!sim1Absent)||(!sim0Absent&&sim1Absent);return hasOneSim;},noSIMCardOnDevice:function ssm_noSIMCardOnDevice(){if(!IccManager||!IccManager.iccIds){return true;}
return(IccManager.iccIds.length===0);},noSIMCardConnectedToNetwork:function ssm_noSIMCardConnectedToNetwork(){if(!IccManager||!IccManager.iccIds){return true;}
return this._instances.every(function iterator(instance){return instance.conn.voice&&instance.conn.voice.emergencyCallsOnly;});},get:function ssm_get(index){if(index>this.length-1){return null;}
return this._instances[index];},getMobileConnection:function ssm_getMobileConnection(index){if(index>this.length-1){return null;}
return this._instances[index].conn;},getSlots:function ssm_getSlots(){return this._instances;},getSlotByIccId:function ssm_getSlotByIccId(iccId){var found=null;this._instances.some(function iterator(slot,index){if(slot.conn.iccId&&slot.conn.iccId===iccId){found=slot;return true;}else{return false;}},this);return found;},waitForSecondSIM:function(){var self=this;this._timerForSIM2=setTimeout(function(){clearTimeout(self._timerForSIM2);self.publishSIMSlotIsReady();},this.TIMEOUT_FOR_SIM2);},publishSIMSlotIsReady:function(){if(!this.ready){this.ready=true;window.dispatchEvent(new CustomEvent('simslotready'));}},handleEvent:function ssm_handleEvent(evt){switch(evt.type){case'iccdetected':var slot=this.getSlotByIccId(evt.iccId);if(slot){slot.update(IccManager.getIccById(evt.iccId));if(!this.isMultiSIM()){this.publishSIMSlotIsReady();}else{if(this.hasOnlyOneSIMCardDetected()){this.waitForSecondSIM();}else{clearTimeout(this._timerForSIM2);this.publishSIMSlotIsReady();}}}
break;}}};SIMSlotManager.init();}(window));

View file

@ -0,0 +1,10 @@
var STKHelper={getIconCanvas:function(mozStkIcon){if(!mozStkIcon||!mozStkIcon.pixels||!mozStkIcon.width||!mozStkIcon.height){return null;}
if(mozStkIcon.pixels.length<(mozStkIcon.width*mozStkIcon.height)){console.error('Not enough pixels for the required dimension: '+
mozStkIcon.width+'x'+mozStkIcon.height);return null;}
if(!mozStkIcon.codingScheme){mozStkIcon.codingScheme='basic';}
var canvas=document.createElement('canvas');canvas.setAttribute('width',mozStkIcon.width);canvas.setAttribute('height',mozStkIcon.height);var ctx=canvas.getContext('2d',{willReadFrequently:true});var imageData=ctx.createImageData(mozStkIcon.width,mozStkIcon.height);var pixel=0,pos=0;var data=imageData.data;for(var y=0;y<mozStkIcon.height;y++){for(var x=0;x<mozStkIcon.width;x++){data[pos++]=(mozStkIcon.pixels[pixel]&0xFF000000)>>>24;data[pos++]=(mozStkIcon.pixels[pixel]&0xFF0000)>>>16;data[pos++]=(mozStkIcon.pixels[pixel]&0xFF00)>>>8;data[pos++]=(mozStkIcon.pixels[pixel]&0xFF);pixel++;}}
ctx.putImageData(imageData,0,0);return canvas;},getMessageText:function(stkMessage,defaultMsgL10nId,defaultMsgL10nArgs){if(this.isIconSelfExplanatory(stkMessage)){return{raw:''};}
var text;if(stkMessage==='string'||stkMessage instanceof String){text=stkMessage;}else{text=stkMessage?stkMessage.text:'';}
if(!text&&defaultMsgL10nId){return{id:defaultMsgL10nId,args:defaultMsgL10nArgs};}
return{raw:text};},isIconSelfExplanatory:function(stkMessage){return(stkMessage&&stkMessage.icons&&stkMessage.iconSelfExplanatory);},getFirstIconRawData:function(stkItem){return stkItem.icons&&stkItem.icons.length>0?stkItem.icons[0]:null;}};

View file

@ -0,0 +1,2 @@
(function(exports){const unrecoverableErrors={ERROR_DIALOG_CLOSED_BY_USER:'fxsync-error-dialog-closed-by-user',ERROR_GET_FXA_ASSERTION:'fxsync-error-get-fxa-assertion',ERROR_INVALID_SYNC_ACCOUNT:'fxsync-error-invalid-account',ERROR_OFFLINE:'fxsync-error-offline',ERROR_NO_KEY_FETCH_TOKEN:'fxsync-error-no-key-fetch-token',ERROR_REQUEST_SYNC_REGISTRATION:'fxsync-error-request-fxsync-registration',ERROR_SYNC_INVALID_REQUEST_OPTIONS:'fxsync-error-invalid-request-options',ERROR_SYNC_REQUEST:'fxsync-error-request-failed',ERROR_UNKNOWN:'fxsync-error-unknown'};const recoverableErrors={ERROR_SYNC_APP_KILLED:'fxsync-error-app-killed',ERROR_SYNC_APP_SYNC_IN_PROGRESS:'fxsync-error-app-fxsync-in-progress',ERROR_SYNC_APP_GENERIC:'fxsync-error-app-generic',ERROR_SYNC_APP_TRY_LATER:'fxsync-error-app-try-later',ERROR_SYNC_APP_RACE_CONDITION:'fxsync-error-app-race-condition',ERROR_UNVERIFIED_ACCOUNT:'fxsync-error-unverified-account'};exports.SyncUnrecoverableErrors=[];Object.keys(unrecoverableErrors).forEach(key=>{exports[key]=unrecoverableErrors[key];exports.SyncUnrecoverableErrors.push(unrecoverableErrors[key]);});exports.SyncRecoverableErrors=[];Object.keys(recoverableErrors).forEach(key=>{exports[key]=recoverableErrors[key];exports.SyncRecoverableErrors.push(recoverableErrors[key]);});exports.SyncErrors={'invalid account':ERROR_INVALID_SYNC_ACCOUNT,'No keyFetchToken':ERROR_NO_KEY_FETCH_TOKEN,'OFFLINE':ERROR_OFFLINE,'try later':ERROR_SYNC_APP_TRY_LATER,'UI_ERROR':ERROR_DIALOG_CLOSED_BY_USER,'unauthorized':ERROR_INVALID_SYNC_ACCOUNT,'UNVERIFIED_ACCOUNT':ERROR_INVALID_SYNC_ACCOUNT,'unrecoverable':ERROR_UNKNOWN};}(window));

View file

@ -0,0 +1,6 @@
var Toaster={_containerElement:null,_messageElement:null,_defaultLatency:3000,_maxLatency:5000,_toastQueue:[],_parentElement:null,_toastVisibleClass:'toast-visible',_isBacklogged:function t_isBacklogged(){return this._toastQueue.length>0;},_isBusy:function t_isBusy(){return this._containerElement.classList.contains(this._toastVisibleClass);},_showContainerElement:function t_showContainerElement(){if(this._containerElement){this._containerElement.classList.add(this._toastVisibleClass);this._containerElement.hidden=false;}},_hideContainerElement:function t_hideContainerElement(useTransition){if(this._containerElement){this._containerElement.classList.remove(this._toastVisibleClass);if(!useTransition){this._containerElement.hidden=true;if(this._messageElement){this._messageElement.textContent='';this._messageElement.removeAttribute('data-l10n-id');}}}},_onTransitionEnd:function t_onTransitionEnd(e){if(!Toaster._containerElement.classList.contains(Toaster._toastVisibleClass)){Toaster._hideContainerElement();}},_produceToast:function t_producetToast(messageId,messageArgs,latency,useTransition){this._toastQueue.push({messageL10nId:messageId,messageL10nArgs:messageArgs,latency:Math.min(latency||this._defaultLatency,this._maxLatency),useTransition:useTransition});if(!this._isBusy()){this._consumeToast();}},_consumeToast:function t_consumeToast(){var self=this;var toast=null;if(self._isBacklogged()){toast=self._toastQueue.shift();self._messageElement.textContent='';document.l10n.setAttributes(self._messageElement,toast.messageL10nId,toast.messageL10nArgs);self._showContainerElement();setTimeout(function(){self._hideContainerElement(toast.useTransition);self._consumeToast();},toast.latency);}},_destroy:function t_destroy(){this._toastQueue=[];if(this._containerElement){this._containerElement.removeEventListener('transitionend',Toaster._onTransitionEnd);}
if(this._parentElement&&this._containerElement){this._parentElement.removeChild(this._containerElement);}
this._messageElement=null;this._containerElement=null;},get containerElement(){return this._containerElement;},get messageElement(){return this._messageElement;},initialize:function t_initialize(parentElement){var existedToastContainer=document.querySelector('section[role="status"]');if(existedToastContainer){existedToastContainer.parentNode.removeChild(existedToastContainer);}
this._destroy();this._containerElement=document.createElement('section');this._containerElement.setAttribute('role','status');this._hideContainerElement();this._messageElement=document.createElement('p');this._containerElement.appendChild(this._messageElement);this._parentElement=parentElement||document.body;this._parentElement.appendChild(this._containerElement);this._containerElement.addEventListener('transitionend',Toaster._onTransitionEnd);},isInitialized:function t_isInitialized(){return(this._containerElement&&this._messageElement&&this._toastQueue);},showToast:function t_showToast(options){if(!this.isInitialized()){this.initialize();}
this._produceToast(options.messageL10nId,options.messageL10nArgs,options.latency,options.useTransition);}};

View file

@ -0,0 +1,26 @@
function tzSelect(regionSelector,citySelector,onchange,onload){const TIMEZONE_FILE='/shared/resources/tz.json';const APN_TZ_FILE='/shared/resources/apn_tz.json';const TIMEZONE_NONE='NONE';const TIMEZONE_NETWORK='NETWORK';const TIMEZONE_SIM='SIM';const TIMEZONE_USER='USER';const TIMEZONE_PREVIOUS_SETTING='PREVIOUS_SETTING';function loadJSON(href,callback){var xhr=new XMLHttpRequest();xhr.open('GET',href,true);xhr.responseType='json';xhr.onerror=callback;xhr.onload=function(){callback(xhr.response);};xhr.onerror=function(){console.error('Error getting file');callback(xhr.response);};xhr.send();}
function getDefaultTimezoneID(callback){if(!callback){return;}
var tzDefault='America/New_York';var source=TIMEZONE_NONE;var mcc,mnc;var connections=window.navigator.mozMobileConnections||[];for(var i=0;i<connections.length;++i){var conn=connections[i];if(conn&&conn.voice&&conn.voice.network&&conn.voice.connected){mcc=conn.voice.network.mcc;mnc=conn.voice.network.mnc;source=TIMEZONE_NETWORK;break;}}
if(!mcc&&IccHelper&&IccHelper.iccInfo){mcc=IccHelper.iccInfo.mcc;mnc=IccHelper.iccInfo.mnc;source=TIMEZONE_SIM;if(IccHelper.cardState!=='ready'){IccHelper.addEventListener('iccinfochange',function simReady(){if(IccHelper.iccInfo.mcc){IccHelper.removeEventListener('iccinfochange',simReady);}
getDefaultTimezoneID(callback);});}}
if(!mcc){callback(tzDefault,TIMEZONE_NONE);return;}
loadJSON(APN_TZ_FILE,function(response){if(response){var tz=response[mcc];if(typeof(tz)==='string'){callback(tz,source);return;}else if(tz&&(mnc in tz)){callback(tz[mnc],source);return;}}
callback(tzDefault,TIMEZONE_NONE);});}
function newTZSelector(onchangeTZ,currentID,source){var gRegion=currentID.replace(/\/.*/,'');var gCity=currentID.replace(/.*?\//,'');var gTZ=null;function fillSelectElement(selector,options){selector.innerHTML='';options.sort(function(a,b){return(a.text>b.text);});for(var i=0;i<options.length;i++){var option=document.createElement('option');option.textContent=options[i].text;option.selected=options[i].selected;option.value=options[i].value;selector.appendChild(option);}}
function fillSelectL10nElement(selector,options){selector.innerHTML='';const collator=Intl.Collator(navigator.languages,{usage:'sort',});const frag=document.createDocumentFragment();const items=options.map(option=>{const item=document.createElement('option');item.setAttribute('data-l10n-id',option.l10nId);item.selected=option.selected;item.value=option.value;frag.appendChild(item);return item;});return document.l10n.translateFragment(frag).then(()=>{items.sort((a,b)=>collator.compare(a.textContent,b.textContent));items.forEach(item=>frag.appendChild(item));selector.appendChild(frag);});}
function getSelectedText(selector){var options=selector.querySelectorAll('option');return options[selector.selectedIndex].textContent;}
function fillRegions(){var options=[];for(var c in gTZ){options.push({l10nId:'tzRegion-'+c,value:c,selected:(c===gRegion)});}
fillSelectL10nElement(regionSelector,options).then(fillCities);}
function fillCities(){gRegion=regionSelector.value;var list=gTZ[gRegion];var options=[];for(var i=0;i<list.length;i++){options.push({text:list[i].name||list[i].city.replace(/_/g,' '),value:i,selected:(list[i].city===gCity)});}
fillSelectElement(citySelector,options);setTimezone();}
function setTimezone(){if(source===TIMEZONE_PREVIOUS_SETTING){onload&&onload(getTZInfo(),true);return;}
onchangeTZ(getTZInfo(),{'changedByUser':source===TIMEZONE_USER,'needsConfirmation':source!==TIMEZONE_USER&&source!==TIMEZONE_NETWORK});}
function getTZInfo(){var res=gTZ[gRegion][citySelector.value];gCity=res.city;var offset=res.offset.split(',');return{id:res.id||gRegion+'/'+res.city,region:getSelectedText(regionSelector),city:getSelectedText(citySelector),cc:res.cc,utcOffset:offset[0],dstOffset:offset[1]};}
regionSelector.onchange=function(){source=TIMEZONE_USER;fillCities();};citySelector.onchange=function(){source=TIMEZONE_USER;setTimezone();};loadJSON(TIMEZONE_FILE,function loadTZ(response){gTZ=response;fillRegions();});}
function newTZObserver(){var settings=window.navigator.mozSettings;if(!settings){return;}
settings.addObserver('time.timezone',function(event){setTimezoneDescription(event.settingValue);});var systemTimeChanged=function(){onchange(systemTimeChanged.tz,systemTimeChanged.needsConfirmation);};function updateTZ(tz,options){systemTimeChanged.tz=tz;systemTimeChanged.needsConfirmation=options.needsConfirmation;var req=settings.createLock().set({'time.timezone':tz.id});req.onsuccess=function updateTZ_callback(){if(options.changedByUser){settings.createLock().set({'time.timezone.user-selected':tz.id});}else{onload&&onload(tz,options.needsConfirmation);}};}
function initSelector(initialValue,source){onchange&&window.addEventListener('moztimechange',systemTimeChanged);onchange&&window.addEventListener('unload',function(){window.removeEventListener('moztimechange',systemTimeChanged);});newTZSelector(updateTZ,initialValue,source);}
var reqTimezone=settings.createLock().get('time.timezone');reqTimezone.onsuccess=function dt_getStatusSuccess(){var reqUserTZ=settings.createLock().get('time.timezone.user-selected');reqUserTZ.onsuccess=function dt_getUserTimezoneSuccess(){var userSelTimezone=reqUserTZ.result['time.timezone.user-selected'];if(userSelTimezone){initSelector(userSelTimezone,TIMEZONE_PREVIOUS_SETTING);}else{getDefaultTimezoneID(initSelector);}};};function setTimezoneDescription(timezoneID){var oldSelectedIndex=regionSelector.selectedIndex;regionSelector.value=timezoneID.replace(/\/.*/,'');if(regionSelector.selectedIndex==-1){regionSelector.selectedIndex=oldSelectedIndex;}
oldSelectedIndex=citySelector.selectedIndex;citySelector.value=timezoneID.replace(/.*?\//,'');if(citySelector.selectedIndex==-1){citySelector.selectedIndex=oldSelectedIndex;}}}
newTZObserver();}

View file

@ -0,0 +1,25 @@
(function(){var _global=this;var mathRNG,nodeRNG,whatwgRNG;var _rndBytes=new Array(16);mathRNG=function(){var r,b=_rndBytes,i=0;for(var i=0,r;i<16;i++){if((i&0x03)==0)r=Math.random()*0x100000000;b[i]=r>>>((i&0x03)<<3)&0xff;}
return b;}
try{var _rb=require('crypto').randomBytes;nodeRNG=_rb&&function(){return _rb(16);};}catch(e){}
var _rng=nodeRNG||whatwgRNG||mathRNG;var BufferClass=typeof(Buffer)=='function'?Buffer:Array;var _byteToHex=[];var _hexToByte={};for(var i=0;i<256;i++){_byteToHex[i]=(i+0x100).toString(16).substr(1);_hexToByte[_byteToHex[i]]=i;}
function parse(s,buf,offset){var i=(buf&&offset)||0,ii=0;buf=buf||[];s.toLowerCase().replace(/[0-9a-f]{2}/g,function(oct){if(ii<16){buf[i+ii++]=_hexToByte[oct];}});while(ii<16){buf[i+ii++]=0;}
return buf;}
function unparse(buf,offset){var i=offset||0,bth=_byteToHex;return bth[buf[i++]]+bth[buf[i++]]+
bth[buf[i++]]+bth[buf[i++]]+'-'+
bth[buf[i++]]+bth[buf[i++]]+'-'+
bth[buf[i++]]+bth[buf[i++]]+'-'+
bth[buf[i++]]+bth[buf[i++]]+'-'+
bth[buf[i++]]+bth[buf[i++]]+
bth[buf[i++]]+bth[buf[i++]]+
bth[buf[i++]]+bth[buf[i++]];}
var _seedBytes=_rng();var _nodeId=[_seedBytes[0]|0x01,_seedBytes[1],_seedBytes[2],_seedBytes[3],_seedBytes[4],_seedBytes[5]];var _clockseq=(_seedBytes[6]<<8|_seedBytes[7])&0x3fff;var _lastMSecs=0,_lastNSecs=0;function v1(options,buf,offset){var i=buf&&offset||0;var b=buf||[];options=options||{};var clockseq=options.clockseq!=null?options.clockseq:_clockseq;var msecs=options.msecs!=null?options.msecs:new Date().getTime();var nsecs=options.nsecs!=null?options.nsecs:_lastNSecs+1;var dt=(msecs-_lastMSecs)+(nsecs-_lastNSecs)/10000;if(dt<0&&options.clockseq==null){clockseq=clockseq+1&0x3fff;}
if((dt<0||msecs>_lastMSecs)&&options.nsecs==null){nsecs=0;}
if(nsecs>=10000){throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');}
_lastMSecs=msecs;_lastNSecs=nsecs;_clockseq=clockseq;msecs+=12219292800000;var tl=((msecs&0xfffffff)*10000+nsecs)%0x100000000;b[i++]=tl>>>24&0xff;b[i++]=tl>>>16&0xff;b[i++]=tl>>>8&0xff;b[i++]=tl&0xff;var tmh=(msecs/0x100000000*10000)&0xfffffff;b[i++]=tmh>>>8&0xff;b[i++]=tmh&0xff;b[i++]=tmh>>>24&0xf|0x10;b[i++]=tmh>>>16&0xff;b[i++]=clockseq>>>8|0x80;b[i++]=clockseq&0xff;var node=options.node||_nodeId;for(var n=0;n<6;n++){b[i+n]=node[n];}
return buf?buf:unparse(b);}
function v4(options,buf,offset){var i=buf&&offset||0;if(typeof(options)=='string'){buf=options=='binary'?new BufferClass(16):null;options=null;}
options=options||{};var rnds=options.random||(options.rng||_rng)();rnds[6]=(rnds[6]&0x0f)|0x40;rnds[8]=(rnds[8]&0x3f)|0x80;if(buf){for(var ii=0;ii<16;ii++){buf[i+ii]=rnds[ii];}}
return buf||unparse(rnds);}
var uuid=v4;uuid.v1=v1;uuid.v4=v4;uuid.parse=parse;uuid.unparse=unparse;uuid.BufferClass=BufferClass;uuid.mathRNG=mathRNG;uuid.nodeRNG=nodeRNG;uuid.whatwgRNG=whatwgRNG;if(typeof(module)!='undefined'){module.exports=uuid;}else{var _previousRoot=_global.uuid;uuid.noConflict=function(){_global.uuid=_previousRoot;return uuid;}
_global.uuid=uuid;}}());

View file

@ -0,0 +1,21 @@
var WifiHelper={getWifiManager:function(){return this.wifiManager();},wifiManager:function(){return navigator.mozWifiManager;},setPassword:function(network,password,identity,eap,phase2,certificate){var encType=this.getKeyManagement(network);switch(encType){case'WPA-PSK':network.psk=password;break;case'WPA-EAP':network.eap=eap;switch(eap){case'SIM':break;case'PEAP':case'TLS':case'TTLS':if(password&&password.length){network.password=password;}
if(identity&&identity.length){network.identity=identity;}
if(phase2!='No'){network.phase2=phase2;}
if(certificate!='none'){network.serverCertificate=certificate;}
break;default:break;}
break;case'WEP':network.wep=password;break;default:return;}
network.keyManagement=encType;},setSecurity:function(network,encryptions){network.security=encryptions;},getSecurity:function(network){return network.security;},getCapabilities:function(network){return network.capabilities===undefined||network.capabilities===null?[]:network.capabilities;},getKeyManagement:function(network){var key=this.getSecurity(network)[0];if(/WEP$/.test(key)){return'WEP';}
if(/PSK$/.test(key)){return'WPA-PSK';}
if(/EAP$/.test(key)){return'WPA-EAP';}
return'';},isConnected:function(network){return'connected'===this.getNetworkStatus(network);},getNetworkStatus:function(network){var currentConnection=this.getWifiManager().connection;var currentNetwork=currentConnection.network;if(!currentNetwork||!network){return false;}
var key=network.ssid+'+'+this.getSecurity(network).join('+');var curkey=currentNetwork.ssid+'+'+
this.getSecurity(currentNetwork).join('+');return(key===curkey?currentConnection.status:'disconnected');},isValidInput:function(key,password,identity,eap){function isValidWepKey(password){switch(password.length){case 5:case 13:case 16:case 29:return true;case 10:case 26:case 32:case 58:return!/[^a-fA-F0-9]/.test(password);default:return false;}}
switch(key){case'WPA-PSK':if(!password||password.length<8){return false;}
break;case'WPA-EAP':switch(eap){case'SIM':break;case'PEAP':case'TLS':case'TTLS':default:if(!password||password.length<1||!identity||identity.length<1){return false;}
break;}
break;case'WEP':if(!password||!isValidWepKey(password)){return false;}
break;}
return true;},isSSIDValid:function(ssid){return!!ssid&&ssid.length>0;},isWpsAvailable:function(network){var capabilities=this.getCapabilities(network);for(var i=0;i<capabilities.length;i++){if(/WPS/.test(capabilities[i])){return true;}}
return false;},isOpen:function(network){return this.getKeyManagement(network)==='';},isEap:function(network){return this.getKeyManagement(network).indexOf('EAP')!==-1;},_unionOfNetworks:function(available,known){var allNetworks=available||{};var result=[];Object.keys(known).forEach(function(key){if(!allNetworks[key]){allNetworks[key]=known[key];}});Object.keys(allNetworks).forEach(function(key){result.push(allNetworks[key]);});return result;},_networksArrayToObject:function(allNetworks){var self=this;var networksObject={};[].forEach.call(allNetworks,function(network){var key=network.ssid+'+'+
self.getSecurity(network).join('+');if(!networksObject[key]||network.relSignalStrength>networksObject[key].relSignalStrength){networksObject[key]=network;}});return networksObject;},_onReqProxySuccess:function(reqProxy,availableNetworks,knownNetworks){reqProxy.result=this._unionOfNetworks(availableNetworks,knownNetworks);reqProxy.onsuccess();},getAvailableAndKnownNetworks:function(){var self=this;var reqProxy={onsuccess:function(){},onerror:function(){}};var knownNetworks={};var availableNetworks={};var knownNetworksReq=null;var availableNetworksReq=this.getWifiManager().getNetworks();availableNetworksReq.onsuccess=function anrOnSuccess(){availableNetworks=self._networksArrayToObject(availableNetworksReq.result);knownNetworksReq=self.getWifiManager().getKnownNetworks();knownNetworksReq.onsuccess=function knrOnSuccess(){knownNetworks=self._networksArrayToObject(knownNetworksReq.result);self._onReqProxySuccess(reqProxy,availableNetworks,knownNetworks);};knownNetworksReq.onerror=function knrOnError(){self._onReqProxySuccess(reqProxy,availableNetworks,knownNetworks);};};availableNetworksReq.onerror=function anrOnError(){reqProxy.error=availableNetworksReq.error;reqProxy.onerror();};return reqProxy;},getSignalLevel:function(network){return Math.min(Math.floor(network.relSignalStrength/20),4);}};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,168 @@
{
"202": "Europe/Athens",
"204": "Europe/Amsterdam",
"206": "Europe/Brussels",
"208": "Europe/Paris",
"214": "Europe/Madrid",
"216": "Europe/Budapest",
"218": "Europe/Sarajevo",
"219": "Europe/Zagreb",
"220": "Europe/Belgrade",
"222": "Europe/Rome",
"226": "Europe/Bucharest",
"228": "Europe/Zurich",
"230": "Europe/Prague",
"231": "Europe/Bratislava",
"232": "Europe/Vienna",
"234": {
"00": "Europe/London",
"02": "Europe/London",
"03": "Europe/Jersey",
"10": "Europe/London",
"11": "Europe/London",
"15": "Europe/London",
"20": "Europe/London",
"30": "Europe/London",
"31": "Europe/London",
"32": "Europe/London",
"33": "Europe/London",
"34": "Europe/London",
"36": "Europe/Isle_of_Man",
"50": "Europe/Jersey",
"55": "Europe/Jersey",
"58": "Europe/Isle_of_Man"
},
"238": "Europe/Copenhagen",
"240": "Europe/Stockholm",
"242": "Europe/Oslo",
"244": "Europe/Helsinki",
"246": "Europe/Vilnius",
"247": "Europe/Riga",
"248": "Europe/Tallinn",
"250": "Europe/Moscow",
"255": "Europe/Kyiv",
"257": "Europe/Minsk",
"259": "Europe/Chisinau",
"260": "Europe/Warsaw",
"262": "Europe/Berlin",
"268": "Europe/Lisbon",
"270": "Europe/Luxembourg",
"272": "Europe/Dublin",
"274": "Atlantic/Reykjavik",
"276": "Europe/Tirane",
"278": "Europe/Malta",
"280": "Asia/Nicosia",
"282": "Asia/Tbilisi",
"283": "Asia/Yerevan",
"284": "Europe/Sofia",
"286": "Europe/Istanbul",
"288": "Atlantic/Faroe_Islands",
"293": "Europe/Ljubljana",
"294": "Europe/Skopje",
"297": "Europe/Podgorica",
"302": "America/Toronto",
"310": "America/New_York",
"311": "America/New_York",
"334": "America/Mexico_City",
"338": "America/Jamaica",
"342": "America/Barbados",
"358": "America/St_Lucia",
"360": "America/St_Vincent",
"364": "America/Nassau",
"370": "America/Santo_Domingo",
"374": "America/Port_of_Spain",
"400": "Asia/Baku",
"401": "Asia/Almaty",
"404": "Asia/Kolkata",
"405": "Asia/Kolkata",
"410": "Asia/Karachi",
"412": "Asia/Kabul",
"413": "Asia/Colombo",
"415": "Asia/Beirut",
"416": "Asia/Amman",
"418": "Asia/Baghdad",
"419": "Asia/Kuwait",
"420": "Asia/Riyadh",
"422": "Asia/Muscat",
"424": "Asia/Dubai",
"425": "Asia/Jerusalem",
"426": "Asia/Bahrain",
"427": "Asia/Qatar",
"428": "Asia/Ulan_Bator",
"429": "Asia/Kathmandu",
"432": "Asia/Tehran",
"434": "Asia/Tashkent",
"437": "Asia/Bishkek",
"440": "Asia/Tokyo",
"450": "Asia/Seoul",
"452": "Asia/Saigon",
"454": "Asia/Hong_Kong",
"455": "Asia/Macau",
"456": "Asia/Phnom_Penh",
"457": "Asia/Vientiane",
"460": "Asia/Chongqing",
"466": "Asia/Taipei",
"470": "Asia/Dhaka",
"472": "Indian/Maldives",
"502": "Asia/Kuala_Lumpur",
"505": "Australia/Sydney",
"510": "Asia/Jakarta",
"515": {
"01": "Asia/Karachi",
"02": "Asia/Manila",
"03": "Asia/Manila",
"04": "Asia/Karachi",
"05": "Asia/Manila",
"06": "Asia/Karachi",
"07": "Asia/Karachi"
},
"520": "Asia/Bangkok",
"525": "Asia/Singapore",
"528": "Asia/Brunei",
"530": "Pacific/Auckland",
"542": "Pacific/Fiji",
"547": "Pacific/Tahiti",
"602": "Africa/Cairo",
"603": "Africa/Algiers",
"604": "Africa/Casablanca",
"605": "Africa/Tunis",
"608": "Africa/Dakar",
"610": "Africa/Bamako",
"612": "Africa/Abidjan",
"617": "Indian/Mauritius",
"620": "Africa/Accra",
"621": "Africa/Lagos",
"624": "Africa/Douala",
"630": "Africa/Kinshasa",
"631": "Africa/Luanda",
"634": "Africa/Khartoum",
"635": "Africa/Kigali",
"636": "Africa/Addis_Ababa",
"639": "Africa/Nairobi",
"640": "Africa/Dar_es_Salaam",
"641": "Africa/Kampala",
"642": "Africa/Bujumbura",
"643": "Africa/Maputo",
"647": "Indian/Reunion",
"649": "Africa/Windhoek",
"650": "Africa/Blantyre",
"651": "Africa/Maseru",
"652": "Africa/Gaborone",
"655": "Africa/Johannesburg",
"704": "America/Guatemala",
"706": "America/El_Salvador",
"708": "America/Tegucigalpa",
"710": "America/Managua",
"712": "America/Costa_Rica",
"714": "America/Panama",
"716": "America/Lima",
"722": "America/Argentina/Buenos_Aires",
"724": "America/Sao_Paulo",
"730": "America/Santiago",
"732": "America/Bogota",
"734": "America/Caracas",
"738": "America/Guyana",
"740": "America/Quito",
"744": "America/Asuncion",
"748": "America/Montevideo"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 KiB

View file

@ -0,0 +1,564 @@
{
"layout": {
"af": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"am": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ar": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"as": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"bg": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"bm": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"bn-BD": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"bn-IN": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"bs": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ca": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"cs": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"cy": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"da": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"de": [
{
"layoutId": "de",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"dsb": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ee": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"el": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"en-GB": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"en-US": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"eo": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"es": [
{
"layoutId": "es",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"et": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"eu": [
{
"layoutId": "es",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
},
{
"layoutId": "fr",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
},
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"fa": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ff": [
{
"layoutId": "fr",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
},
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"fi": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"fr": [
{
"layoutId": "fr",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"fy-NL": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ga-IE": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"gd": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"gl": [
{
"layoutId": "es",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ha": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"he": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"hi-IN": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"hr": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"hsb": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ht": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"hu": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"hy-AM": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"id": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ig": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"it": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ja": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ko": [
{
"layoutId": "ko",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
},
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"lg": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"lij": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ln": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"lv": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"mk": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ml": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"mg": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"mr": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"my": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"nb": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"nl": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"or": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"pa": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"pl": [
{
"layoutId": "pl",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"pt-BR": [
{
"layoutId": "pt-BR",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"pt-PT": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"fr-x-psaccent": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ar-x-psbidi": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ro": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ru": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sk": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sl": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"son": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sq": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sr": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sr-Cyrl": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sr-Latn": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sv-SE": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"sw": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ta": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"te": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"th": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"tn": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"tl": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"tr": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"uk": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"ur": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"vi": [
{
"layoutId": "fr",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"wo": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"xh": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"yo": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"zam": [
{
"layoutId": "es",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"zh-CN": [
{
"layoutId": "zh-Hans-Pinyin",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
},
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"zh-TW": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
],
"zu": [
{
"layoutId": "en",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
]
},
"langIndependentLayouts": [
{
"layoutId": "number",
"appManifestURL": "app://keyboard.gaiamobile.org/manifest.webapp"
}
]
}

View file

@ -0,0 +1,39 @@
{
"ar" : "عربي",
"bg" : "български",
"bn-BD" : "বাংলা (বাংলাদেশ)",
"ca" : "Català",
"cs" : "Čeština",
"da" : "Dansk",
"de" : "Deutsch",
"el" : "Ελληνικά",
"en-US" : "English (US)",
"es" : "Español",
"eu" : "Euskara",
"fr" : "Français",
"gl" : "Galego",
"hr" : "Hrvatski",
"hu" : "Magyar",
"it" : "Italiano",
"ja" : "日本語",
"km" : "ខ្មែរ",
"ko" : "한국어",
"lt" : "Lietuvių",
"mk" : "Македонски",
"ms" : "Melayu",
"ne-NP" : "नेपाली",
"nl" : "Nederlands",
"pa" : "ਪੰਜਾਬੀ",
"pl" : "Polski",
"pt-BR" : "Português (do Brasil)",
"ro" : "Română",
"ru" : "Русский",
"sk" : "Slovenčina",
"sq" : "Shqip",
"sr-Cyrl" : "Српски",
"sr-Latn" : "Srpski",
"sv-SE" : "Svenska",
"tr" : "Türkçe",
"zh-CN" : "中文 (简体)",
"zh-TW" : "正體中文 (繁體)"
}

View file

@ -0,0 +1,22 @@
{
"notifier_bells.opus": {"l10nID": "notifier_bells"},
"notifier_bloom.opus": {"l10nID": "notifier_bloom"},
"notifier_chime.opus": {"l10nID": "notifier_chime"},
"notifier_clicka.opus": {"l10nID": "notifier_clicka"},
"notifier_digi.opus": {"l10nID": "notifier_digi"},
"notifier_dropplet.opus": {"l10nID": "notifier_dropplet"},
"notifier_firefox.opus": {"l10nID": "notifier_firefox2"},
"notifier_hello.opus": {"l10nID": "notifier_hello"},
"notifier_lowmarble.opus": {"l10nID": "notifier_lowmarble"},
"notifier_ping.opus": {"l10nID": "notifier_ping"},
"notifier_plickle.opus": {"l10nID": "notifier_plickle"},
"notifier_pocko.opus": {"l10nID": "notifier_pocko"},
"notifier_quado.opus": {"l10nID": "notifier_quado"},
"notifier_red.opus": {"l10nID": "notifier_red"},
"notifier_sato.opus": {"l10nID": "notifier_sato"},
"notifier_swipo.opus": {"l10nID": "notifier_swipo"},
"notifier_trickleup.opus": {"l10nID": "notifier_trickleup"},
"notifier_trink.opus": {"l10nID": "notifier_trink"},
"notifier_verse.opus": {"l10nID": "notifier_verse"}
}

View file

@ -0,0 +1,23 @@
{
"ringer_bubble.opus": {"l10nID": "ringer_bubble"},
"ringer_chimer.opus": {"l10nID": "ringer_chimer"},
"ringer_cunning.opus": {"l10nID": "ringer_cunning"},
"ringer_dulco.opus": {"l10nID": "ringer_dulco"},
"ringer_firefox.opus": {"l10nID": "ringer_firefox2"},
"ringer_garden.opus": {"l10nID": "ringer_garden"},
"ringer_marbled.opus": {"l10nID": "ringer_marbled"},
"ringer_opti.opus": {"l10nID": "ringer_opti"},
"ringer_pecko.opus": {"l10nID": "ringer_pecko"},
"ringer_pingy.opus": {"l10nID": "ringer_pingy"},
"ringer_poppop.opus": {"l10nID": "ringer_poppop"},
"ringer_sata.opus": {"l10nID": "ringer_sata"},
"ringer_simple.opus": {"l10nID": "ringer_simple"},
"ringer_standard1.opus": {"l10nID": "ringer_standard1"},
"ringer_standard2.opus": {"l10nID": "ringer_standard2"},
"ringer_stutter.opus": {"l10nID": "ringer_stutter"},
"ringer_symmetry.opus": {"l10nID": "ringer_symmetry"},
"ringer_tailwind.opus": {"l10nID": "ringer_tailwind"},
"ringer_thoughtful.opus": {"l10nID": "ringer_thoughtful"},
"ringer_wit.opus": {"l10nID": "ringer_wit"},
"ringer_zen.opus": {"l10nID": "ringer_zen"}
}

Some files were not shown because too many files have changed in this diff Show more