PageSourceSearch

https://www.nvroads.com/bundles/map511?v=HCnC7hRPm4zvKGoi4qdvuHkPPH6d2K9mI8V-wXhJ8Zk1

js nvroads.com collected 2026-10-02 04:24:52 UTC 58,065 bytes, 316 lines download raw bytes

1var AtisContextMenu=function(e,t){var s,n={populateMenu:function(e,r,a,i,u){var t=16;$.ajax("/api/route/getlocations?latitude="+MapComp.lat(i)+"&longitude="+MapComp.lng(i)+"&zoom="+t).done(function(e){var t="";if(s=[],null!=e)if(e.length)for(var n=0,o=e.length;n<o;n++)e[n].name&&(t+='<li><a  href="#'+n+'">'+e[n].nameDirection+"</a></li>",s.push(e[n]));else t='<li><p class="error">'+resources.CouldNotRetrieveMapLocation+"</p></li>";u(t,r,a,i)}).fail(function(){u(null,r,a,i)})},doAction:function(e,t,n){n=s[n];o(t,n,e)},setupEventHandlers:function(e){e.find("a").hover(function(){$(this).parent().addClass("hover")},function(){$(this).parent().removeClass("hover")})},resetMarkers:function(e){$(document).trigger("resetRoutePlanner-contextMenu")}},o=function(e,t,n){var e=$(e.target),o=e.parent(),r=e.detach(),a=this;a.mostRecentLocation=t,o.append(a.toHereFromHereMenuItem||'<div class="btn-group" id="contextMenuToFrom"><button class="btn btn-info" data-type="fromHere">'+resources.FromHere+'</button><button class="btn btn-info" data-type="toHere">'+resources.ToHere+"</button></div>"),a.toHereFromHereMenuItem||(e=o.children().first(),$('[data-type="fromHere"],[data-type="toHere"]',e).on("click",function(e){var t;t=$(this).attr("data-type"),$(document).trigger("locationSelected-contextMenu",[t,a.mostRecentLocation]),n.fadeOut(75)}).css("cursor","pointer")),o.on("mouseleave.atisContextMenu",function(e){a.toHereFromHereMenuItem=o.children().first().detach(),o.append(r),o.off("mouseleave.atisContextMenu"),o.removeClass("hover")})};return n};
2var NewAtisContextMenu=function(r,e){var a,u,n,t,o,s,i={populateMenu:function(e,t,o,n,r){a=n,r('<a class="list-group-item contextPointButton" data-type="fromHere" href="#1">'+resources.FromHere+'</a><a class="list-group-item contextPointButton" data-type="toHere" href="#2">'+resources.ToHere+"</a>",t,o,n)}},c=(i.AddWaypointToContextMenu=function(e){0},i.getNearestLocations=function(e,t,o){var n=16;o&&(n=r.map.zoom),$.ajax("/api/route/getlocations?latitude="+MapComp.lat(e)+"&longitude="+MapComp.lng(e)+"&zoom="+n).done(function(e){t(e||[])}).fail(function(){t(null)})},function(e){u.empty(),l(e);e=$(map.getDiv());t>e.width()-u.width()&&(t-=u.width()),o>e.height()-u.height()&&(o-=u.height()),u.css({top:o,left:t}).fadeIn(300)}),l=function(e){"True"==resources.DisplayLocationsInContextMenu?(u.append(e+"<hr>"),u.append('<li><a href="#resetMarkers">'+resources.StartOver+'</a></li><li><a href="#zoomIn">'+resources.ZoomIn+'</a></li><li><a href="#zoomOut">'+resources.ZoomOut+'</a></li><li><a href="#centerMap">'+resources.CenterHere+"</a></li>")):(u.append(e),u.append('<a href="#resetMarkers" class="list-group-item defaultMenu">'+resources.StartOver+'</a><a href="#zoomIn" class="list-group-item defaultMenu">'+resources.ZoomIn+'</a><a href="#zoomOut" class="list-group-item defaultMenu">'+resources.ZoomOut+'</a><a href="#centerMap" class="list-group-item defaultMenu">'+resources.CenterHere+"</a>")),setUpMenuEventHandlers()},p=(i.setupEventHandlers=function(e){},i.setupEventHandlersold=function(){"True"==resources.DisplayLocationsInContextMenu?u.find("a").click(function(e){e.preventDefault();var t=$(e.target).attr("href").substr(1),o=m(t);if(null!=o){o=s[o];p(e,o)}else switch(u.fadeOut(75),t){case"resetMarkers":$(document).trigger("resetRoutePlanner-contextMenu");break;case"zoomIn":map.setZoom(map.getZoom()+1),map.panTo(n);break;case"zoomOut":map.setZoom(map.getZoom()-1),map.panTo(n);break;case"centerMap":map.panTo(n)}}):$(".defaultMenu").click(function(e){e.preventDefault();var t=$(e.target).attr("href").substr(1),o=m(t);if(null!=o){o=s[o];p(e,o)}else switch(u.fadeOut(75),t){case"resetMarkers":$(document).trigger("resetRoutePlanner-contextMenu");break;case"zoomIn":map.setZoom(map.getZoom()+1),map.panTo(n);break;case"zoomOut":map.setZoom(map.getZoom()-1),map.panTo(n);break;case"centerMap":map.panTo(n)}}),u.find("a").hover(function(){$(this).parent().addClass("hover")},function(){$(this).parent().removeClass("hover")})},function(e,t){var e=$(e.target),o=e.parent(),n=e.detach(),r=this;r.mostRecentLocation=t,o.append(r.toHereFromHereMenuItem||'<div class="btn-group" id="contextMenuToFrom"><button class="btn btn-info" data-type="fromHere">'+resources.FromHere+'</button>
2<button class="btn btn-info" data-type="toHere">'+resources.ToHere+"</button></div>"),r.toHereFromHereMenuItem||(e=o.children().first(),$('[data-type="fromHere"],[data-type="toHere"]',e).on("click",function(e){var t;t=$(this).attr("data-type"),$(document).trigger("locationSelected-contextMenu",[t,r.mostRecentLocation]),u.fadeOut(75)}).css("cursor","pointer")),o.on("mouseleave.atisContextMenu",function(e){r.toHereFromHereMenuItem=o.children().first().detach(),o.append(n),o.off("mouseleave.atisContextMenu"),o.removeClass("hover")})}),m=function(e){try{var t=parseInt(e);return isNaN(t)?null:t}catch(e){return null}};return i.resetMarkers=function(e){$(document).trigger("resetRoutePlanner-contextMenu")},i.doAction=function(e,t,o){$(document).trigger("locationSelected-contextMenu",[1==o?"fromHere":"toHere",{point:{latitude:MapComp.lat(a),longitude:MapComp.lng(a)}}]),$("#mapLocation").is(":visible")&&$(".myRouteBtn").trigger("click"),e.fadeOut(75)},i},NewAtisContextMenuFromErs=function(r,e){var a,t={populateMenu:function(e,t,o,n,r){a=n,r('<a class="list-group-item contextPointButton" data-type="fromHere" href="1">'+resources.FromHere+'</a><a class="list-group-item contextPointButton" data-type="toHere" href="2">'+resources.ToHere+"</a>",t,o,n)},doAction:function(e,t,o){$(document).trigger("locationSelected-contextMenu",[1==o?"fromHere":"toHere",{point:{latitude:MapComp.lat(a),longitude:MapComp.lng(a)}}]),contextMenu.fadeOut(75)},setupEventHandlers:function(e){},getNearestLocations:function(e,t,o){var n=16;o&&(n=r.zoom),$.ajax("/api/route/getlocations?latitude="+MapComp.lat(e)+"&longitude="+MapComp.lng(e)+"&zoom="+n).done(function(e){t(e||[])}).fail(function(){t(null)})}};return t.resetMarkers=function(e){$(document).trigger("resetRoutePlanner-contextMenu")},t};
3$(()=>{$("#setStartGeolocation")[0].addEventListener("focus",()=>{""!==$("#startLocationText").val()&&$("#swapLocationsBtn").focus()}),$("#setEndGeolocation")[0].addEventListener("focus",()=>{""!==$("#endLocationText").val()&&$("#generateRouteBtn").focus()}),$("#generateRouteBtn").keydown(function(t){"Tab"===t.key&&t.shiftKey&&setTimeout(()=>{$("#endLocationText").focus()})}),$("#swapLocationsBtn").keydown(function(t){"Tab"===t.key&&t.shiftKey&&setTimeout(()=>{$("#startLocationText").focus()})})});let RoutePlanner=function(p,t,e){function n(e){e.preventDefault(),u=[];var t=$("#startLocationText").val(),n=$("#endLocationText").val();t.match(/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/g)&&n.match(/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/g)?B([{point:{latitude:t.split(",")[0],longitude:t.split(",")[1]}},{point:{latitude:n.split(",")[0],longitude:n.split(",")[1]}}],e):g.getLocationArray().then(t=>{d(t)?y(!0):!function(t){let e=(t[0].point.latitude||"rand")==t[t.length-1].point.latitude&&(t[0].point.longitude||"rand")==t[t.length-1].point.longitude,n=(t[0].linkId||"rand")==t[t.length-1].linkId;return e||n}(t)?(P(),B(t,e)):(P(resources.StartAndEndLocationCannotBeSame),y(!0))}).catch(()=>P(resources.PleaseCheckStartEndLocation)),MapComp.helpers.closeStreetView(f)}function o(){$(".waypointContainer").hide(),y(),u=[],h="",localStorage.setItem("routeGenerateButton",""),"undefined"!=typeof TransitOptions&&TransitOptions.reset(),g.clearAll(),$("#btnSaveRoute").text(resources.Save),$(document).trigger("routeCleared-routePlanner"),0<$("#Map_Index_RoutePlannerDescription > div").contents().length&&$("#routePlannerDesc").show()}let a={},s=RoutePlannerAutocomplete(p.map,e,window.extraPoi||[]),g=new WaypointManager(p.map,s,t,a),i=new RoutingPolyline(p,t,a,g),f=(MapComp.routePolyline=i,p.map),r=new UserGeolocation(s,g,t,p.map,p),l=new TransitDirections(p,i,document.getElementById("transitRouteResults")),c=new MapFctns,u=[],h="",d=(s.SetupAutoComplete("#startLocationText",g.getLocations()),s.SetupAutoComplete("#endLocationText",g.getLocations()),function(e){for(let t=0;t<e.length;t++)if(!e[t])return 0===t?P(resources.PleaseCheckStartLocation):t===e.length-1?P(resources.PleaseCheckEndLocation):P(resources.PleaseCheckWaypoints),!0;return!1}),y=function(t){i.DeleteAll(),$(".linkIcons").hide(),$("#routeResults").hide(),$("#routeTabContent").empty(),$("#routeTabs").empty(),t||P(),l.Reset()},R=($(document).on("clearRouteView-routePlanner",function(t){y()}),$(document).on("saveRoutePoints",function(){var t={locations:$.map(g.getLocations(),function(t){return t.point}
3),avoidToll:$("#avoidTollsCheckBox").is(":checked")};localStorage.setItem("routeLocations",JSON.stringify(t))}),function(){$(document).trigger("routingFail-routePlanner")}),T=function(){$(document).trigger("routingSuccess-routePlanner")},m=function(t,e,n){$(".waypointContainer").hide(),$("#transitRouteResults").show(),l.Directions(t,e,n),$("#routeResults").trigger("adjustTransitResultsHeight"),P(resources.TransitForImmediateDepartures),$(".linkIcons").show()},v=function(t,n,e,o){let a=t,i;n&&(a=[t[0],n],i=[n,t[1]]),$.ajax("/api/route/getroutes",{type:"POST",data:{Waypoints:a,Options:e},transitHubLocation:n}).done(function(e){if(0<e.length){for(let t=0;t<e[0].waypoints.length&&(1!==t||!n);t++)g.adjustMarker(t,e[0].waypoints[t].point.latitude,e[0].waypoints[t].point.longitude);$(document).trigger("routeGenerated-loginModal")}b(e,!1!==n,n.name),n&&(m(i,o,!0),c.fitMapToRoute(f,t),loadBlockerApi.hideSpinner("calculateDriveTransitRoute")),T()}).fail(function(){R(),P(resources.ErrorRetrievingYourRoute),loadBlockerApi.hideSpinner("calculateDriveTransitRoute")}).always(function(){loadBlockerApi.hideSpinner("calculateRoute")})},k=function(t,e){t.forEach(function(t){t.listenerAdded=!1,google.maps.event.clearListeners(t,e)})};const w=(o,t,a,i,r)=>{o.listenerAdded||(o.listenerAdded=!0,o.addListener("mouseup",function(n){g.getLocationArray().then(t=>{var e;d(t)?(y(),k(a,"mouseup"),loadBlockerApi.hideSpinner("calculateDriveTransitRoute")):(loadBlockerApi.showSpinner("calculateDriveTransitRoute"),e=s.GetCustomSimplePlace(o.title,null,n.latLng.lat(),n.latLng.lng(),!1),v(t,e,i,r),$("#transitRouteResults").addClass("padFix"),k(a,"mouseup"))})}))};let L=function(){var t={};return 0<$("#avoidTollsCheckBox").length&&(t.AvoidTolls=$("#avoidTollsCheckBox").is(":checked")),0<$("#avoidFerriesCheckBox").length&&(t.AvoidFerries=$("#avoidFerriesCheckBox").is(":checked")),t},S=function(t){if("undefined"==typeof TransitOptions)return{};switch(t){case"generateWalkOnlyRouteBtn":TransitOptions.UpdateTransitOptions("WALK");break;case"generateBicycleOnlyRouteBtn":TransitOptions.UpdateTransitOptions("BICYCLE");break;case"generateTransitRouteBtn":TransitOptions.UpdateTransitOptionsFromDropDown()}try{return JSON.stringify(TransitOptions.GetTransitOptions())}catch(t){return{error:t}}};function B(t,e){let n="";CTVars.markerDragEnded&&""!==h?(n=h,CTVars.markerDragEnded=!1):n=(e?.currentTarget?.id?e?.currentTarget:e?.target).id,h=n,e?.currentTarget&&(e.currentTarget.id=n),loadBlockerApi.showSpinner("calculateRoute"),y(),$("#routePlannerDesc").hide(),g.setDetails();var o,a,i,r,s=L(),l=S(n);if(l?.error)loadBlockerApi.hideSpinner("calculateRoute"),RoutePlannerStatus.updateStatus(l.errMsg,RoutePlannerStatus.StatusTypes.danger);else switch(n){case"generateDriveTransitRouteBtn":{var c=t;var u=l;var d=s;u.travelMode="transit",$(".waypointContainer").hide(),loadBlockerApi.hideSpinner("calculateRoute"),$(".routeName").toggle(!1),$("#btnSaveRoute").toggle(!1),f.setZoom(12),f.panTo(new google.maps.LatLng(c[0].point.latitude,c[0].point.longitude)),MapComp.methods.clearAllLegendLayers(),P(resources.DriveTransitHelpText);let o=resources.ParkAndRideLayers.split(","),a=[];o.forEach(function(t){$(document).on("layerRefreshed-iconsAdded."+t,function(t,e,n){-1<o.indexOf(e)&&($(document).off("layerRefreshed-iconsAdded."+e),e=p.appHelper.iconManager.GetIconLayer(e).GetIcons(),a=a.concat(e),e.forEach(t=>w(t,0,a,d,u)))});t=document.querySelector(`#${t} input`),t.checked||t.click(),t=t.parentElement.parentElement;t.dataset.section&&"false"===t.ariaExpanded&&document.querySelector(`[data-target=".collapse.${t.dataset.section}"]`).click()})}break;case"generateTransitRouteBtn":c=t,(r=l).travelMode="transit",m(c,r,!1);break;case"generateWalkOnlyRouteBtn":r=t,(i=l).travelMode="walking",m(r,i,!1);break;case"generateBicycleOnlyRouteBtn":i=t,(a=l).travelMode="bicycling",m(i,a,!1);break;default:a=t,o=s,$("#transitRouteResults").hide(),v(a,!1,o)}}let b=function(e,n,o){if($("#routePlannerDesc").hide(),0==e.length){R();var t=g.getLocations();P(t.length<=2?resources.RouteNotAvailable:resources.RouteNotAvailableWithWaypoints)}else{$(".waypointContainer").show(),$("#routeTabs").show(),$(document).trigger("routeGenerated-routePlanner",[e]),y(!0);for(let t=0;t<e.length;t++)addRouteTab(e[t],t+1,n,o,i);$("#routeTabs a").click(function(t){t.preventDefault(),$(this).tab("show"),i.MakeActive($(this).attr("data-guids")+A("#transitRouteTabs li.active a"))}),i.MakeActive($("#routeTabs a:first").attr("data-guids")+A("#transitRouteTabs li.active a")),$("#routeTabs a:first").tab("show"),$("#routeResults").show(),$("#routeResults").scrollTop(0),0<e[0].waypoints.length&&c.fitMapToRoute(f,e[0].waypoints),$("#routeResults").trigger("adjustRoutePlannerHeight");var a=e[0].enableMapLayers;for(let e in a){let t=$("input[type='checkbox'][data-layerid ="+a[e]+"]",$("#layerSelection"));if(t&&t[0]&&!t[0].checked)t[0].click();else p.appHelper.iconManager.RefreshLayer(a[e],true)}MapComp.helpers.closeStreetView(f),checkEventOnRoutePlanner(),$("#routeTabs a").on("shown.bs.tab",function(){checkEventOnRoutePlanner()}),$(".linkIcons").show()}};function A(t){t=$(t);let e="";return e=null!=t&&t.length&&t!=this?";"+t.attr("data-guids"):e}function C(){var t=0<$("#routeTabs").html().length,e=0<$("#transitRouteResults").html().length;t||e?$(t&&e?"#routeTabContent div.active, #transitRouteResults":t?"#routeTabContent div.active":"#transitRouteResults").printThis():P(resources.NoRouteDetailGenerated,RoutePlannerStatus.StatusTypes.danger)}let P=RoutePlannerStatus.updateStatus,x=function(t,e){e=s.GetSimplePlace(e);e&&g.setLocation(!1,e,!0)},D=(a.SetWaypoint=function(t,e,n){g.setWaypoint(t,Number(e)+1,!0,n)},a.getActiveRouteIndex=function(){var t=$("#routeTabs li.active a").attr("data-id");return isNaN(t)?null:t-1},a.getNameForSimplePlace=function(t,e){g.getNameForSimplePlace(t,e)},a.displayRoutes=function(t){o(),0<t[0].waypoints.length&&(t[0].waypoints[t[0].waypoints.length-1].poiId?(x(null,t[0].waypoints[t[0].waypoints.length].poiId),g.setLocation(!0,t[0].waypoints[0],!0)):g.setAllLocations(t[0].waypoints)),s.SetupAutoComplete("#startLocationText",g.getLocations()),s.SetupAutoComplete("#endLocationText",g.getLocations()),b(t,!1)},a.displayRoute=function(t){a.displayRoutes([t],!1)},{WALK:"generateWalkOnlyRouteBtn",BICYCLE:"generateBicycleOnlyRouteBtn","TRANSIT,WALK":"generateTransitRouteBtn"}),O=(a.displayTransitRoute=function(n){o(),g.setStartEndPoint(new s.GetCustomSimplePlace(n.fromAddress,null,
3n.fromLat,n.fromLong,!1),new s.GetCustomSimplePlace(n.toAddress,null,n.toLat,n.toLong,!1)),g.getLocationArray().then(t=>{var e;d(t)?y():(n.options?(e=JSON.parse(n.options),h=D[e.Mode.value]):(n.options={},n.options.travelMode="transit"),m(t,n.options,!1))}),"undefined"!=typeof TransitOptions&&TransitOptions.SetTransitOptions(n.options)},a.resetRoutePlanner=o,a.calculateRoute=function(t){var e={};e.currentTarget={id:t},e.target={id:t},e.preventDefault=function(){},n(e)},a.clearLoationsWithoutPoints=function(){g.clearLoationsWithoutPoints()},function(t,e,n){var o='<div class="form-group hidden-print" data-waypointparent="'+t+'"><div class="input-group"><label class="sr-only" for="waypointText-'+t+'">'+resources.Waypoint+" "+t+'</label><div class="input-group-addon"><div class="waypointCircle" aria-hidden="true"></div></div><input type="text" class="form-control waypointText" id="waypointText-'+t+'" placeholder="'+resources.Waypoint+'"><div class="input-group-btn"><button class="btn btn-default" id="setWaypointGeolocation-'+t+'" type="button" data-wpId="'+t+'" title="'+resources.MyLocation+'"><i class="far fa-crosshairs" aria-hidden="true"></i><span class="sr-only">'+resources.MyLocation+'</span></button><button class="btn btn-default" aria-label= "'+resources.Remove+'" id="deleteWaypoint-'+t+'" type="button" data-wpId="'+t+'" title="'+resources.Remove+'"><i class="far fa-times"</button></div></div></div>';$("#waypoints").append(o),$("#waypointText-"+t).val(e),$("#deleteWaypoint-"+t).click(function(){var t=$(this).data("wpid");g.ClearWaypoint(t,"lookupGMarker",!0)}),$("#setWaypointGeolocation-"+t).click(function(){var t=$(this).data("wpid");r.AttemptToSetWaypointWithUsersGeolocation(t)}),s.SetupAutoComplete("#waypointText-"+t,g.getLocations(),n)});a.redrawWaypoints=function(t,e){var n=g.getLocations();if(e){e=n.length-1;g.addWaypoint(e),O(e,t,!1)}else{$("#waypoints").html("");for(let t=1;t<n.length-1;t++)O(t,n[t].text,!0);"undefined"!=typeof specialEvent&&specialEvent.method.applyPresetDropdownToNewWaypoints&&setTimeout(specialEvent.method.applyPresetDropdownToNewWaypoints,0)}},a.AddWaypointToPlanner=function(t,e){a.redrawWaypoints(t,e)},$(document).on("UserRouteDropDownVisible",function(){$(".linkRoute").toggle(!0)}),setAllLocations=function(e){g.setStartEndPoint(e[0],e[e.length-1]);for(let t=1;t<e.length-1;++t)O(t,"",!1),g.setWaypoint(e[t],t,!0,!1)};return $(document).ready(function(){var t,e;$("#generateRouteBtn").click(n),$("#generateTransitRouteBtn").click(n),$("#generateDriveTransitRouteBtn").click(n),$("#generateWalkOnlyRouteBtn").click(n),$("#generateBicycleOnlyRouteBtn").click(n),$("#generateRouteBtn").submit(function(t){t.preventDefault()}),$("#generateTransitRouteBtn").submit(function(t){t.preventDefault()}),$("#generateWalkOnlyRouteBtn").submit(function(t){t.preventDefault()}),$("#generateBicycleOnlyRouteBtn").submit(function(t){t.preventDefault()}),$("#generateDriveTransitRouteBtn").submit(function(t){t.preventDefault()}),window.location.hash.indexOf("#route-")<0?(t=localStorage.getItem("routeLocations"))&&(t=JSON.parse(t),setAllLocations(t.locations),t.avoidToll&&($("#avoidTollsCheckBox").prop("checked",!0),$("#routeOptions").click()),$(".myRouteBtn").trigger("click",{skipPtBSetup:!0}),("TRANSIT"===(t=localStorage.getItem("routeGenerateButton"))?$("#generateTransitRouteBtn"):"DRIVETRANSIT"===t?$("#generateDriveTransitRouteBtn"):"WALK"===t?$("#generateWalkOnlyRouteBtn"):"CYCLE"===t?$("#generateBicycleOnlyRouteBtn"):$("#generateRouteBtn")).click(),localStorage.removeItem("routeLocations")):localStorage.removeItem("routeLocations"),$(document).on("resetRoutePlanner-contextMenu",o),$(document).on("setCarpoolDestination.carpoolTooltip",function(t,e,n,o,a){"block"==$(".showSideBar").css("display")&&$(".showSideBar").trigger("click"),g.setLocation(!1,s.GetCustomSimplePlace(o,null,n,e,!1),!0),bootbox.closeMapPageDialog()}),$(document).on("clearRouteButtonClicked.routeSave",urlHash.clearHash),$("#clearRouteBtn").click(function(){o(),$(document).trigger("clearRouteButtonClicked"),$(".clearLocateBtn").trigger("click")}),$(document).on("clearUserRouteTrigger",function(){$("#clearRouteBtn").trigger("click")}),$("#swapLocationsBtn").click(function(e){var t;$("#startLocationText").val()!=$("#endLocationText").val()&&(t=$("#startLocationText").val(),$("#startLocationText").val($("#endLocationText").val()),$("#endLocationText").val(t),g.swapStartEnd(),g.setDetails(),"True"===resources.AutoGenerateDriveRoute)&&g.getLocationArray().then(t=>{null!=t&&n(e)})}),t=$.QueryString.placeId,e=$.QueryString.destination,t?x(null,parseInt(t)):e&&s.Get
3SimplePlaceByTextSearch(e,function(t){t&&g.setLocation(!1,t,!0)}),$(".printRoute").click(C),$(".printRoute").bind("keydown",function(t){13==t.keyCode&&C()}),0<$("#routeNotificationAlert").length&&$(".createRouteAlert .close").on("click",function(){$(".createRouteAlert").hide()}),$("#setStartGeolocation").click(function(){r.AttemptToSetLocationWithUsersGeolocation(!0)}),$("#setEndGeolocation").click(function(){r.AttemptToSetLocationWithUsersGeolocation(!1)}),$("#addWaypointBtn").click(function(){var t=null!=(t=$(".waypointText:last")).html()&&0===t.val().length;t||a.AddWaypointToPlanner(null,!0)}),$(document).on("checkEventOnRoutePlanner",checkEventOnRoutePlanner)}),a};$(document).on("appInitComplete",function(t,e,n){let o;o="true"==resources.DisplayLocationsInContextMenu?new AtisContextMenu(e.map,n):new NewAtisContextMenu(e,n);var a=new ContextMenu(e.map,o),e=RoutePlanner(e,a,n);new UserRoutePlanner(e),$(document).trigger("hashChanged-urlHash"),$(document).trigger("BeforeDisplayRoute")});
4let RoutePlannerAutocomplete=function(e,o,n){function s(e,t,o,n,l,s,c,i){this.name=e,this.placeId=t,this.point={latitude:o,longitude:n},this.isGoogle=l,this.linkId=null,this.streetNumber=s,this.streetName=c,this.postalCode=i}let c={},i=MapComp.methods.routePlannerAutoComplete,r=(n&&$(n).each(function(e,t){t.isGoogle=!1}),i.startServices(o,n),c.GetGoogleLocation=i.setupGetGoogleLocation(s),c.GetLocationDetails=function(t){return t.point?.name===t.text?Promise.resolve(t.point):c.autoCompleteSource(t,t.text).then(e=>{if(0<e.length)return e=e[0],Object.assign(t,e),$(t.selector).val(t.label),i.GetLocationInformation(t,s).then(e=>(t.point=e,t.text=e.name,e))})},c.autoCompleteSource=function(e,t){return!(t=(t||e.text||"").trim())||t.length<resources.AutoCompleteNumCharacters?Promise.resolve($.ui.autocomplete.filter(n,t)):i.autoCompleteSource(e,t,o.RoutingModel.AutoCompleteCountryCode)},c.GetCustomSimplePlace=function(e,t,o,n,l){return new s(e,t,o,n,l)},c.selectHandler=i.setupSelectHandler(s),MapComp.latestSearchSuggestions={},c.SetupAutoComplete=function(n,l,e){var t={locations:l,selector:n};$(n).autocomplete({minLength:resources.AutoCompleteNumCharacters,source:function(t,o){const n=this.locations.find(e=>e.selector==this.selector);c.autoCompleteSource(n,t.term).then(e=>{0<e.length&&(MapComp.latestSearchSuggestions[n.selector]={validText:e[0].label.text,requestTerm:t.term}),o(e)}).catch(r)}.bind(t),select:c.selectHandler.bind(t),open:i.appendGoogleLogoToAutocompleteResults,delay:150}).click(function(){$(this).select()}).attr({"data-exists":"undefined"!=e&&e}),$(n).off("focusout"),$(n).on("focusout",e=>{const t=l.find(e=>e.selector==n);var o=t.point?.name;t.text=$(t.selector).val(),o!==t.text&&t.text&&t.text.length>=resources.AutoCompleteNumCharacters&&c.GetLocationDetails(t).then(()=>{$(document).trigger("locationSelected-autocomplete",t)})})},function(e){console.log(e)});return c};
5var RoutePlannerStatus=new function(){var c={StatusTypes:{info:"alert-info",success:"alert-success",danger:"alert-danger"},updateStatus:function(t,e,o,a,r){var i,s,u,l,n=$("#statusBar"),d=$("#routePlannerDesc"),h=!1;for(i in c.StatusTypes)n.removeClass(c.StatusTypes[i]),e==c.StatusTypes[i]&&(h=!0);n.addClass(h?e:c.StatusTypes.info),0<$("#routeNotificationAlert").length?(s=$(".createRouteAlert"),u=$(".createRouteAlert .msg"),t&&1<t.length?(d.hide(),n.attr("style","display:block;"),n.html(t).show(),o&&a&&(u.html('<i class="fas fa-bell" aria-hidden="true"></i><a href= "/my511/routealert?routeID='+o+'">'+window.resources.CreateAlertLink),window.innerWidth>bp992?(l=$(".sideBarColContainer").width()+40,s.css("left",l+"px")):s.insertAfter("#routingInput #statusBar"),s.show())):(n.text("").hide(),u.html(""),s.hide())):t&&1<t.length?(d.hide(),n.attr("style","display:block;"),n.html(t).show(),o&&a&&("true"===resources.ShowSimplifyRouteNotificationModal?Cookies.get("_hideSimplifyRouteNotificationModal")||($("#subscriberRouteName").attr("data-subscriberRouteId",o).text(r),$(".routeNotificationMsg").show(),$(".doNotShowThisMessageAgain").show(),l="/my511/routealert?routeID="+o,$(".editRouteAlert").attr("href",l),$("#quickRouteNotificationModal").modal("show")):Cookies.get("_hideRouteNotificationModal")||($("#createAlterForRoute").attr("href","/my511/routealert?routeID="+o),$("#routeNotificationModal").modal("show")))):n.text("").hide()}};return c};
6$(document).ready(function(){var e=!0,t=($("ul.nav-tabs > li").hasClass("active")||(t=""===window.location.hash||0<=window.location.hash.indexOf("-")?"#MyRoutes":window.location.hash.replace(":",""),1===(t=$("#MainTabs a[href='"+t+"']")).length?t.tab("show"):0===t.length&&$("#RoutesTab > a").trigger("click")),$("#MainTabs a").click(function(e){e.preventDefault(),$(this).tab("show"),"#MyRoutes"==$(this).attr("href")?window.DisplayMyCameras():"#Alerts"==$(this).attr("href")&&$(document).trigger("checkAlertsTab")}),$("ul.nav-tabs > li > a").on("shown.bs.tab",function(e){e=$(e.target).attr("href").substr(1);window.location.hash=":"+e}),window.location.hash.replace(":","")),a=(setTimeout(function(){$(".twitter-timeline").each(function(){var e=$
6(this).contents().find("head");e.length&&e.append('<style type="text/css">.timeline { max-width: 100% !important; } </style>')})},1e3),0<=t.toLowerCase().indexOf("route")),n=0<=t.toLowerCase().indexOf("camera"),o=0<=t.toLowerCase().indexOf("transitregion"),i=0<=t.toLocaleLowerCase().indexOf("news"),s=0<=t.toLocaleLowerCase().indexOf("alerts"),i=(a||n||o||i||0<=t.indexOf("-")?(e=!1,$("#RoutesTab").hasClass("active")||i||($("#RoutesTab > a").trigger("click"),a=window.location.hash.replace(":",""),n=t.lastIndexOf("#"),o=t.length,t=0===n?t:t.substring(n,o),a.toLowerCase()!==t&&(window.location.hash+=t))):(e=!0,!s&&0<=t.indexOf("#")&&AlertHelper.addAlertText(AlertType.Error,resources.InvalidHashUrl)),$(document).on("contentFiltered",function(){GetAlertContent(e),e=!1}),OrganizeRouting(),document.querySelector(".openInfoTab")),n=null!=document.getElementById("AlertsTab");i&&n&&(i.style.display="block")});
7let RoutingPolyline=function(o,e,d,t){let i={},c=[],x=o.map,r={zIndex:-99,strokeWeight:4,strokeOpacity:1,strokeColor:resources.RoutePolylineColour,defaultStrokeColor:resources.RoutePolylineColour},g=(i.getInactiveRouteClr=()=>MapComp.isDarkMode?"#e8e3e3":"#6A6A6A",i.AddRoute=function(e,o,t,r,n,i,l,a=!1){("string"==typeof e||e instanceof String)&&(e=[e]);var p,u=g();for(p in t=f({...t,defaultStrokeColor:t?.strokeColor}),e){var s=e[p];r&&(t.map=x);polylinePath=a?MapComp.decodeHereFlexiblePolyline(s):MapComp.decodePolyline(s),s={index:p,id:u+"_"+p,pid:u,options:t,isTransit:n,routeNum:l,waypoints:o,polylinePath:polylinePath,addWaypoint:({latLng:e,lineIndex:o})=>{e={point:MapComp.getLatLngObj({latLng:e})};d.getNameForSimplePlace(e,function(e){d.clearLoationsWithoutPoints(),d.SetWaypoint(e,o,!1),d.AddWaypointToPlanner(e.name,!1),"True"!==resources.AutoGenerateDriveRoute&&d.calculateRoute()})},polylineInfoArray:i,draggableRoutesEnabled:!n},c.push(s)}return u},i.getRoutePolylineObjById=function({id:o}){var e=c.findIndex(e=>e.id===o);return-1!==e?c[e]:void 0},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var o=16*Math.random()|0;return("x"===e?o:3&o|8).toString(16)})}),f=function(e){var o=JSON.parse(JSON.stringify(r));return e&&(o.zIndex=e.zIndex||o.zIndex,o.strokeWeight=e.strokeWeight||o.strokeWeight,o.strokeOpacity=e.strokeOpacity||o.strokeOpacity,o.strokeColor=e.strokeColor||o.strokeColor,o.defaultStrokeColor=e.defaultStrokeColor||o.defaultStrokeColor),o},l=(i.HideAll=function(){for(var e in o.appHelper.closeInfoWindow(),c)MapComp.clearRouteLines(c[e])},i.ShowAll=function(){var e,o={};for(e in c)o[c[e].id]=c[e].polylinePath,MapComp.createRouteLine({...c[e],index:e});MapComp.fitRoutesOnMap({allLines:o})},"");return i.DeleteAll=function(){i.HideAll(),c=[],MapComp.transitColours.light=[],MapComp.transitColours.dark=[],l=""},i.Delete=function(o){var e=$.grep(c,function(e){return e.pid==o});if(0<e.length){for(var t of e)t.polyline.setMap(null);c=$.grep(c,function(e){return e.pid==o},!0)}},i.MakeActive=function(e){var o,t=(l=e).split(";");for(o in c){c[o].polylinePath;c[o].draggableRoutesEnabled=!c[o].isTransit&&"True"===resources.DraggableRoutesEnabled&&window.innerWidth>bp992;var r={zIndex:2,strokeWeight:3.5,strokeColor:c[o].options.defaultStrokeColor,draggable:c[o].draggableRoutesEnabled},n={zIndex:1,strokeWeight:3,strokeColor:i.getInactiveRouteClr(),draggable:!1};-1<t.indexOf(c[o].pid)?c[o]={...c[o],isActive:!0,options:{...c[o].options,...r}}:c[o]={...c[o],isActive:!1,options:{...c[o].options,...n}}}i.ShowAll()},i.repaint=()=>{var t,e;!function(){let o=!0;return c.forEach(e=>{e.isTransit||(o=!1)}),o}()||(e=MapComp.transitColours[MapComp.isDarkMode?"dark":"light"],MapComp.updateTransitColours(c,e),t=e,(e=Array.from(document.querySelectorAll(".directionStep"))).length===t.length?e.forEach((e,o)=>{e.style.borderColor=t[o]}):console.error("could not update Direction Step Line colour")),0!==l.length&&i.MakeActive(l)},i};
8MapComp.transitColours={light:[],dark:[]};var TransitDirections=function(p,g,f){var t={},R=null,h=new MapFctns;const m={WALK:"#2f9762",TRANSIT:"#9e32b9",BICYCLE:"#0088b7"}
8,y={"#ffffff":"#00BFFF","#cae4f1":"#FF00FF"};function s(t,a,r){if($(f).html(a.summaryHtml),a.polyline&&0<a.polyline.length){for(let e=0;e<a.polyline.length;e++)for(let t=0;t<a.polyline[e].length;t++){var o=a.polyline[e][t],n=o.polyline,s={strokeWeight:4,strokeOpacity:1,strokeColor:m[o.travel_mode]||m.TRANSIT,zIndex:2};if("WALK"===o.travel_mode)s.strokeColor=m.WALK;else if(o.transit_details){let t=o.line_color;t&&!t.startsWith("#")&&(t="#"+t),t=(i=t,u=void 0,i?(u=i.toLowerCase(),y[u]||i):null),s.strokeColor=t||y["#ffffff"]}s.strokeColor=(u=void 0,u=function(t){t.startsWith("#")&&(t=t.slice(1));var e=parseInt(t.substring(0,2),16),a=parseInt(t.substring(2,4),16),t=parseInt(t.substring(4,6),16);e=255-e,a=255-a,t=255-t;var r=t=>{t=t.toString(16);return 1===t.length?"0"+t:t};return"#"+r(e)+r(a)+r(t)}(i=s.strokeColor),MapComp.transitColours.light.push(i),MapComp.transitColours.dark.push(u),MapComp.isDarkMode?u:i),R=g.AddRoute(n,null,s,0===e,!0,[o.infoWindowInformation],e+1,"here"===o.type),r&&!$("#transitRouteTabs").length&&$("#routeTabs a").each(function(){$(this).attr("data-guids",$(this).attr("data-guids")+";"+R)},[R]),$("#transitRouteTabs").length&&(n=$("#transitRouteTabs :nth-child("+(e+1)+") a")).attr("data-guids",R+";"+n.attr("data-guids"));o=document.getElementsByClassName("directionStep");o[t]&&(o[t].style.borderColor=s.strokeColor)}g.ShowAll(),r||h.fitMapToRoute(p.map,t)}var i,u,e,t=Array.isArray(a.enableMapLayers)?a.enableMapLayers:[],l=Array.isArray(a.disableMapLayers)?a.disableMapLayers:[];for(const c of t)(e=$("input[type='checkbox'][data-layerid = "+c+"]",$("#layerSelection"))).length&&(e[0].checked=!0);for(const d of l)(e=$("input[type='checkbox'][data-layerid = "+d+"]",$("#layerSelection"))).length&&(e[0].checked=!1);$("#routeResults").show(),$("#transitRouteTabs").length&&($("#transitRouteTabs a").click(function(t){t.preventDefault(),$(this).tab("show"),g.MakeActive($(this).attr("data-guids")+S("#routeTabs li.active a"))}),$("#transitRouteTabs a:first").tab("show"),g.MakeActive($("#transitRouteTabs a:first").attr("data-guids")+S("#routeTabs li.active a"))),$("#routeResults").scrollTop(0),$("#routeResults").trigger("adjustRoutePlannerHeight"),$(".startPoint").text(a.waypoints[0].nameDirection),$(".endPoint").text(a.waypoints[a.waypoints.length-1].nameDirection),r&&$("#routeTabs a").each(function(){var t,e,a=+$(this).attr("data-travelTimeInSeconds")+ +$("#transitTimeInSeconds").val();$(this).find(".badge").text((a=a,t=Math.floor(a/3600),(e=Math.floor((a-3600*t)/60))<1&&0<a-3600*t-60*e&&(e=1),0<t?t+" "+window.resources.Hr+" "+e+" "+window.resources.Min:e+" "+window.resources.Min))})}function S(t){var t=$(t),e="";return e=null!=t&&t.length&&t!=this?";"+t.attr("data-guids"):e}return t.Reset=function(){g.Delete(R),$(f).html(null)},t.Directions=function(r,o,n){$.ajax("/map/GetTransitRoute",{type:"POST",data:{Waypoints:r,travelMode:o.travelMode||o}}).done(function(t){"OK"==t.status?(n?$(document).trigger("driveTransitRouteGenerated-routePlanner",[t]):$(document).trigger("transitRouteGenerated-routePlanner",[t]),s(r,t,n),e={walking:"walking",bicycling:"bicycle",transit:"bus"},(a=document.getElementById("transitRouteResults").getElementsByTagName("i")[0])&&(a.className="far fa-"+e[o.travelMode]+" fa-2x",a.setAttribute("title",e[o.travelMode]))):n?($(document).trigger("clearRouteView-routePlanner"),RoutePlannerStatus.updateStatus(window.resources.DriveAndTransitRouteNotAvailable)):"ZERO_RESULTS"==t.status||"NO_ROUTES"==t.status||"NOT_FOUND"==t.status||"PATH_NOT_FOUND"==t.status?($(document).trigger("clearRouteView-routePlanner"),RoutePlannerStatus.updateStatus(window.resources.RouteNotAvailable)):"OUTSIDE_BOUNDS"==t.status?($(document).trigger("clearRouteView-routePlanner"),RoutePlannerStatus.updateStatus(window.resources.AreaNotCovered)):($(document).trigger("clearRouteView-routePlanner"),RoutePlannerStatus.updateStatus(window.resources.ErrorRetrievingYourRoute,RoutePlannerStatus.StatusTypes.danger));var e,a=Array.from(document.getElementsByClassName("substeps"));a.forEach(t=>{arrowDirection.setTransitSubstepImg(t)}),0==a.length&&Array.from(document.getElementsByClassName("directionStep")).forEac
8h(t=>{arrowDirection.setStepImg(t)})}).fail(function(){$(document).trigger("clearRouteView-routePlanner"),RoutePlannerStatus.updateStatus(window.resources.ErrorRetrievingYourRoute,RoutePlannerStatus.StatusTypes.danger),loadBlockerApi.hideSpinner("calculateDriveTransitRoute")}).always(function(){loadBlockerApi.hideSpinner("calculateRoute")})},t.SaveRoute=function(t,e){$.ajax("/map/SaveTransitRoute",{type:"POST",data:{Waypoints:t}}).done(function(t){}).fail(function(){$(document).trigger("clearRouteView-routePlanner"),RoutePlannerStatus.updateStatus(window.resources.ErrorRetrievingYourRoute,RoutePlannerStatus.StatusTypes.danger),loadBlockerApi.hideSpinner("calculateDriveTransitRoute")}).always(function(){loadBlockerApi.hideSpinner("calculateRoute")})},t};
9var UserRoutePlanner=function(i){function o(){if(window.atisUserRoutes){var e,t=$(".atisUserDdVals");for(e in t.empty(),window.atisUserRoutes)t.append($('<li role="presentation">').append($('<a role="menuitem" tabindex="-1" href="">').attr("data-id",e).text(window.atisUserRoutes[e].routeName)))}$(document).trigger("dropdownPopulated-userRoutePlanner")}var u=null,d=$("#btnSaveRoute"),a=$(".routeName"),l=$("#routeName",a),c=null,r=null,t=null,s=function(){var e=$
9(".atisUserDd");$(".btn .atisUserDdBtnText",e).text(t).removeAttr("data-id")},n=!1;function p(e){var t;0<$("#btnSaveRoute").length&&(n=e,(t=$("#btnSaveRoute")[0]).disabled=e,t.classList.toggle("disabled",e))}var e,g,R=function(e){null!=e&&0<e.length&&(0<=e.indexOf("-")?(loadBlockerApi.showSpinner("loadSavedRoute"),$.ajax("/Api/Route/GetRouteByShareID?shareId="+e,{type:"POST"}).done(function(e){e?1==e.isTransit?i.displayTransitRoute(e):(i.displayRoute(w(e)),i.redrawWaypoints(!1)):(i.resetRoutePlanner(),RoutePlannerStatus.updateStatus(resources.SorryUnableToFetchRoute))}).fail(function(){RoutePlannerStatus.updateStatus(resources.SorryUnableToFetchRoute)}),loadBlockerApi.hideSpinner("loadSavedRoute")):window.location.href="my511/login?ReturnUrl=/map%23route-"+e)},S=function(e){var t,n=-1;for(t in window.atisUserRoutes=window.atisUserRoutes||[],window.atisUserRoutes)(window.atisUserRoutes[t].shareId==e.shareId||window.atisUserRoutes[t].routeName==e.routeName)&&(window.atisUserRoutes[t]=e,n=t);-1==n&&(window.atisUserRoutes.push(e),n=window.atisUserRoutes.length-1),s(),o(),$('.atisUserDd li a[data-id="'+n+'"]').click()},h=function(e){var t=urlHash.hash();return e||t&&0==t.toLowerCase().lastIndexOf("route-",0)?(t="route-{0}".replace("{0}",e||""),e?urlHash.hash(t):e=(e=urlHash.hash()).substring(e.indexOf("-")+1),e):null},f=function(){if(r&&r.shareId){let e=!1;bootbox.dialog({title:resources.LinkToYourRoute,message:`<input class="form-control linkToRoute" value="${window.location.protocol}//${window.location.host}/map#route-${r.shareId}"/> 
10                          <p class="copyRouteLink">${resources.CopyFromBrowserText}</p>
11                          <p class="copyRouteLinkFeedback">${resources.LinkCopied}</p>`,buttons:{copyBtn:{label:resources.CopyLink,className:"btn btn-info",callback:function(){return e||(e=!0,navigator.clipboard.writeText(document.querySelector(".linkToRoute").value),$(".copyRouteLinkFeedback").fadeIn(500).delay(500).fadeOut(1e3),setTimeout(()=>{e=!1},2e3)),!1}}}}).find('[data-bb-handler="copyBtn"]').attr("data-testid","linkRouteCopyBtn")}else RoutePlannerStatus.updateStatus(resources.SelectRouteFromDropdownText,RoutePlannerStatus.StatusTypes.danger)},m=function(e,t){e.statistics&&e.statistics.date&&new Date-e.statistics.date<6e4?t(e.statistics):$.ajax("/Api/Route/GetUserRouteStatistics?segmentId="+e.segmentId,{type:"POST"}).done(function(e){e.date=new Date,t(e)}).fail(function(){t(null)})},v=function(e){var t,n=null;for(t in window.atisUserRoutes){if(window.atisUserRoutes[t].shareId==e){n=t;break}if(window.atisUserRoutes[t].segmentId==e){n=t;break}}return n},w=function(e){var t={};return t.segmentId=e.segmentId,t.routeName=e.routeName,t.encodedPolyline=e.encodedPolyline,t.includesTollLink=e.includesTollLink,t.includesFerryLink=e.includesFerryLink,t.allLinks=e.allLinks,t.statistics=e.statistics,t.shareId=e.shareId,t.cacheId=e.cacheId,t.instructions=e.instructions,t.saveable=e.saveable,t.waypoints=y(e.encodedMarkers),t},y=function(e){var t=[];if(e){e=JSON.parse(e);for(var n=0;n<e.length;n++){var o=e[n],a={};a.linkId=o.location.LinkId,a.name=a.nameDirection=o.location.Name,a.isForward=o.location.IsForward,a.poiId=o.location.PoiId,a.point={latitude:o.lat,longitude:o.lng},t.push(a)}}return t},I=function(e,t){var n={},o=u;return n.shareId=o.shareId,n.routeName=e,n.fromAddress=o.waypoints[0].name,n.fromLat=o.waypoints[0].point.latitude,n.fromLong=o.waypoints[0].point.longitude,n.toAddress=o.waypoints[o.waypoints.length-1].name,n.toLat=o.waypoints[o.waypoints.length-1].point.latitude,n.toLong=o.waypoints[o.waypoints.length-1].point.longitude,n.options=t,n},T=function(e,t){var n={},t=u[t];return n.cacheId=t.cacheId,n.segmentId=t.segmentId,n.routeName=e,n.encodedPolyline=t.encodedPolyline,n.encodedMarkers=function(e){for(var t=[],n=0;n<e.length;n++){var o=e[n];var a={};var s=n==0?"A":n==e.length-1?"B":"W";a.lat=o.point.latitude;a.lng=o.point.longitude;a.letter=s;a.location={Name:o.nameDirection==null?o.name:o.nameDirection,X:o.point.longitude,Y:o.point.latitude,LinkId:o.linkId,IsForward:o.isForward,Letter:s,PoiId:o.poiId};t.push(a)}return JSON.stringify(t)}(t.waypoints),n.includesTollLink=t.includesTollLink,n.includesFerryLink=t.includesFerryLink,n.lengthMeters=t.statistics.lengthMeters,n.postedTravelTimeSeconds=t.statistics.postedTravelTimeSeconds,n.subscriberRouteId=t.subscriberRouteId,n.shareId=t.shareId,t.statistics.instructions&&(n.instructions=t.statistics.instructions),n.previousTransitShareId=u.shareId,t.statistics.travelTime&&(n.currentTravelTimeSeconds=t.statistics.travelTime.seconds),n};if($(document).on("routeCleared-routePlanner.routeSave routingFail-routePlanner.routeSave driveTransitRouteGenerated-routePlanner.routeSave",function(e){r=u=null,a.toggle(!1),d.toggle(!1),l.val(null),s()}),$(document).on("clearRouteButtonClicked",function(e){c=null,p(!1)}),$(document).on("transitRouteGenerated-routePlanner.routeSave",function(e,t){"true"===resources.SaveTransit?(u=t,r&&(u.shareId=r.shareId),c="transit",a.toggle(!0),l.focus(),d.toggle(!0)):(a.toggle(!1),d.toggle(!1))}),$(document).on("routeGenerated-routePlanner.routeSave",function(e,t){var n=null!=u&&u.length&&u[0].segmentId?u[0].segmentId:null;c="drive",u=t,r&&(u.shareId=r.shareId),$(u).each(function(e,t){t.statistics.date=new Date}),n&&$(u).each(function(e,t){t.segmentId=n}),a.toggle(!0),l.focus(),!1===u[0].saveable?(d.toggle(!1),a.toggle(!1)):(d.toggle(!0),a.toggle(!0),l.focus())}),$(document).on("hashChanged-urlHash",function(e,t){var n=h(),o=null;n&&(o=v(n))?($('.atisUserDd li a[data-id="'+o+'"]').click(),d.text(resources.Update)):n&&(R(n),d.text(resources.Save))}),$(document).on("dropdownPopulated-userRoutePlanner",function(){var e=null!=window.atisUserRoutes&&0<window.atisUserRoutes.length;$(".atisUserDd").toggle(e),e&&$(document).trigger("UserRouteDropDownVisible")}),d.on("click.routeSave",function(e){var t=(t=l.val()||"").trim();if(RoutePlannerStatus.updateStatus(),t)if(loadBlockerApi.showSpinner("saveRoute"),"transit"==c){var n="";if("undefined"!=typeof TransitOptions){var o=TransitOptions.GetTransitOptions();try{n=JSON.stringify(o)}catch(e){n=o}}var a=I(t,n);$.ajax("/My511/SaveTransitRoute",{data:a,type:"POST"}).done(function(e){a.shareId=e.shareId,a.isTransit=!0,$(document).one("transitRouteGenerated-routePlanner.routeSave-msg",function(){RoutePlannerStatus.updateStatus(resources.YourRouteHasBeenSaved,RoutePlannerStatus.StatusTypes.success)}),S(a),d.text(resources.Update)}).fail(function(){RoutePlannerStatus.updateStatus(resources.SorryErrorSavingRoute)}).always(function(){loadBlockerApi.hideSpinner("saveRoute")})}else{var s=d.text()===resources.Save,r=i.getActiveRouteIndex(),a=T(t,r);
11$.ajax("/Api/Route/SaveUserRoute",{data:a,type:"POST"}).done(function(e){a.segmentId=e.segmentId,a.allLinks=e.allLinks,a.statistics=u[r].statistics,a.subscriberRouteId=e.subscriberRouteId,a.shareId=e.shareId,$(document).one("routeGenerated-routePlanner.routeSave-msg",function(){RoutePlannerStatus.updateStatus(resources.YourRouteHasBeenSaved,RoutePlannerStatus.StatusTypes.success,a.subscriberRouteId,s,a.routeName)}),S(a),d.text(resources.Update)}).fail(function(e){if(400==e.status){for(var t="",n=0;n<e.responseJSON.length;n++)t+=e.responseJSON[n].errorMessage+"<br>";RoutePlannerStatus.updateStatus(t)}else RoutePlannerStatus.updateStatus(resources.SorryErrorSavingRoute)}).always(function(){loadBlockerApi.hideSpinner("saveRoute")})}else RoutePlannerStatus.updateStatus(resources.PleaseEnterRouteNameToSave);return!1}),$(".linkRoute").click(f),$(".linkRoute").bind("keydown",function(e){13==e.keyCode&&f()}),document.querySelector("#routeName")){let t=document.querySelector("#statusBar");document.querySelector("#routeName").addEventListener("input",e=>{e.target.value.length>parseInt(resources.RouteNameLengthLimit)&&!n?($("#routeNameTooLong").show(),p(!0)):e.target.value.length<=parseInt(resources.RouteNameLengthLimit)&&n&&($("#routeNameTooLong").hide(),p(!1)),"none"!==t.style.display&&(t.style.display="none")}),document.querySelector(".atisUserDdVals").addEventListener("click",e=>{$("#routeNameTooLong").hide()})}return"undefined"!=typeof TransitOptions&&TransitOptions.init(),d.length&&(d.toggle(!1),a.toggle(!1),l.attr("placeholder",resources.EnterRouteNameToSave),e=$(".atisUserDd"),g=$(".btn .atisUserDdBtnText",e),t=g.text(),e.on("click","li a",function(e){var t,n,o,a=$(this),s=a.attr("data-id");(r=window.atisUserRoutes[s]).isTransit?(t=r.routeName,h((n=r).shareId),i.displayTransitRoute(r),r=n,l.val(t),g.text(a.text()).attr("data-id",s),d.text(resources.Update)):(loadBlockerApi.showSpinner("loadSavedRoute"),o=w(r),m(o,function(e){e?(r.statistics=e,o.statistics=e,i.displayRoute(o),r=window.atisUserRoutes[s],h(o.shareId),setTimeout(function(){g.text(a.text()).attr("data-id",s),u=[o],l.val(o.routeName)},0)):(i.resetRoutePlanner(),RoutePlannerStatus.updateStatus(resources.SorryUnableToFetchRoute)),i.redrawWaypoints(!1),loadBlockerApi.hideSpinner("loadSavedRoute"),d.text(resources.Update)})),e.preventDefault()}),o()),{}};
12let addRouteTab = function (route, id, isTransit, hubName, routePolyline) {
13    //reference to route statistics.
14    let routeStats = route.statistics;
15    let useRouteClosureDisclaimer = resources.EnableRouteClosureDisclaimer == "True" && route.statistics.includesClosures;
16    let useRouteConditionDisclaimer = resources.EnableRouteConditionDisclaimer == "True" && route.statistics.includesRouteConditions;
17    let options = useRouteClosureDisclaimer ? { strokeColor: '#FF0000' } : null;
18    //add route polyline.
19    let guid = routePolyline.AddRoute(route.encodedPolyline, route.waypoints, options, false, isTransit);
20
21    let fromLocation = '';
22    let endLocation = '';
23    if (route.waypoints.length > 1) {
24        fromLocation = route.waypoints[0].nameDirection;
25        endLocation = route.waypoints[route.waypoints.length - 1].nameDirection;
26    }
27
28    let withDisclaimerClass = useRouteClosureDisclaimer || useRouteConditionDisclaimer ? 'withDisclaimer' : '';
29    //Add the route tab. // We add transit to the beginning of the id so that we don't confuse the tabs when we do drive+transit
30    $('#routeTabs').append('<li class=\'routeTabHeader ' + withDisclaimerClass + '\' role=\'presentation\'><a href=\'#' + (isTransit ? 'transit' : '') + 'routeTab-' + id + '\' data-id=\'' + id + '\' data-guids=\'' + guid + '\' data-travelTimeInSeconds=\'' + routeStats.postedTravelTimeSeconds + '\'>' + resources.Route + ' ' + id + '  <span class=\'badge\'>' + routeStats.travelTimeDisplay + '</span></a></li>');
31    let html = '';
32
33    if (useRouteClosureDisclaimer || useRouteConditionDisclaimer) {
34        //first, we put a notification at the top of the tab.
35        html += '<div id="routeIncludesDisclaimerDiv' + id + '" class="alert alert-danger" role="alert">';
36        if (useRouteClosureDisclaimer) {
37            if (useRouteConditionDisclaimer) {
38                html += '<p>' + resources.RouteIncludesClosuresAndConditionsDisclaimer + '</p>';
39            } else {
40                html += '<p>' + resources.RouteIncludesClosuresDisclaimer + '</p>';
41            }
42        } else {
43            html += '<p>' + resources.RouteIncludesConditionsDisclaimer + '</p>';
44        }
45
46        html += '<button id="acceptRouteDisclaimerBtn' + id + '" type="button" class="btn btn-info">' + resources.OK + '</button>'
47            + '</div >';
48
49        //then we add a div with opacity over the whole thing
50        html += '<div class="hideRouteTab' + id + '" style="opacity: .10;">';
51    }
52
53    //Add the route details.
54    html += '<div class=\'panel panel-default routeContent ' + withDisclaimerClass + '\'><h3 class=\'printHeader\'>'
55        + resources.SiteHeader + ' ' + resources.RouteDetails
56        + '</h3><div class=\'panel-body\'><i class=\'far fa-car fa-2x\'></i><span class=\'printToFrom\'>'
57        + resources.From
58        + ' '
59        + fromLocation
60        + ' '
61        + resources.To
62        + ' '
63        + endLocation
64        + '</span><p><b>'
65        + resources.TotalTime
66        + ' <span class=\'pull-right\'> '
67        + routeStats.travelTimeDisplay + '</span></b><br />';
68
69    html += '<b>' + resources.TotalTravelDistance + ' <span class=\'pull-right\'> ' + routeStats.lengthDisplay + '</span></b></p>';
70
71    // route info msg for Tolls, Ferries and Closures combination
72    let text = [];
73    if (route.includesTollLink) {
74        text.push(resources.Tolls.toLowerCase());
75    }
76    if (route.includesFerryLink) {
77        text.push(resources.Ferries.toLowerCase());
78    }
79
80    let infoText = "";
81    if (text.length == 2) {
82        infoText = text[0] + " " + resources.And + " " + text[1];
83    } else if (text.length == 1) {
84        infoText = text[0];
85    }
86
87    if (text.length > 0) {
88        html += '<div class="route-alert"><i class="fas fa-exclamation-triangle" aria-hidden="true"></i> '
89            + resources.ThisRouteIncludes + " " + infoText
90            + '.</div>';
91    }
92
93    html += '</div>';
94    html += '<ul class=\'list-group\'>';
95
96    if (hubName) {
97        hubName = ' (' + hubName + ')';
98    } else {
99        hubName = '';
100    }
101
102    if (routeStats.instructions) {
103        for (let j = 0; j < routeStats.instructions.length; j++) {
104            let step = routeStats.instructions[j];
105            let arrowImg = arrowDirection.getDriveImg(step.instruction);
106            html += '<li class="list-group-item">';
107            if (step.linkConditions && step.linkConditions.length > 0) {
108                // draw border around RC colors that are hard to see like white. 
109                html += '<div class="vLineBorder"></div>';
110            }
111            html += '<div class="directionArrow">' + arrowImg +
112                '</div><div ' + applyWTAStyling(step.linkConditions) +
113                '>' + step.instruction +
114                linkEventsHtml(step.linkEvents, id, j) +
115                linkCamerasHtml(step.linkCameras, id, j) +
116                linkWtaHtml(step.linkConditions) +
117                '</div></li>';
118        }
119    } else {
120        for (let j = 0; j < routeStats.links.length; j++) {
121            if (j == routeStats.links.length - 1) {
122                //Last link.
123                html += '<li class=\'list-group-item\'><b>' + routeStats.links[j].nameDirection + hubName + '</b><br/>' + routeStats.links[j].travelTimeDisplay + ' (' + routeStats.links[j].lengthDisplay + ')' + linkEventsHtml(routeStats.links[j].linkEvents, id, j) + linkCamerasHtml(routeStats.links[j].linkCameras, id, j) + '</li>';
124            } else {
125                html += '<li class=\'list-group-item\'><b>' + resources.From + ' ' + routeStats.links[j].nameDirection + ' ' + resources.To + ' ' + routeStats.links[j + 1].nameDirection + '</b><br/>' + routeStats.links[j].travelTimeDisplay + ' (' + routeStats.links[j].lengthDisplay + ')' + linkEventsHtml(routeStats.links[j].linkEvents, id, j) + linkCamerasHtml(routeStats.links[j].linkCameras, id, j) + '</li>';
126            }
127        }
128    }
129    html += '</ul></div>';
130
131    if (useRouteClosureDisclaimer || useRouteConditionDisclaimer) {
132        html += '</div>'
133    }
134
135    let notes;
136
137    if (route.includesFerryLink || resources.OutsideONTTDistanceTravelPortions !== '') {
138        notes = `<div class="routeNotes">
139                        <p>${resources.Notes}</p>
140                        <ul>
141                            <li>${resources.AllTravelTimesBasedOnEstimates}</li>
142                            ${resources.OutsideONTTDistanceTravelPortions !== '' ? '<li>' + resources.OutsideONTTDistanceTravelPortions + '</li>' : ''}
143                            ${route.includesFerryLink ? '<li>' + resources.FerryNote + '</li> ' : ''}   
144                        </ul>
145                     </div> `;
146    } else {
147        notes = `<p class="routeNote"><b>${resources.NoteColon}</b> ${resources.AllTravelTimesBasedOnEstimates}</p>`;
148    }
149
150    // We add transit to the beginning of the id so that we don't confuse the tabs when we do drive+transit
151    $('#routeTabContent').append('<div id="' + (isTransit ? 'transit' : '') + 'routeTab-' + id + '" data-id="' + id + '" class="routeTab tab-pane fade">' + html + notes + '</div>');
152
153
154    $("#cameraRouteToggle" + id + " , #eventRouteToggle" + id).on("click", function () {
155        let id = $(this).data("id");
156        $("i[id='" + id + "circle'").toggleClass('fa-plus-circle fa-minus-circle');
157        $("div[id='" + id + "div'").toggle(400);
158        if (this.className == "eventRouteToggle") {
159            let hasShowMore = $(this).parent().find(".showMore").length > 0;
160            if (!hasShowMore) {
161                checkEventOnRoutePlanner(this);
162            }
163        }
164    });
165    $('#acceptRouteDisclaimerBtn' + id).on('click', function () {
166        $(".hideRouteTab" + id).css({ "opacity": "1" });
167        $("#routeIncludesDisclaimerDiv" + id).hide();
168    });
169};
170
171let linkCamerasFormat = null;
172let linkCamerasHtml = function (cameras, tabId, rowId) {
173    if (!cameras || !cameras.length) {
174        return '';
175    }
176
177    let sectionId = cameras[0].id + tabId + rowId;
178
179    if (!linkCamerasFormat) {
180        linkCamerasFormat = '<div class="route-tooltip routeLinkCamera"><p><img src="{IconURL}" alt="{Name}">&nbsp;<button onclick=\'routeViewOnMap("Cameras","Cameras-{Id}")\' class="cctv-link">{Name}</button></p></div>';
181    }
182
183    let text = '';
184    for (let i in cameras) {
185        text += linkCamerasFormat.replaceAll('{Name}', cameras[i].displayName).replaceAll('{Id}', cameras[i].id).replaceAll('{IconURL}', cameras[i].icon.svgUrl);
186    }
187
188    if (cameras.length > 1) {
189        let prepend = '<div class="cameraRouteSection"><button id="cameraRouteToggle' + tabId + '" class="cameraRouteToggle" data-id="' + sectionId + '" data-toggle="collapse" title="Toggle" aria-expanded="true" class="">' + resources.Cameras + ' <span class="badge">' + cameras.length + '</span><i id="' + sectionId + 'circle" class="far fa-plus-circle"></i></button><div id="' + sectionId + 'div" class="routeCameras" style="display:none;">';
190        let append = '</div>';
191        text = prepend + text + append;
192    }
193
194    return text;
195};
196
197let getTemplateText = function (hideLink) {
198
199    return `<div class="route-tooltip routeLinkEvent">
200                <button onclick="routeViewOnMap('{viewLink}','{layerId}')" class="routeViewOnMap" ${hideLink ? 'style="display: none;"' : ''}">
200${resources.ViewOnMap}</button>
201                <h4><img src="{iconUrl}" alt="{heading}">&nbsp;{heading}</h4>
202                <div class="text">{text}</div>
203            </div>`;
204}
205
206let linkEventsHtml = function (events, tabId, rowId) {
207    //no events on this link.
208    if (!events || !events.length || typeof SpecialEventData !== 'undefined') {
209        return '';
210    }
211
212    let mapLegend = document.querySelector(".mapLegend");
213
214    //the text we will return.
215    let text = '';
216
217    for (let idx in events) {
218        let attrsText = '';
219
220        //build the attributes html.
221        for (let infoIdx in events[idx].orderedPiecesOfInfo) {
222            if (events[idx].orderedPiecesOfInfo[infoIdx].title == resources.Description) {
223                // remove extra spaces
224                let content = events[idx].orderedPiecesOfInfo[infoIdx].text.trim().replace(/\s\s+/g, ' ');
225                content = content.replace(" .", ".");
226                let modHtml = '<div class="shorten">';
227                modHtml += content;
228                modHtml += '</div>';
229                attrsText += getTemplateText(!mapLegend.querySelector(`input[data-layerid=${events[idx].urlFriendlyName}]`))
230                    .replaceAll('{text}', modHtml);
231            }
232        }
233        //build the overall html.
234        text += attrsText.replaceAll('{iconUrl}',
235            events[idx].icon.svgUrl).replaceAll('{heading}',
236                events[idx].heading).replaceAll('{viewLink}',
237                    events[idx].urlFriendlyName).replaceAll('{layerId}',
238                        events[idx].urlFriendlyName + "-" + events[idx].mapId);
239    }
240
241    if (events.length > 1) {
242        let sectionId = events[0].eventId + tabId + rowId;
243        let prepend = '<div class="eventRouteSection"><button id="eventRouteToggle' + tabId + '" class="eventRouteToggle" data-id="' + sectionId + '" data-toggle="collapse" title="Toggle" aria-expanded="true" class=""> ' + resources.Events + '<span class="badge">' + events.length + '</span><i id="' + sectionId + 'circle" class="far fa-plus-circle"></i></button><div id="' + sectionId + 'div" class="routeEvents" style="display:none;">';
244        let append = '</div></div>';
245        text = prepend + text + append;
246    }
247
248    return text;
249};
250
251let linkWtaHtml = function (conditions) {
252    if (!conditions || !conditions.length) {
253        return '';
254    }
255    let format = '<div class="route-tooltip routeLinkEvent">';
256    format += '<h4><img class="notMarker" src="/Content/Images/ic_wta.svg" alt="' + resources.RoadConditions + '">' + resources.RoadConditions + '</h4>';
257    format += '<ul class="wtaInfo">';
258
259    let uniqueList = conditions.reduce(function (result, e1) {
260        let matches = result.filter(function (e2) {
261            return e1.id == e2.id;
262        })
263        if (matches.length == 0)
264            result.push(e1)
265        return result;
266    }, []);
267    for (const item of uniqueList) {
268        format += '<li><span class="wtaDot" style="background-color: ' + item.colour + '" aria-hidden="true"></span>' + item.statusName + '</li>';
269    }
270
271    format += '</ul>';
272    format += '</div>';
273
274    return format;
275};
276
277let applyWTAStyling = function (conditions) {
278    let gradient = '';
279    if (conditions && conditions.length > 0) {
280        let step = Math.round(100 / conditions.length);
281        for (let i = 0; i < conditions.length; i++) {
282            let current = (step * i);
283            gradient += conditions[i].colour + ' ' + current + '%, ' + conditions[i].colour + ' ' + (current + step) + '%';
284            if ((i + 1) != conditions.length) {
285                gradient += ',';
286            }
287            else {
288                gradient += ', ' + conditions[i].colour + ' 100%'; //double up the last colour, this create a solid line if we only have 1 condition.
289            }
290        }
291        return 'class="instructionText" style ="border-style: solid; border-width: 5px; border-right: 0; margin-left: -15px; margin-top: -10px; margin-bottom: -10px; padding-left: 30px; padding-top: 5px; padding-bottom: 5px; border-image: linear-gradient(to bottom, ' + gradient + ') 1 100%;"';
292    } else return 'class="instructionText"';
293}
294
295// called on load and resize
296let checkEventOnRoutePlanner = function (evt, windowResize) {
297    let routeLinkEvents = evt ? $(evt).parent().find(".routeLinkEvent") :
298        $(".routeTab:visible .routeLinkEvent");
299    routeLinkEvents.each(function () {
300        let box = $(this).find(".shorten")[0];
301        let showMoreLink = $(this).find(".showMore");
302        if (windowResize == "windowResize") {
303            if ($(box).hasClass("expanded")) {
304                $(box).removeClass("expanded");
305            }
306            if (showMoreLink) {
307                showMoreLink.remove();
308            }
309        }
310
311        //add a show more button only if needed based on height and it hasn't been added already
312        if (box && box.clientHeight < box.scrollHeight && !box.nextElementSibling) {
313            $(this).find(".text").append("<button class='showMore'>" + resources.ShowMore + "</button>");
314        }
315    });
vendor: 3 bytes, line 316
316}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.