ws4kp/dist/resources/ws.min.js

1 line
122 KiB
JavaScript
Raw Normal View History

2023-09-20 20:42:09 +00:00
(()=>{"use strict";var e={407:(e,t,n)=>{var s=n(929),r=n(739),a=n(325),i=n(594);document.addEventListener("DOMContentLoaded",(()=>{h()}));let o=!1;const l=["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="#txtAddress",u="#ToggleFullScreen",d="#btnGetGps",h=()=>{document.querySelector(c).addEventListener("focus",(e=>{e.target.select()})),(0,a.uL)(v),document.querySelector("#NavigateMenu").addEventListener("click",w),document.querySelector("#NavigateRefresh").addEventListener("click",b),document.querySelector("#NavigateNext").addEventListener("click",C),document.querySelector("#NavigatePrevious").addEventListener("click",T),document.querySelector("#NavigatePlay").addEventListener("click",M),document.querySelector(u).addEventListener("click",g);const e=document.querySelector(d);e.addEventListener("click",I),navigator.geolocation||(e.style.display="none"),document.querySelector("#divTwc").addEventListener("click",(()=>{document.fullscreenElement&&x()})),document.querySelector(c).addEventListener("keydown",(e=>{"Enter"===e.code&&t()})),document.querySelector("#btnGetLatLng").addEventListener("click",(()=>t())),document.addEventListener("keydown",k),document.addEventListener("touchmove",(e=>{o&&e.preventDefault()})),$(c).devbridgeAutocomplete({serviceUrl:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest",deferRequestBy:300,paramName:"text",params:{f:"json",countryCode:"USA",category:l,maxSuggestions:10},dataType:"json",transformResult:e=>({suggestions:e.suggestions.map((e=>({value:e.text,data:e.magicKey})))}),minChars:3,showNoSuggestionNotice:!0,noSuggestionNotice:"No results found. Please try a different search string.",onSelect(e){m(e,this)},width:490});const t=()=>{const e=$(c).devbridgeAutocomplete();return e.suggestions[0]&&$(e.suggestionsContainer.children[0]).trigger("click"),!1},n=localStorage.getItem("latLonQuery"),s=localStorage.getItem("latLon"),r=localStorage.getItem("latLonFromGPS");if(n&&s&&!r){document.querySelector(c).value=n,v(JSON.parse(s))}r&&I();const i=localStorage.getItem("play");null!==i&&"true"!==i||L("navButton","play"),document.querySelector("#btnClearQuery").addEventListener("click",(()=>{document.querySelector("#spanCity").innerHTML="",document.querySelector("#spanState").innerHTML="",document.querySelector("#spanStationId").innerHTML="",document.querySelector("#spanRadarId").innerHTML="",document.querySelector("#spanZoneId").innerHTML="",document.querySelector("#chkAutoRefresh").checked=!0,localStorage.removeItem("autoRefresh"),localStorage.removeItem("play"),L("navButton","play"),localStorage.removeItem("latLonQuery"),localStorage.removeItem("latLon"),localStorage.removeItem("latLonFromGPS"),document.querySelector(d).classList.remove("active")})),document.querySelector("#container").addEventListener("swiped-left",(()=>S("left"))),document.querySelector("#container").addEventListener("swiped-right",(()=>S("right")))},m=async(e,t)=>{if(t.previousSuggestionValue===e.value)return;const n=(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];n?(localStorage.removeItem("latLonFromGPS"),document.querySelector(d).classList.remove("active"),f(n.feature.geometry)):console.error("An unexpected error occurred. Please try a different search string.")},f=(e,t)=>{const n={lat:(0,i.Xp)(e.y,4),lon:(0,i.Xp)(e.x,4)};localStorage.setItem("latLonQuery",document.querySelector(c).value),localStorage.setItem("latLon",JSON.stringify(n)),v(n,t)},g=()=>(document.fullscreenElement?p():y(),(0,a.yA)()?(0,r.Z)(!0):(0,r.Z)(!1),x(),!1),y=()=>{const e=d