Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
10 lines
No EOL
2.4 KiB
JavaScript
10 lines
No EOL
2.4 KiB
JavaScript
;(function(exports){'use strict';var selectors={recents:'recents-panel',contacts:'iframe-contacts-container',keypad:'keypad-panel'};var currentDestination=null;function checkContactsTab(){var contactsIframe=document.getElementById('iframe-contacts');if(!contactsIframe){return;}
|
|
var index=contactsIframe.src.indexOf('#add-parameters');if(index!=-1){contactsIframe.src=contactsIframe.src.substr(0,index);}}
|
|
function update(destination){var recent=document.getElementById('option-recents');var contacts=document.getElementById('option-contacts');var keypad=document.getElementById('option-keypad');var tabs=[recent,contacts,keypad];recent.classList.remove('toolbar-option-selected');contacts.classList.remove('toolbar-option-selected');keypad.classList.remove('toolbar-option-selected');switch(destination){case'recents':checkContactsTab();recent.classList.add('toolbar-option-selected');AccessibilityHelper.setAriaSelected(recent,tabs);CallLog.init();break;case'contacts':var frame=document.getElementById('iframe-contacts');if(!frame){var view=document.getElementById('iframe-contacts-container');frame=document.createElement('iframe');frame.src='/contacts/index.html';frame.id='iframe-contacts';frame.setAttribute('frameBorder','no');frame.classList.add('grid-wrapper');view.appendChild(frame);}
|
|
contacts.classList.add('toolbar-option-selected');AccessibilityHelper.setAriaSelected(contacts,tabs);var forceHashChange=new Date().getTime();frame.src='/contacts/index.html#home?forceHashChange='+
|
|
forceHashChange;break;case'keypad':checkContactsTab();keypad.classList.add('toolbar-option-selected');AccessibilityHelper.setAriaSelected(keypad,tabs);break;}}
|
|
exports.Navigation={get currentView(){return currentDestination;},show:function(destination){var selector=selectors[destination];if(!selector){throw new Error('Navigation: Invalid destination: '+destination);}
|
|
var view=document.getElementById(selector);if(!view){throw new Error('Navigation: Panel does not exist: '+destination);}
|
|
if(currentDestination&¤tDestination===destination){return;}
|
|
view.style.visibility='visible';if(currentDestination){var currentSelector=selectors[currentDestination];document.getElementById(currentSelector).style.visibility='hidden';}
|
|
currentDestination=destination;update(destination);},showKeypad:function(){this.show('keypad');},showContacts:function(){this.show('contacts');},showCalllog:function(){this.show('recents');}};}(window)); |