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;ib.text);});for(var i=0;i{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