Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
20
assets/webapps/verticalhome.gaiamobile.org/js/app.js
Normal file
20
assets/webapps/verticalhome.gaiamobile.org/js/app.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
;'use strict';(function(exports){const HIDDEN_ROLES=['system','input','homescreen','theme','addon','langpack'];const EDIT_MODE_TRANSITION_STYLE='transform 0.25s ease 0s, height 0s ease 0.5s';function App(){window.performance.mark('navigationLoaded');this.grid=document.getElementById('icons');this.grid.addEventListener('iconblobdecorated',this);this.grid.addEventListener('gaiagrid-iconbloberror',this);this.grid.addEventListener('gaiagrid-attention',this);this.grid.addEventListener('gaiagrid-resize',this);this.grid.addEventListener('cached-icons-rendered',this);this.grid.addEventListener('edititem',this);this.grid.addEventListener('editmode-start',this);this.grid.addEventListener('editmode-end',this);window.addEventListener('hashchange',this);window.addEventListener('gaiagrid-saveitems',this);window.addEventListener('online',this.retryFailedIcons.bind(this));var editModeDone=document.getElementById('exit-edit-mode');editModeDone.addEventListener('click',this.exitEditMode);window.addEventListener('gaiagrid-dragdrop-begin',this);window.addEventListener('gaiagrid-dragdrop-finish',this);window.addEventListener('context-menu-open',this);window.addEventListener('context-menu-close',this);window.addEventListener('gaia-confirm-open',this);window.addEventListener('gaia-confirm-close',this);this.layoutReady=false;window.addEventListener('gaiagrid-layout-ready',this);this._iconsToRetry=[];document.addEventListener('visibilitychange',this);window.performance.mark('navigationInteractive');}
|
||||
App.prototype={HIDDEN_ROLES:HIDDEN_ROLES,EDIT_MODE_TRANSITION_STYLE:EDIT_MODE_TRANSITION_STYLE,retryFailedIcons:function(){if(!this._iconsToRetry.length){return;}
|
||||
var icons=this.grid.getIcons();var iconId;while((iconId=this._iconsToRetry.shift())){var icon=icons[iconId];if(!icon){continue;}
|
||||
icon.renderIcon();}},init:function(){this.itemStore=new ItemStore((firstTime)=>{if(!firstTime){return;}
|
||||
LazyLoader.load(['shared/js/icc_helper.js','shared/js/version_helper.js','js/configurator.js'],function onLoad(){exports.configurator=new Configurator();});});this.itemStore.all(function _all(results){results.forEach(function _eachResult(result){this.grid.add(result);},this);if(this.layoutReady){this.renderGrid();}else{window.addEventListener('gaiagrid-layout-ready',function onReady(){window.removeEventListener('gaiagrid-layout-ready',onReady);this.renderGrid();}.bind(this));}
|
||||
window.performance.mark('visuallyLoaded');window.performance.mark('contentInteractive');window.addEventListener('localized',this.onLocalized.bind(this));LazyLoader.load(['shared/elements/gaia-header/dist/gaia-header.js','js/contextmenu_handler.js','/shared/js/homescreens/confirm_dialog_helper.js'],function(){window.performance.mark('fullyLoaded');});}.bind(this));},renderGrid:function(){this.grid.setEditHeaderElement(document.getElementById('edit-header'));this.grid.render();},start:function(){this.grid.start();},stop:function(){this.grid.stop();},onLocalized:function(){var items=this.grid.getItems();items.forEach(function eachItem(item){if(!item.name){return;}
|
||||
item.updateTitle();});this.renderGrid();},exitEditMode:function(e){e.preventDefault();window.dispatchEvent(new CustomEvent('hashchange'));},handleEvent:function(e){switch(e.type){case'cached-icons-rendered':window.dispatchEvent(new CustomEvent('gaiagrid-cached-icons-rendered'));break;case'iconblobdecorated':var item=e.detail;this.itemStore.saveItem(item.detail,()=>{item.element.classList.add('test-icon-cached');});break;case'edititem':var icon=e.detail;if(icon.detail.type!='divider'){return;}
|
||||
LazyLoader.load('js/edit_group.js',()=>{groupEditor.edit(icon);});break;case'gaiagrid-iconbloberror':this._iconsToRetry.push(e.detail.identifier);break;case'gaiagrid-attention':var offsetTop=this.grid.offsetTop;var scrollTop=window.scrollY;var gridHeight=document.body.clientHeight;if(this.grid._grid.dragdrop.inEditMode){gridHeight-=offsetTop;}else{scrollTop-=offsetTop;}
|
||||
var rect=e.detail;if(scrollTop+gridHeight<rect.y+rect.height){scrollTop=(rect.y+rect.height)-gridHeight;}
|
||||
if(scrollTop>rect.y){scrollTop=rect.y;}
|
||||
if(!this.grid._grid.dragdrop.inEditMode){scrollTop+=offsetTop;}
|
||||
if(scrollTop!==window.scrollY){document.body.style.overflow='';requestAnimationFrame(()=>{requestAnimationFrame(()=>{window.scrollTo({left:0,top:scrollTop,behavior:'smooth'});});});}
|
||||
break;case'gaiagrid-resize':var height=e.detail;var oldHeight=this.grid.clientHeight;if(this.gridResizeTimeout!==null){clearTimeout(this.gridResizeTimeout);this.gridResizeTimeout=null;}
|
||||
if(height<oldHeight){var viewHeight=document.body.clientHeight;var scrollBottom=window.scrollY+viewHeight;var padding=window.getComputedStyle?parseInt(window.getComputedStyle(this.grid).paddingBottom):0;var maxScrollBottom=height+this.grid.offsetTop+padding;if(scrollBottom>=maxScrollBottom){requestAnimationFrame(()=>{requestAnimationFrame(()=>{window.scrollTo({left:0,top:maxScrollBottom-viewHeight,behavior:'smooth'});});});}}
|
||||
if(height===oldHeight){break;}
|
||||
this.grid.style.height=height+'px';break;case'gaiagrid-saveitems':this.itemStore.save(this.grid.getItems());break;case'context-menu-open':case'gaia-confirm-open':document.body.classList.add('fixed-overlay-shown');case'gaiagrid-dragdrop-begin':window.removeEventListener('hashchange',this);break;case'context-menu-close':case'gaia-confirm-close':document.body.classList.remove('fixed-overlay-shown');case'gaiagrid-dragdrop-finish':window.addEventListener('hashchange',this);break;case'gaiagrid-layout-ready':this.layoutReady=true;window.removeEventListener('gaiagrid-layout-ready',this);break;case'visibilitychange':if(document.hidden){document.body.style.overflow='hidden';}else{setTimeout(function(){document.body.style.overflow='';});}
|
||||
break;case'editmode-start':this.grid.style.transition=this.EDIT_MODE_TRANSITION_STYLE;break;case'editmode-end':this.grid.style.transition='';break;case'hashchange':var editor=exports.groupEditor;if(editor&&!editor.hidden){return;}
|
||||
var _grid=this.grid._grid;if(_grid.dragdrop&&_grid.dragdrop.inEditMode){_grid.dragdrop.exitEditMode();return;}
|
||||
if(document.hidden){return;}
|
||||
window.scrollTo({left:0,top:0,behavior:'smooth'});}}};exports.configurator={getSingleVariantApp:function(){return{};},get isSingleVariantReady(){return true;},get isSimPresentOnFirstBoot(){return false;},getItems:function(role){return{};}};exports.app=new App();exports.app.init();}(window));
|
||||
Loading…
Reference in a new issue