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
6
assets/webapps/search.gaiamobile.org/js/newtab.js
Normal file
6
assets/webapps/search.gaiamobile.org/js/newtab.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
;'use strict';(function(exports){var isManuallyPrivate=window.location.search.includes('private=1');var isManuallyRegular=window.location.search.includes('private=0');var isPrivateByDefault=false;SettingsListener.observe('browser.private.default',false,function(value){if(value){isPrivateByDefault=true;}else{isPrivateByDefault=false;}
|
||||
exports.newtab.togglePrivacyMode();});function Newtab(){var self=this;navigator.mozApps.getSelf().onsuccess=function(){var app=this.result;app.connect('search-results').then(function onConnAccepted(ports){ports.forEach(function(port){self._port=port;});self.init();},function onConnectionRejected(reason){console.log('Error connecting: '+reason+'\n');});};this.togglePrivacyMode();}
|
||||
Newtab.prototype={provider:null,init:function(){this.provider.init();this.provider.searchObj=this;},requestScreenshot:function(url){this._port.postMessage({'action':'request-screenshot','url':url});},requestPrivateWindow:function(){this._port.postMessage({'action':'private-window'});},togglePrivacyMode:function(){var themeMeta=document.querySelector('meta[name="theme-color"]');var themeColor=document.createElement('meta');if((isPrivateByDefault&&!isManuallyRegular)||(!isPrivateByDefault&&isManuallyPrivate)){if(themeMeta){document.head.removeChild(themeMeta);}
|
||||
themeColor.setAttribute('name','theme-color');themeColor.setAttribute('content','#392E54');document.head.appendChild(themeColor);document.body.classList.add('private');asyncStorage.getItem('shouldSuppressPrivateDialog',value=>{if(value){return;}
|
||||
this.privateBrowserDialog=document.getElementById('private-window-dialog');this.privateBrowserDialog.removeAttribute('hidden');this.privateBrowserDialogClose=document.getElementById('private-window-hide-dialog');this.privateBrowserDialogClose.addEventListener('click',this);this.privateBrowserLearnMore=document.getElementById('private-learn-more');this.privateBrowserLearnMore.addEventListener('click',this);});}
|
||||
if(isPrivateByDefault&&isManuallyRegular){if(themeMeta){document.head.removeChild(themeMeta);}}},handleEvent:function(e){switch(e.target){case this.privateBrowserDialogClose:this.hidePrivateBrowserDialog();break;case this.privateBrowserLearnMore:this.learnAboutPrivateBrowsing(e);break;}},hidePrivateBrowserDialog:function(){this.privateBrowserDialog.setAttribute('hidden',true);var checkbox=this.privateBrowserDialog.querySelector('gaia-checkbox');if(checkbox.checked){asyncStorage.setItem('shouldSuppressPrivateDialog',true);}},learnAboutPrivateBrowsing:function(e){e.preventDefault();new MozActivity({name:'view',data:{type:'url',url:e.target.href}});}};exports.newtab=new Newtab();exports.Search={provider:function(provider){exports.newtab.provider=provider;},navigate:function(url){new MozActivity({name:'view',data:{type:'url',url:url}});}};})(window);
|
||||
Loading…
Reference in a new issue