ws4kp/dist/resources/ws.min.js

1 line
115 KiB
JavaScript
Raw Normal View History

2022-12-12 16:53:12 +00:00
(()=>{"use strict";var e={407:(e,t,n)=>{var s=n(929),r=n(739),a=n(69);document.addEventListener("DOMContentLoaded",(()=>{u()}));const i={};let o=!1,l=!1;const c=["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(","),u=()=>{document.getElementById("txtAddress").addEventListener("focus",(e=>{e.target.select()})),(0,a.uL)(p),document.getElementById("NavigateMenu").addEventListener("click",y),document.getElementById("NavigateRefresh").addEventListener("click",v),document.getElementById("NavigateNext").addEventListener("click",S),document.getElementById("NavigatePrevious").addEventListener("click",T),document.getElementById("NavigatePlay").addEventListener("click",D),document.getElementById("ToggleFullScreen").addEventListener("click",m),document.getElementById("btnGetGps").addEventListener("click",x),document.getElementById("divTwc").addEventListener("click",(()=>{document.fullscreenElement&&C()})),document.addEventListener("keydown",M),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:c,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 n=localStorage.getItem("TwcPlay");null!==n&&"true"!==n||I("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"),I("navButton","play"),localStorage.removeItem("TwcQuery")})),document.getElementById("container").addEventListener("swiped-left",(()=>w("left"))),document.getElementById("container").addEventListener("swiped-right",(()=>w("right")))},d=async(e,t)=>{if(t.previousSuggestionValue!==e.value)if(i[e.value])h(i[e.value]);else{const t=(await(0,s.AV)("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find",{data:{text:e.value,magicKey:e.data,f:"json"}})).locations[0];t?h(t.feature.geometry):console.error("An unexpected error occurred. Please try a different search string.")}},h=e=>{const t={lat:Math.round2(e.y,4),lon:Math.round2(e.x,4)};p(t),localStorage.setItem("TwcQuery",document.getElementById("txtAddress").value)},m=()=>(document.fullscreenElement?g():f(),(0,a.yA)()?(0,r.Z)(!0):(0,r.Z)(!1),C(),!1),f=()=>{const e=document.getElementById("divTwc"),t=e.requestFullScreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t?t.call(e,{navigationUI:"hide"}):(window.scrollTo(0,0),l=!0),(0,a.SI)(),C();const n=document