2022-12-07 16:53:18 +00:00
|
|
|
(()=>{"use strict";var e={"./server/scripts/index.mjs":(e,t,s)=>{s.r(t);var r=s("./server/scripts/modules/utils/fetch.mjs"),n=s("./server/scripts/modules/utils/nosleep.mjs"),a=s("./server/scripts/modules/navigation.mjs");document.addEventListener("DOMContentLoaded",(()=>{c()}));const i={};let o=!1,l=!1;const u=["Land Features","Bay","Channel","Cove","Dam","Delta","Gulf","Lagoon","Lake","Ocean","Reef","Reservoir","Sea","Sound","Strait","Waterfall","Wharf","Amusement Park","Historical Monument","Landmark","Tourist Attraction","Zoo","College","Beach","Campground","Golf Course","Harbor","Nature Reserve","Other Parks and Outdoors","Park","Racetrack","Scenic Overlook","Ski Resort","Sports Center","Sports Field","Wildlife Reserve","Airport","Ferry","Marina","Pier","Port","Resort","Postal","Populated Place"].join(","),c=()=>{document.getElementById("txtAddress").addEventListener("focus",(e=>{e.target.select()})),(0,a.registerRefreshData)(y),document.getElementById("NavigateMenu").addEventListener("click",p),document.getElementById("NavigateRefresh").addEventListener("click",w),document.getElementById("NavigateNext").addEventListener("click",S),document.getElementById("NavigatePrevious").addEventListener("click",T),document.getElementById("NavigatePlay").addEventListener("click",D),document.getElementById("ToggleFullScreen").addEventListener("click",h),document.getElementById("btnGetGps").addEventListener("click",x),document.getElementById("divTwc").addEventListener("click",(()=>{document.fullscreenElement&&C()})),document.addEventListener("keydown",I),document.addEventListener("touchmove",(e=>{l&&e.preventDefault()})),$("#frmGetLatLng #txtAddress").devbridgeAutocomplete({serviceUrl:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest",deferRequestBy:300,paramName:"text",params:{f:"json",countryCode:"USA",category:u,maxSuggestions:10},dataType:"json",transformResult:t=>(o&&(o=!1,window.setTimeout((()=>{$(e.suggestionsContainer.children[0]).click()}),1)),{suggestions:$.map(t.suggestions,(e=>({value:e.text,data:e.magicKey})))}),minChars:3,showNoSuggestionNotice:!0,noSuggestionNotice:"No results found. Please try a different search string.",onSelect(e){d(e,this)},width:490});const e=$("#frmGetLatLng #txtAddress").devbridgeAutocomplete();$("#frmGetLatLng").on("submit",(()=>(e.suggestions[0]&&$(e.suggestionsContainer.children[0]).click(),!1)));const t=localStorage.getItem("TwcQuery");if(t){o=!0;const e=document.getElementById("txtAddress");e.value=t,e.blur(),e.focus()}const s=localStorage.getItem("TwcPlay");null!==s&&"true"!==s||M("navButton","play"),document.getElementById("btnClearQuery").addEventListener("click",(()=>{document.getElementById("spanCity").innerHTML="",document.getElementById("spanState").innerHTML="",document.getElementById("spanStationId").innerHTML="",document.getElementById("spanRadarId").innerHTML="",document.getElementById("spanZoneId").innerHTML="",localStorage.removeItem("TwcScrollText"),localStorage.removeItem("TwcScrollTextChecked"),document.getElementById("chkAutoRefresh").checked=!0,localStorage.removeItem("TwcAutoRefresh"),document.getElementById("radEnglish").checked=!0,localStorage.removeItem("TwcPlay"),M("navButton","play"),localStorage.removeItem("TwcQuery")})),document.getElementById("container").addEventListener("swiped-left",(()=>v("left"))),document.getElementById("container").addEventListener("swiped-right",(()=>v("right")))},d=async(e,t)=>{if(t.previousSuggestionValue!==e.value)if(i[e.value])m(i[e.value]);else{const t=(await(0,r.json)("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find",{data:{text:e.value,magicKey:e.data,f:"json"}})).locations[0];t?m(t.feature.geometry):console.error("An unexpected error occurred. Please try a different search string.")}},m=e=>{const t={lat:Math.round2(e.y,4),lon:Math.round2(e.x,4)};y(t),localStorage.setItem("TwcQuery",document.getElementById("txtAddress").value)},h=()=>(document.fullscreenElement?g():f(),(0,a.isPlaying)()?(0,n.default)(!0):(0,n.default)(!1),C(),!1),f=()=>{const e=document.getElementById("divTwc"),
|