1/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ 2TrackMyBusCtrl=['$scope','$http','$timeout',function($scope,$http,$timeout){$scope.EndPointUrl="/api/ServiceData";$scope.SearchByRoute=false;$scope.SearchByStop=false;$scope.SearchByRecent=false;switch($scope.ShowOnLoad){case "Route":$scope.SearchByRoute=true;break;case "Stop":$scope.SearchByStop=true;break;case "Recent":$scope.SearchByRecent=true;break;default:$scope.SearchByRoute=true;break;}$scope.ShowResults=false;$scope.DetailsActive=false;$scope.Routes=[];$scope.Directions=[];$scope.Stops=[];$scope.StopId="";$scope.Location={};$scope.Autocomplete={};;$scope.PredictionRouteGroups=[];$scope.AllStops={};$scope.StopAlerts=[];$scope.RecentStops=[];$scope.searchByStop=function(){if(typeof (ga)===typeof (Function))ga('send','event','trackMyBus','switchView','byStop');$scope.SearchByStop=true;$scope.SearchByRoute=false;$scope.SearchByRecent=false;};$scope.searchByRoute=function(){if(typeof (ga)===typeof (Function))ga('send','event','trackMyBus','switchView','byRoute');$scope.SearchByRoute=true;$scope.SearchByStop=false;$scope.SearchByRecent=false;};$scope.searchByRecent=function(){if(typeof (ga)===typeof (Function))ga('send','event','trackMyBus','switchView','byRecent');$scope.SearchByRecent=true;$scope.SearchByRoute=false;$scope.SearchByStop=false;};$scope.toggleStopDetails=function(predictionGroup){predictionGroup.DetailsActive=!predictionGroup.DetailsActive;};$scope.getAllStops=function(){$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getallcleverstops'}}).then(function successCallback(response){$scope.AllStops=response.data;});};$scope.getRoutes=function(){$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getroutes'}}).then(function successCallback(response){$scope.Routes=response.data['bustime-response'].route.filter(function(route){return !((route.rt>=351&&route.rt<=354)||route.rt==999);});});};$scope.getDirections=function(){$scope.Stops=[];$scope.SelectedStop={};$scope.SelectedDirection={};$http({method:'GET',url:$scope.EndPointUrl,params:{method:'routedirs',routeid:$scope.SelectedRoute.rt}}).then(function successCallback(response){if(angular.isArray(response.data['bustime-response'].dir))$scope.Directions=response.data['bustime-response'].dir.map(function(dir){return dir.id;});else{$scope.Directions=[];$scope.Directions.push(response.data['bustime-response'].dir.id);}});};$scope.getStops=function(){$scope.Stops=[];$scope.SelectedStop={};$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getstopsbyrouteanddirection',routeid:$scope.SelectedRoute.rt,d:$scope.SelectedDirection}}).then(function successCallback(response){$scope.Stops=response.data;});};$scope.getMatchingStops=function(searchText){return $scope.AllStops.filter(function(stop){return (stop.Name.toLowerCase().indexOf(searchText.toLowerCase())>-1||stop.Id.indexOf(searchText)>-1||(stop.Id+' - '+stop.Name.toLowerCase()).indexOf(searchText)>-1);});};$scope.stopAutoCompleteSelected=function(){if($scope.SelectedSearchStop)$scope.StopId=$scope.SelectedSearchStop.Id;else $scope.StopId="";};$scope.SearchValid=function(){if($scope.SearchByStop)return !($("#location").val()===""&&$scope.StopId==="");return ($scope.SelectedStop&&$scope.SelectedStop.StopId);};$scope.getArrivalsFromRecent=function(stop){$scope.StopNotFound=false;$scope.PredictionRouteGroups=[];$scope.StopAlerts=[];$scope.StopId=stop.Id;$scope.StopInfo={Name:stop.Name,StopId:stop.Id};$scope.getPredictions(stop.Id);if(typeof (ga)===typeof (Function))ga('send','event','trackMyBus','submitQuery','recentStop'+stop.Id);};$scope.getArrivals=function(event){if(event)event.preventDefault();if(typeof (ga)===typeof (Function))ga('send','event','trackMyBus','submitQuery','trackMyBusQuery');$scope.StopNotFound=false;$scope.PredictionRouteGroups=[];$scope.StopAlerts=[];var stopId;if($scope.SearchByStop)if((!$scope.StopId||$scope.StopId===""))if($("#input-0").val()!==""){var matchingStops=$scope.getMatchingStops($("#input-0").val());if(matchingStops.length==0){$scope.StopNotFound=true;return;}else $scope.StopId=matchingStops[0].Id;}else{$scope.StopNotFound=true;return;}else{stopId=$scope.StopId;$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getcleverstopinfo',stpid:stopId}}).then(function successCallback(response){$scope.StopInfo={Name:response.data.stop.stpnm,StopId:response.data.stop.stpid};});$scope.getPredictions(stopId);}else{stopId=$scope.SelectedStop.StopId;$scope.StopInfo={Name:$scope.SelectedStop.Name,StopId:$scope.SelectedStop.StopId};$scope.getPredictions(stopId);}};$scope.getPredictions=function(stopId){$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getservicebulletins',stpid:stopId}}).then(function successCallback(response){$scope.StopAlerts=response.data.map(function(sa){return sa.sb;});});$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getpredictionsfromxml',stpid:stopId}}).then(function successCallback(response){if(response.data["bustime-response"].prd){var tempPredictions=[];if(angular.isArray(response.data["bustime-response"].prd))tempPredictions=response.data["bustime-response"].prd;else tempPredictions.push(response.data["bustime-response"].prd);if($scope.SearchByRoute)tempPredictions=tempPredictions.filter(function(prediction){return prediction.rt==$scope.SelectedRoute.rt;});tempPredictions.forEach(function(prediction){if($scope.PredictionRouteGroups.filter(function(group){return group.routeId==prediction.rt&&group.routeName==prediction.des;}).length===0){var displayRouteId=prediction.rt;var displayName=prediction.des.trim();if(displayName.substr(0,2)==='A '||displayName.substr(0,2)==='B '||displayName.substr(0,2)==='C '||displayName.substr(0,2)==='D '){displayRouteId+=displayName.substr(0,1);
2displayName=displayName.slice(2).toLowerCase();}$scope.PredictionRouteGroups.push({routeId:prediction.rt,routeName:prediction.des,displayRouteId,displayRouteName:displayName});}});$scope.PredictionRouteGroups.forEach(function(group){group.Predictions=tempPredictions.filter(function(prediction){return prediction.rt==group.routeId&&prediction.des==group.routeName;});if(group.Predictions.length>3)group.Predictions=group.Predictions.slice(0,2);group.Predictions.forEach(function(prediction){if(prediction.prdctdn==='DUE')prediction.prdctdn='< 1 min';else if(prediction.prdctdn==='DLY')prediction.prdctdn='DELAYED';else prediction.prdctdn=prediction.prdctdn+" min";prediction.schdtm=$scope.formatTime($scope.getDateTimeFromString(prediction.schdtm));});});$scope.PredictionRouteGroups.forEach(function(group){if(group.Predictions.length==0)$scope.PredictionRouteGroups.splice($scope.PredictionRouteGroups.indexOf(group),1);else $http({method:'GET',url:$scope.EndPointUrl,params:{method:'getservicebulletins',routeid:group.routeId}}).then(function successCallback(response){group.RouteAlerts=response.data.map(function(ra){return ra.sb;});});});}else $scope.PredictionRouteGroups=[];$scope.ShowResults=true;});};$scope.getDateTimeFromString=function(dateTimeString){return new Date(dateTimeString.substr(0,4),((+dateTimeString.substr(4,2))-1),dateTimeString.substr(6,2),dateTimeString.substr(9,2),dateTimeString.substr(12,2));};$scope.goToLiveMapWithOutParams=function(){window.location="/maps-schedules/track-bus";};$scope.goToAlertDetails=function(stopAlert){var url=$scope.getAlertUrl(stopAlert);window.location=url;};$scope.goToLiveMap=function(){var routes=$scope.PredictionRouteGroups.map(function(item){return item.routeId;});var stop;if($scope.SearchByStop)stop=$scope.StopId;else if($scope.SearchByRoute)stop=$scope.SelectedStop.StopId;else stop=$scope.StopInfo.StopId;window.location="/maps-schedules/track-bus?Routes="+routes.join(',')+"&Stop="+stop;};$scope.goToLiveMapOneRoute=function(routeId){var stop;if($scope.SearchByStop)stop=$scope.StopId;else if($scope.SearchByRoute)stop=$scope.SelectedStop.StopId;else stop=$scope.StopInfo.StopId;window.location="/maps-schedules/track-bus?Routes="+routeId+"&Stop="+stop;};$scope.goToLiveMapWithRouteId=function(routeId){var stop;if($scope.SearchByStop)stop=$scope.StopId;else if($scope.SearchByRoute)stop=$scope.SelectedStop.StopId;else stop=$scope.StopInfo.StopId;window.location="/maps-schedules/schedule-route/"+routeId;};$scope.NewSearch=function(){$scope.ShowResults=false;};$scope.formatTime=function(time){var timeString="";var amPM="";if(time.getHours()>12){timeString=(time.getHours()-12)+":";amPM=" PM";}else{timeString=time.getHours()+":";amPM=" AM";}if(time.getMinutes()<10)timeString+="0"+time.getMinutes()+amPM;else timeString+=time.getMinutes()+amPM;return timeString;};$scope.clearStopId=function(){$scope.StopSearchText="";};$scope.getAlertUrl=function(alert){var url='/rider-alerts?alertName='+encodeURIComponent(alert.nm.replace(/:/g,'--colon--').replace(/\//g,'--slash--'));if(alert.srvc!=null){var route=undefined;var stop=undefined;if(!Array.isArray(alert.srvc)){if(alert.srvc.rt)route=alert.srvc.rt;if(alert.srvc.stpid)stop=alert.srvc.stpid;}else for(i=0;i<alert.srvc.length;i++){if(alert.srvc[0].rt&&!route)route=alert.srvc[0].rt;if(alert.srvc[0].stpid&&!stop)stop=alert.srvc[0].stpid;}url+='&route='+route;if(stop)url+='&stop='+stop;}return url;};$scope.$watch('StopInfo',function(newValue,oldValue){if(!newValue||(oldValue&&newValue.StopId==oldValue.StopId))return;var cleverStopInfo=$scope.getMatchingStops(newValue.StopId)[0];$scope.updateRecentSearches(cleverStopInfo);});$scope.updateRecentSearches=function(stopInfo){var cookieName="recentStops";if($scope.RecentStops.length>0){var matchingStop=$scope.RecentStops.filter(function(r){return r.Id==stopInfo.Id;});if(matchingStop.length>0)$scope.RecentStops.splice($scope.RecentStops.indexOf(matchingStop[0]),1);else{if($scope.RecentStops.length>=10)$scope.RecentStops.splice(0,1);}}$scope.RecentStops.push(stopInfo);var expires=new Date();expires.setDate(expires.getDate()+30);document.cookie=cookieName+'='+JSON.stringify($scope.RecentStops)+";"+expires.toString()+";"+"path=/";};$scope.getRecentStops=function(){var cookieName="recentStops";var cookies=document.cookie.split(';');
2cookies.forEach(function(c){if(c.indexOf(cookieName)>-1){var stopsString=c.substr(c.indexOf(cookieName)+cookieName.length+1);var tempStops=JSON.parse(stopsString);tempStops.forEach(function(s){delete s['$$hashKey'];});$scope.RecentStops=tempStops;}});};$scope.getRoutes();$scope.getAllStops();$scope.getRecentStops();$timeout(function(){var wrap=document.querySelector('div[ng-show="SearchByStop"] md-autocomplete-wrap');if(wrap)angular.element(wrap).removeAttr('role').removeAttr('aria-label');});}];; 3SchedulesCtrl=['$scope','$http',function($scope,$http){$scope.proxyapiurl="/api/ServiceData?method=";$scope.BusRoutes=[];$scope.SelectedRoute={};$scope.SelectedDate=moment().startOf("day").toDate();var hasInitializedDateWatch=false;$scope.RouteDirections=[];$scope.SelectedDirection={};$scope.RouteServiceDays=[];$scope.SelectedServiceDay={};$scope.Stops=[];$scope.SelectedFirstStop={};$scope.FirstStops=[];$scope.SelectedEndStop={};$scope.EndStops=[];$scope.getSelectedDateParam=function(){if(moment($scope.SelectedDate).isValid())return moment($scope.SelectedDate).format("YYYY-MM-DD");return moment().format("YYYY-MM-DD");};$scope.getroutes=function(){var getRoutesForSelect=$scope.proxyapiurl+"getroutesforselect&date="+encodeURIComponent($scope.getSelectedDateParam());$http({method:"GET",url:getRoutesForSelect}).success(function(data,status,headers,config){$scope.BusRoutes=data.Routes;});};$scope.clearSelectionsForDateChange=function(){$scope.SelectedRoute={};$scope.SelectedDirection={};$scope.SelectedServiceDay={};$scope.SelectedFirstStop={};$scope.FirstStops=[];$scope.SelectedEndStop={};$scope.EndStops=[];$scope.Stops=[];};$scope.$watch("SelectedDate",function(date){if(!moment(date).isValid())return;if(hasInitializedDateWatch)$scope.clearSelectionsForDateChange();hasInitializedDateWatch=true;$scope.getroutes();});$scope.$watch("SelectedRoute",function(route){$scope.SelectedDirection={};$scope.SelectedServiceDay={};$scope.RouteDirections=[];if(route&&route.route_short_name)$scope.getServiceDaysForRoute();});$scope.getDirectionsForRouteService=function(routeId,serviceDay){$http({method:"GET",url:$scope.proxyapiurl+"getdirectionsforschedules&routeid="+routeId+"&sid="+serviceDay}).success(function(data,status,headers,config){$scope.RouteDirections=data;$scope.SelectedDirection={};});};$scope.getServiceDaysForRoute=function(){var routeId=$scope.SelectedRoute.route_id;var getServiceDaysForRouteId=$scope.proxyapiurl+"getservicedaysforschedules&routeid="+routeId+"&date="+encodeURIComponent($scope.getSelectedDateParam());$http({method:"GET",url:getServiceDaysForRouteId}).success(function(data,status,headers,config){$scope.RouteServiceDays=data;if($scope.RouteServiceDays.length>0){$scope.SelectedServiceDay=$scope.RouteServiceDays[0];$scope.getDirectionsForRouteService(routeId,$scope.SelectedServiceDay.Value);}else{$scope.RouteDirections=[];$scope.SelectedDirection={};}});};$scope.$watchGroup(["SelectedRoute","SelectedServiceDay","SelectedDirection"],function(values){$scope.Stops=[];$scope.SelectedFirstStop={};$scope.FirstStops=[];$scope.SelectedEndStop={};$scope.EndStops=[];if(values.length==3&&values[0].route_id&&values[1].Value&&values[2].Value>-1){var routeId=values[0].route_id;var serviceDay=values[1].Value;var direction=values[2].Value;$scope.getStops(routeId,direction,serviceDay);}});$scope.getStops=function(routeId,direction,serviceDay){$http({method:"GET",url:$scope.proxyapiurl+"getstops&routeid="+routeId+"&d="+direction+"&sid="+serviceDay}).success(function(data,status,headers,config){data.forEach(function(s){s.Index=data.indexOf(s);});$scope.Stops=data;$scope.FirstStops=$scope.Stops.slice(0,$scope.Stops.length-1);$scope.EndStops=$scope.Stops.slice(1);$scope.SelectedFirstStop=$scope.Stops[0];$scope.SelectedEndStop=$scope.Stops[$scope.Stops.length-1];});};$scope.$watch("SelectedFirstStop",function(value){if(!value)return $scope.EndStops=$scope.Stops.slice(1);return $scope.EndStops=$scope.Stops.slice(value.Index+1);});$scope.$watch("SelectedEndStop",function(value){if(!value)return $scope.FirstStops=$scope.Stops.slice(0,$scope.Stops.length-1);return $scope.FirstStops=$scope.Stops.slice(0,value.Index);});$scope.SearchValid=function(){return !!($scope.SelectedRoute&&$scope.SelectedRoute.route_short_name!==undefined&&$scope.SelectedDirection&&$scope.SelectedDirection.Value!==undefined&&$scope.SelectedServiceDay&&$scope.SelectedServiceDay.Value!==undefined&&$scope.SelectedFirstStop&&$scope.SelectedFirstStop.stop_id!==undefined&&$scope.SelectedEndStop&&$scope.SelectedEndStop.stop_id!==undefined);};$scope.viewRoute=function(){if(typeof (ga)===typeof (Function))ga('send','event','routesSched','submitQuery','routesSchedQuery');var url="/maps-schedules/schedule-route/"+encodeURIComponent($scope.SelectedRoute.route_short_name)+"/"+encodeURIComponent($scope.SelectedDirection.Value)+"?date="+encodeURIComponent($scope.getSelectedDateParam());window.location=url;};$scope.getroutes();}];; 4PlanMyTripCtrl=['$scope','$http',function($scope,$http){$scope.EndPointUrl="/api/ServiceData";$scope.BusTimeDown;$scope.DirectionsService=new google.maps.DirectionsService();$scope.DirectionsDisplay={};$scope.CurrentPosition={};$scope.StartLocation="";$scope.EndLocation="";$scope.DepartOrArival="";$scope.geoEnabled=false;$scope.showGeoMessage=false;$scope.StartAutoComplete={};$scope.EndAutoComplete={};$scope.PlaceService={};$scope.ShowResults=false;$scope.ShowMap=false;$scope.DirectionsFound=false;$scope.TodaysDate=new Date();$scope.TodaysDate.setSeconds(0);$scope.TodaysDate.setMilliseconds(0);$scope.Date=$scope.TodaysDate;$scope.Time=$scope.TodaysDate;$scope.StartPlace={};$scope.EndPlace={};if(navigator.geolocation)$scope.ShowNav=true;$scope.timeInput=Modernizr.inputtypes.time;if(!$scope.timeInput){$.mask.definitions['H']="[0-1]";$.mask.definitions['h']="[0-9]";$.mask.definitions['M']="[0-5]";$.mask.definitions['m']="[0-9]";$.mask.definitions['P']="[AaPp]";$.mask.definitions['p']="[Mm]";$("#transitTime").mask("Hh:Mm Pp");}$scope.initializeControls=function(){$scope.DirectionsDisplay=new google.maps.DirectionsRenderer();$scope.DirectionsDisplay.setPanel(document.getElementById('directions-panel'));$scope.StartAutoComplete=$scope.setPlacesAutoComplete(document.getElementById('start'),$scope.setStartFromAutoComplete);$scope.EndAutoComplete=$scope.setPlacesAutoComplete(document.getElementById('end'),$scope.setEndFromAutoComplete);var directionsObserverConfig={childList:true};var directionsObserver=new MutationObserver(function(mutations){$('.adp-placemark').attr('tabindex',0);$('ol li').attr('tabindex',0).bind('keydown',function(event){if(event.keyCode==32)$(this).click();});$('.adp-directions tr').attr('tabindex',0);});directionsObserver.observe(document.getElementById('directions-panel'),directionsObserverConfig);google.maps.event.addListener($scope.DirectionsDisplay,'routeindex_changed',function(){if($scope.BusTimeDown==false)$scope.getAlertsForTrip($scope.DirectionsDisplay.directions.routes[$scope.DirectionsDisplay.getRouteIndex()]);});};$scope.setPlacesAutoComplete=function(element,listenerCall){var input=element;var bounds=new google.maps.LatLngBounds(new google.maps.LatLng(42.146230,-84.040853),new google.maps.LatLng(42.354381,-83.450686));var placesOptions={componentRestrictions:{country:"us"},bounds};var autocomplete=new google.maps.places.Autocomplete(input,placesOptions);autocomplete.setFields(['place_id']);google.maps.event.addListener(autocomplete,'place_changed',function(){listenerCall(autocomplete);});return autocomplete;};$scope.setStartFromAutoComplete=function(autocomplete){$scope.StartLocation=autocomplete.getPlace();};$scope.setEndFromAutoComplete=function(autocomplete){$scope.EndLocation=autocomplete.getPlace();};$scope.setStartFromCurrentLocation=function(value){$("#start").val(value);$scope.StartLocation={};};$scope.setEndFromCurrentLocation=function(value){$("#end").val(value);$scope.EndLocation={};};$scope.ClearStartLocation=function(){$scope.StartLocation={};};$scope.ClearEndLocation=function(){$scope.EndLocation={};};$scope.$watch("Date",function(value){validateTime();});$scope.$watch("Time",function(value){validateTime();});$scope.$watch("DepartOrArival",function(){if($scope.DepartOrArival==""){$scope.Time=="";$scope.TodaysDate=new Date();$scope.TodaysDate.setSeconds(0);$scope.TodaysDate.setMilliseconds(0);$scope.Date=$scope.TodaysDate;$scope.Time=$scope.TodaysDate;}});var validateTime=function(){if($scope.Time&&$scope.Time!==''){$scope.TimeRequired=false;return;}var now=new Date();var date=new Date($scope.Date);if(!date.toDateString||date.toDateString()==now.toDateString())$scope.TimeRequired=false;else $scope.TimeRequired=true;};$scope.planTrip=function(event){if(event)event.preventDefault();if($scope.TimeRequired)return;if(typeof (ga)===typeof (Function))ga('send','event','planMyTrip','submitQuery','planMyTripQuery');var start=$("#start").val();var end=$("#end").val();$scope.StartLocationAddress=start;$scope.EndLocationAddress=end;if($scope.StartLocation.place_id)start={'placeId':$scope.StartLocation.place_id};if($scope.EndLocation.place_id)end={'placeId':$scope.EndLocation.place_id};
4$scope.getDirections(start,end);};$scope.getDirections=function(start,end){var request={origin:start,destination:end,travelMode:google.maps.TravelMode.TRANSIT,provideRouteAlternatives:true};if($scope.DepartOrArival!=''&&$scope.Date&&$scope.Date!==''&&$scope.Time&&$scope.Time!==''){var topts={};if(!$scope.timeInput)var transitOptionsDate=new Date(moment($scope.Date).format("MM/DD/YYYY")+' '+$scope.Time);else{var tmpDateTime=moment($scope.Date).format("MM/DD/YYYY")+' '+moment($scope.Time).format("hh:mm a");var transitOptionsDate=new Date(tmpDateTime);}if($scope.DepartOrArival=="Arrive")topts={arrivalTime:transitOptionsDate};else topts={departureTime:transitOptionsDate};if(topts!=={}){request.transitOptions=topts;console.log(request);}}$scope.DirectionsService.route(request,function(response,status){if(status==google.maps.DirectionsStatus.OK){response.routes=response.routes.filter(function(route){return (route.legs[0].steps.filter(function(step){return (step.travel_mode==="TRANSIT"&&step.transit.line.agencies.filter(function(agency){return agency.name!="Ann Arbor Area Transportation Authority"&&agency.name!="AATA"&&agency.name!="AAATA";}).length>0);}).length===0);});if(response.routes.length==0){$scope.ShowResults=true;return;}$scope.NoTripsFound=false;$scope.DirectionsDisplay.setDirections(response);console.log("Suggested Routes: "+response.routes.length);$scope.DirectionsFound=true;$scope.$apply();}else{console.log(status);$scope.NoTripsFound=true;$scope.DirectionsDisplay.setDirections(response);$scope.DirectionsFound=false;$scope.$apply();}});$scope.ShowResults=true;};$scope.NewSearch=function(){$scope.ShowResults=false;$scope.ShowMap=false;};$scope.getTripUrl=function(){var url="/maps-schedules/trip-planner";var start=$("#start").val();var end=$("#end").val();var startIsPlace="false";var startId="0";if($scope.StartLocation.place_id){startId=$scope.StartLocation.place_id;var startIsPlace="true";}var endIsPlace="false";var endId="0";if($scope.EndLocation.place_id){endId=$scope.EndLocation.place_id;var endIsPlace="true";}if(start!==""&&end!==""&&$scope.Date!==""&&$scope.DepartOrArival!=""){if(!$scope.timeInput){var today=new Date();$scope.enteredTime=new Date(today.getFullYear()+'/'+today.getMonth()+'/'+today.getDate()+' '+$scope.Time);}else $scope.enteredTime=$scope.Time;var tmpDateTime=moment($scope.Date).format("MM/DD/YYYY")+' '+moment($scope.Time).format("hh:mm a");var transitOptionsDate=new Date(tmpDateTime);var theScopedDate=moment($scope.Date).format("MM-DD-YYYY");var theScopedTime=moment($scope.enteredTime).format("hh-mm-a");theScopedDate=encodeURIComponent(theScopedDate);theScopedTime=encodeURIComponent(theScopedTime);url="/maps-schedules/trip-planner"+"/"+startIsPlace+"/"+startId+"/"+start.replace(/\+/g,"").replace(/:/g,"")+"/"+endIsPlace+"/"+endId+"/"+end.replace(/\+/g,"").replace(/:/g,"")+"/"+theScopedDate+"/"+theScopedTime+"/"+$scope.DepartOrArival;}else{if(start!==""&&end!=="")url="/maps-schedules/trip-planner"+"/"+startIsPlace+"/"+startId+"/"+start.replace(/\+/g,"").replace(/:/g,"")+"/"+endIsPlace+"/"+endId+"/"+end.replace(/\+/g,"").replace(/:/g,"");}window.location=url;};$scope.getAlertsForTrip=function(directions){$scope.Alerts=[];directions.legs.forEach(function(leg){leg.steps.forEach(function(step){if(step.travel_mode=="TRANSIT"){var routeId=step.transit.line.short_name;$http({method:'GET',url:$scope.EndPointUrl,params:{method:'getservicebulletins',routeid:routeId}}).then(function successCallback(response){response.data.map(function(ra){return ra.sb;}).forEach(function(sb){if($scope.Alerts.filter(function(a){return a.nm==sb.nm;}).length==0)$scope.Alerts.push(sb);});});}});});};$scope.getAlertUrl=function(alert){var url='/rider-alerts?alertName='+encodeURIComponent(alert.nm.replace(/:/g,'--colon--').replace(/\//g,'--slash--'));if(alert.srvc!=null){var route=undefined;var stop=undefined;if(!Array.isArray(alert.srvc)){if(alert.srvc.rt)route=alert.srvc.rt;if(alert.srvc.stpid)stop=alert.srvc.stpid;}else for(i=0;i<alert.srvc.length;i++){if(alert.srvc[0].rt&&!route)route=alert.srvc[0].rt;if(alert.srvc[0].stpid&&!stop)stop=alert.srvc[0].stpid;}url+='&route='+route;if(stop)url+='&stop='+stop;}return url;};$http({method:'GET',url:'https://rt.theride.org'}).then(function sccess(response){$scope.BusTimeDown=false;if($scope.DirectionsFound)$scope.getAlertsForTrip($scope.DirectionsDisplay.directions.routes[$scope.DirectionsDisplay.getRouteIndex()]);},function fail(){$scope.BusTimeDown=true;});$scope.initializeControls();}];; 5HomeToolsCtrl=['$scope','$http',function($scope,$http){$scope.ShowPlanMyTrip=true;$scope.ShowTrackMyBus=false;$scope.ShowSchedules=false;$scope.BusTimeDown=false;$scope.trackMyBusClicked=function(){if(typeof (ga)===typeof (Function))ga('send','event','trackMyBus','selectTab','trackMyBusTab');$scope.ShowTrackMyBus=true;$scope.ShowPlanMyTrip=false;$scope.ShowSchedules=false;};$scope.planMyTripClicked=function(){if(typeof (ga)===typeof (Function))ga('send','event','planMyTrip','selectTab','planMyTripTab');$scope.ShowPlanMyTrip=true;$scope.ShowTrackMyBus=false;$scope.ShowSchedules=false;};$scope.schedulesClicked=function(){if(typeof (ga)===typeof (Function))ga('send','event','routesSched','selectTab','routesSchedTab');$scope.ShowSchedules=true;$scope.ShowPlanMyTrip=false;$scope.ShowTrackMyBus=false;};}];; 6var homeToolApp=angular.module('HomeToolsApp',['ngAnimate','720kb.datepicker','ngMaterial'],function($locationProvider){$locationProvider.html5Mode({enabled:true,requireBase:false});});homeToolApp.config(['$httpProvider',function($httpProvider){if(!$httpProvider.defaults.headers.get)$httpProvider.defaults.headers.get={};}]);homeToolApp.config(($mdGestureProvider)=>{$mdGestureProvider.skipClickHijack();});homeToolApp.controller("HomeToolsCtrl",HomeToolsCtrl);homeToolApp.controller("TrackMyBusCtrl",TrackMyBusCtrl);homeToolApp.controller("PlanMyTripCtrl",PlanMyTripCtrl);homeToolApp.controller("SchedulesCtrl",SchedulesCtrl);; 7(function($,Drupal){Drupal.theme.progressBar=function(id){const escapedId=Drupal.checkPlain(id);return (`<div id="${escapedId}
vendor: 3,483 bytes, lines 7-9
7" class="progress" aria-live="polite">`+'<div class="progress__label"> </div>'+'<div class="progress__track"><div class="progress__bar"></div></div>'+'<div class="progress__percentage"></div>'+'<div class="progress__description"> </div>'+'</div>');};Drupal.ProgressBar=function(id,updateCallback,method,errorCallback){this.id=id;this.method=method||'GET';this.updateCallback=updateCallback;this.errorCallback=errorCallback;this.element=$(Drupal.theme('progressBar',id));};$.extend(Drupal.ProgressBar.prototype,{setProgress(percentage,message,label){if(percentage>=0&&percentage<=100){$(this.element).find('div.progress__bar').each(function(){this.style.width=`${percentage}%`;});$(this.element).find('div.progress__percentage').html(`${percentage}%`);}$('div.progress__description',this.element).html(message);$('div.progress__label',this.element).html(label);if(this.updateCallback)this.updateCallback(percentage,message,this);},startMonitoring(uri,delay){this.delay=delay;this.uri=uri;this.sendPing();},stopMonitoring(){clearTimeout(this.timer);this.uri=null;},sendPing(){if(this.timer)clearTimeout(this.timer);if(this.uri){const pb=this;let uri=this.uri;if(!uri.includes('?'))uri+='?';else uri+='&';uri+='_format=json';$.ajax({type:this.method,url:uri,data:'',dataType:'json',success(progress){if(progress.status===0){pb.displayError(progress.data);return;}pb.setProgress(progress.percentage,progress.message,progress.label);pb.timer=setTimeout(()=>{pb.sendPing();},pb.delay);},error(xmlhttp){const e=new Drupal.AjaxError(xmlhttp,pb.uri);pb.displayError(`<pre>${e.message}</pre>`);}});}},displayError(string){const error=$('<div class="messages messages--error"></div>').html(string);$(this.element).before(error).hide();if(this.errorCallback)this.errorCallback(this);}});})(jQuery,Drupal);; 8/* @license MIT https://raw.githubusercontent.com/muicss/loadjs/4.3.0/LICENSE.txt */ 9loadjs=function(){var h=function(){},o={},c={},f={};function u(e,n){if(e){var t=f[e];if(c[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function l(e,n){e.call&&(e={success:e}),n.length?(e.error||h)(n):(e.success||h)(e)}function p(t,r,i,s){var o,e,u,n=document,c=i.async,f=(i.numRetries||0)+1,l=i.before||h,a=t.replace(/[\?|#].*$/,""),d=t.replace(/^(css|img|module|nomodule)!/,"");if(s=s||0,/(^css!|\.css$)/.test(a))(u=n.createElement("link")).rel="stylesheet",u.href=d,(o="hideFocus"in u)&&u.relList&&(o=0,u.rel="preload",u.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(a))(u=n.createElement("img")).src=d;else if((u=n.createElement("script")).src=d,u.async=void 0===c||c,e="noModule"in u,/^module!/.test(a)){if(!e)return r(t,"l");u.type="module"}else if(/^nomodule!/.test(a)&&e)return r(t,"l");!(u.onload=u.onerror=u.onbeforeload=function(e){var n=e.type[0];if(o)try{u.sheet.cssText.length||(n="e")}catch(e){18!=e.code&&(n="e")}if("e"==n){if((s+=1)<f)return p(t,r,i,s)}else if("preload"==u.rel&&"style"==u.as)return u.rel="stylesheet";r(t,n,e.defaultPrevented)})!==l(t,u)&&n.head.appendChild(u)}function t(e,n,t){var r,i;if(n&&n.trim&&(r=n),i=(r?t:n)||{},r){if(r in o)throw"LoadJS";o[r]=!0}function s(n,t){!function(e,r,n){var t,i,s=(e=e.push?e:[e]).length,o=s,u=[];for(t=function(e,n,t){if("e"==n&&u.push(e),"b"==n){if(!t)return;u.push(e)}--s||r(u)},i=0;i<o;i++)p(e[i],t,n)}(e,function(e){l(i,e),n&&l({success:n,error:t},e),u(r,e)},i)}if(i.returnPromise)return new Promise(s);s()}return t.ready=function(e,n){return function(e,t){e=e.push?e:[e];var n,r,i,s=[],o=e.length,u=o;
9for(n=function(e,n){n.length&&s.push(e),--u||t(s)};o--;)r=e[o],(i=c[r])?n(r,i):(f[r]=f[r]||[]).push(n)}(e,function(e){l(n,e)}),t},t.done=function(e){u(e,[])},t.reset=function(){o={},c={},f={}},t.isDefined=function(e){return e in o},t}();; 10/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ 11Drupal.debounce=function(func,wait,immediate){let timeout;let result;return function(...args){const context=this;const later=function(){timeout=null;if(!immediate)result=func.apply(context,args);};const callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow)result=func.apply(context,args);return result;};};; 12(function(Drupal,debounce){let liveElement;const announcements=[];Drupal.behaviors.drupalAnnounce={attach(context){if(!liveElement){liveElement=document.createElement('div');liveElement.id='drupal-live-announce';liveElement.className='visually-hidden';liveElement.setAttribute('aria-live','polite');liveElement.setAttribute('aria-busy','false');document.body.appendChild(liveElement);}}};function announce(){const text=[];let priority='polite';let announcement;const il=announcements.length;for(let i=0;i<il;i++){announcement=announcements.pop();text.unshift(announcement.text);if(announcement.priority==='assertive')priority='assertive';}if(text.length){liveElement.innerHTML='';liveElement.setAttribute('aria-busy','true');liveElement.setAttribute('aria-live',priority);liveElement.innerHTML=text.join('\n');liveElement.setAttribute('aria-busy','false');}}Drupal.announce=function(text,priority){announcements.push({text,priority});return debounce(announce,200)();};})(Drupal,Drupal.debounce);; 13((Drupal)=>{Drupal.Message=class{constructor(messageWrapper=null){if(!messageWrapper)this.messageWrapper=Drupal.Message.defaultWrapper();else this.messageWrapper=messageWrapper;}static defaultWrapper(){let wrapper=document.querySelector('[data-drupal-messages]')||document.querySelector('[data-drupal-messages-fallback]');if(!wrapper){wrapper=document.createElement('div');document.body.appendChild(wrapper);}if(wrapper.hasAttribute('data-drupal-messages-fallback')){wrapper.removeAttribute('data-drupal-messages-fallback');wrapper.classList.remove('hidden');}wrapper.setAttribute('data-drupal-messages','');return wrapper.innerHTML===''?Drupal.Message.messageInternalWrapper(wrapper):wrapper.firstElementChild;}static getMessageTypeLabels(){return {status:Drupal.t('Status message'),error:Drupal.t('Error message'),warning:Drupal.t('Warning message')};}add(message,options={}){if(!options.hasOwnProperty('type'))options.type='status';if(typeof message!=='string')throw new Error('Message must be a string.');Drupal.Message.announce(message,options);options.id=options.id?String(options.id):`${options.type}-${Math.random().toFixed(15).replace('0.','')}`;if(!Drupal.Message.getMessageTypeLabels().hasOwnProperty(options.type)){const {type}=options;throw new Error(`The message type, ${type}, is not present in Drupal.Message.getMessageTypeLabels().`);}this.messageWrapper.appendChild(Drupal.theme('message',{text:message},options));return options.id;}select(id){return this.messageWrapper.querySelector(`[data-drupal-message-id^="${id}"]`);}remove(id){return this.messageWrapper.removeChild(this.select(id));}clear(){Array.prototype.forEach.call(this.messageWrapper.querySelectorAll('[data-drupal-message-id]'),(message)=>{this.messageWrapper.removeChild(message);});}static announce(message,options){if(!options.priority&&(options.type==='warning'||options.type==='error'))options.priority='assertive';if(options.announce!=='')Drupal.announce(options.announce||message,options.priority);}static messageInternalWrapper(messageWrapper){const innerWrapper=document.createElement('div');innerWrapper.setAttribute('class','messages__wrapper');messageWrapper.insertAdjacentElement('afterbegin',innerWrapper);return innerWrapper;}};Drupal.theme.message=({text},{type,id})=>{const messagesTypes=Drupal.Message.getMessageTypeLabels();const messageWrapper=document.createElement('div');messageWrapper.setAttribute('class',`messages messages--${type}`);messageWrapper.setAttribute('role',type==='error'||type==='warning'?'alert':'status');messageWrapper.setAttribute('data-drupal-message-id',id);messageWrapper.setAttribute('data-drupal-message-type',type);messageWrapper.setAttribute('aria-label',messagesTypes[type]);messageWrapper.innerHTML=`${text}`;return messageWrapper;};})(Drupal);; 14(function($,window,Drupal,drupalSettings,loadjs,{isFocusable,tabbable}){Drupal.behaviors.AJAX={attach(context,settings){function loadAjaxBehavior(base){const elementSettings=settings.ajax[base];if(typeof elementSettings.selector==='undefined')elementSettings.selector=`#${base}`;
14once('drupal-ajax',$(elementSettings.selector)).forEach((el)=>{elementSettings.element=el;elementSettings.base=base;Drupal.ajax(elementSettings);});}Object.keys(settings.ajax||{}).forEach(loadAjaxBehavior);Drupal.ajax.bindAjaxLinks(document.body);once('ajax','.use-ajax-submit').forEach((el)=>{const elementSettings={};elementSettings.url=$(el.form).attr('action');elementSettings.setClick=true;elementSettings.event='click';elementSettings.progress={type:'throbber'};elementSettings.base=el.id;elementSettings.element=el;Drupal.ajax(elementSettings);});},detach(context,settings,trigger){if(trigger==='unload')Drupal.ajax.expired().forEach((instance)=>{Drupal.ajax.instances[instance.instanceIndex]=null;});}};Drupal.AjaxError=function(xmlhttp,uri,customMessage){let statusCode;let statusText;let responseText;if(xmlhttp.status)statusCode=`\n${Drupal.t('An AJAX HTTP error occurred.')}\n${Drupal.t('HTTP Result Code: !status',{'!status':xmlhttp.status})}`;else statusCode=`\n${Drupal.t('An AJAX HTTP request terminated abnormally.')}`;statusCode+=`\n${Drupal.t('Debugging information follows.')}`;const pathText=`\n${Drupal.t('Path: !uri',{'!uri':uri})}`;statusText='';try{statusText=`\n${Drupal.t('StatusText: !statusText',{'!statusText':xmlhttp.statusText.trim()})}`;}catch(e){}responseText='';try{responseText=`\n${Drupal.t('ResponseText: !responseText',{'!responseText':xmlhttp.responseText.trim()})}`;}catch(e){}responseText=responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi,'');responseText=responseText.replace(/[\n]+\s+/g,'\n');const readyStateText=xmlhttp.status===0?`\n${Drupal.t('ReadyState: !readyState',{'!readyState':xmlhttp.readyState})}`:'';customMessage=customMessage?`\n${Drupal.t('CustomMessage: !customMessage',{'!customMessage':customMessage})}`:'';this.message=statusCode+pathText+statusText+customMessage+responseText+readyStateText;this.name='AjaxError';if(!Drupal.AjaxError.messages)Drupal.AjaxError.messages=new Drupal.Message();Drupal.AjaxError.messages.add(Drupal.t("Oops, something went wrong. Check your browser's developer console for more details."),{type:'error'});};Drupal.AjaxError.prototype=new Error();Drupal.AjaxError.prototype.constructor=Drupal.AjaxError;Drupal.ajax=function(settings){if(arguments.length!==1)throw new Error('Drupal.ajax() function must be called with one configuration object only');const base=settings.base||false;const element=settings.element||false;delete settings.base;delete settings.element;if(!settings.progress&&!element)settings.progress=false;const ajax=new Drupal.Ajax(base,element,settings);ajax.instanceIndex=Drupal.ajax.instances.length;Drupal.ajax.instances.push(ajax);return ajax;};Drupal.ajax.instances=[];Drupal.ajax.expired=function(){return Drupal.ajax.instances.filter((instance)=>instance&&instance.element!==false&&!document.body.contains(instance.element));};Drupal.ajax.bindAjaxLinks=(element)=>{once('ajax','.use-ajax',element).forEach((ajaxLink)=>{const $linkElement=$(ajaxLink);const elementSettings={progress:{type:'throbber'},dialogType:$linkElement.data('dialog-type'),dialog:$linkElement.data('dialog-options'),dialogRenderer:$linkElement.data('dialog-renderer'),base:$linkElement.attr('id'),element:ajaxLink};const href=$linkElement.attr('href');if(href){elementSettings.url=href;elementSettings.event='click';}const httpMethod=$linkElement.data('ajax-http-method');if(httpMethod)elementSettings.httpMethod=httpMethod;Drupal.ajax(elementSettings);});};Drupal.Ajax=function(base,element,elementSettings){const defaults={httpMethod:'POST',event:element?'mousedown':null,keypress:true,selector:base?`#${base}`:null,effect:'none',speed:'none',method:'replaceWith',progress:{type:'throbber',message:Drupal.t('Processing...')},submit:{js:true}};$.extend(this,defaults,elementSettings);this.commands=new Drupal.AjaxCommands();this.instanceIndex=false;if(this.wrapper)this.wrapper=`#${this.wrapper}`;this.element=element;this.preCommandsFocusedElementSelector=null;this.elementSettings=elementSettings;if(this.element&&this.element.form)this.$form=$(this.element.form);if(!this.url){const $element=$(this.element);if(this.element.tagName==='A')this.url=$element.attr('href');else{if(this.element&&element.form)this.url=this.$form.attr('action');}}const originalUrl=this.url;this.url=this.url.replace(/\/nojs(\/|$|\?|#)/,'/ajax$1');if(drupalSettings.ajaxTrustedUrl[originalUrl])drupalSettings.ajaxTrustedUrl[this.url]=true;const ajax=this;ajax.options={url:ajax.url,data:ajax.submit,isInProgress(){return ajax.ajaxing;},beforeSerialize(elementSettings,options){return ajax.beforeSerialize(elementSettings,options);},beforeSubmit(formValues,elementSettings,options){ajax.ajaxing=true;ajax.preCommandsFocusedElementSelector=null;return ajax.beforeSubmit(formValues,elementSettings,options);},beforeSend(xmlhttprequest,options){ajax.ajaxing=true;return ajax.beforeSend(xmlhttprequest,options);},success(response,status,xmlhttprequest){ajax.preCommandsFocusedElementSelector=document.activeElement.getAttribute('data-drupal-selector');if(typeof response==='string')response=$.parseJSON(response);if(response!==null&&!drupalSettings.ajaxTrustedUrl[ajax.url])if(xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token')!=='1'){const customMessage=Drupal.t('The response failed verification so will not be processed.');return ajax.error(xmlhttprequest,ajax.url,customMessage);}return (Promise.resolve(ajax.success(response,status)).then(()=>{ajax.ajaxing=false;
14$(document).trigger('ajaxSuccess',[xmlhttprequest,this]);$(document).trigger('ajaxComplete',[xmlhttprequest,this]);if(--$.active===0)$(document).trigger('ajaxStop');}));},error(xmlhttprequest,status,error){ajax.ajaxing=false;},complete(xmlhttprequest,status){if(status==='error'||status==='parsererror')return ajax.error(xmlhttprequest,ajax.url);},dataType:'json',jsonp:false,method:ajax.httpMethod};if(elementSettings.dialog)ajax.options.data.dialogOptions=elementSettings.dialog;if(!ajax.options.url.includes('?'))ajax.options.url+='?';else ajax.options.url+='&';let wrapper=`drupal_${elementSettings.dialogType||'ajax'}`;if(elementSettings.dialogRenderer)wrapper+=`.${elementSettings.dialogRenderer}`;ajax.options.url+=`${Drupal.ajax.WRAPPER_FORMAT}=${wrapper}`;$(ajax.element).on(elementSettings.event,function(event){if(!drupalSettings.ajaxTrustedUrl[ajax.url]&&!Drupal.url.isLocal(ajax.url))throw new Error(Drupal.t('The callback URL is not local and not trusted: !url',{'!url':ajax.url}));return ajax.eventResponse(this,event);});if(elementSettings.keypress)$(ajax.element).on('keypress',function(event){return ajax.keypressResponse(this,event);});if(elementSettings.prevent)$(ajax.element).on(elementSettings.prevent,false);};Drupal.ajax.WRAPPER_FORMAT='_wrapper_format';Drupal.Ajax.AJAX_REQUEST_PARAMETER='_drupal_ajax';Drupal.Ajax.prototype.execute=function(){if(this.ajaxing)return;try{this.beforeSerialize(this.element,this.options);return $.ajax(this.options);}catch(e){this.ajaxing=false;window.alert(`An error occurred while attempting to process ${this.options.url}: ${e.message}`);return $.Deferred().reject();}};Drupal.Ajax.prototype.keypressResponse=function(element,event){const ajax=this;if(event.which===13||(event.which===32&&element.type!=='text'&&element.type!=='textarea'&&element.type!=='tel'&&element.type!=='number')){event.preventDefault();event.stopPropagation();$(element).trigger(ajax.elementSettings.event);}};Drupal.Ajax.prototype.eventResponse=function(element,event){event.preventDefault();event.stopPropagation();const ajax=this;if(ajax.ajaxing)return;try{if(ajax.$form){if(ajax.setClick)element.form.clk=element;ajax.$form.ajaxSubmit(ajax.options);}else{ajax.beforeSerialize(ajax.element,ajax.options);$.ajax(ajax.options);}}catch(e){ajax.ajaxing=false;window.alert(`An error occurred while attempting to process ${ajax.options.url}: ${e.message}`);}};Drupal.Ajax.prototype.beforeSerialize=function(element,options){if(this.$form&&document.body.contains(this.$form.get(0))){const settings=this.settings||drupalSettings;Drupal.detachBehaviors(this.$form.get(0),settings,'serialize');}options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER]=1;const pageState=drupalSettings.ajaxPageState;options.data['ajax_page_state[theme]']=pageState.theme;options.data['ajax_page_state[theme_token]']=pageState.theme_token;options.data['ajax_page_state[libraries]']=pageState.libraries;};Drupal.Ajax.prototype.beforeSubmit=function(formValues,element,options){};Drupal.Ajax.prototype.beforeSend=function(xmlhttprequest,options){if(this.$form){options.extraData=options.extraData||{};options.extraData.ajax_iframe_upload='1';const v=$.fieldValue(this.element);if(v!==null)options.extraData[this.element.name]=v;}$(this.element).prop('disabled',true);if(!this.progress||!this.progress.type)return;const progressIndicatorMethod=`setProgressIndicator${this.progress.type.slice(0,1).toUpperCase()}${this.progress.type.slice(1).toLowerCase()}`;if(progressIndicatorMethod in this&&typeof this[progressIndicatorMethod]==='function')this[progressIndicatorMethod].call(this);};Drupal.theme.ajaxProgressThrobber=(message)=>{const messageMarkup=typeof message==='string'?Drupal.theme('ajaxProgressMessage',message):'';const throbber='<div class="throbber"> </div>';return `<div class="ajax-progress ajax-progress-throbber">${throbber}${messageMarkup}</div>`;};Drupal.theme.ajaxProgressIndicatorFullscreen=()=>'<div class="ajax-progress ajax-progress-fullscreen"> </div>';Drupal.theme.ajaxProgressMessage=(message)=>`<div class="message">${message}</div>`;Drupal.theme.ajaxProgressBar=($element)=>$('<div class="ajax-progress ajax-progress-bar"></div>').append($element);Drupal.Ajax.prototype.setProgressIndicatorBar=function(){const progressBar=new Drupal.ProgressBar(`ajax-progress-${this.element.i
14d}`,$.noop,this.progress.method,$.noop);if(this.progress.message)progressBar.setProgress(-1,this.progress.message);if(this.progress.url)progressBar.startMonitoring(this.progress.url,this.progress.interval||1500);this.progress.element=$(Drupal.theme('ajaxProgressBar',progressBar.element));this.progress.object=progressBar;$(this.element).after(this.progress.element);};Drupal.Ajax.prototype.setProgressIndicatorThrobber=function(){this.progress.element=$(Drupal.theme('ajaxProgressThrobber',this.progress.message));if($(this.element).closest('[data-drupal-ajax-container]').length)$(this.element).closest('[data-drupal-ajax-container]').after(this.progress.element);else $(this.element).after(this.progress.element);};Drupal.Ajax.prototype.setProgressIndicatorFullscreen=function(){this.progress.element=$(Drupal.theme('ajaxProgressIndicatorFullscreen'));$('body').append(this.progress.element);};Drupal.Ajax.prototype.commandExecutionQueue=function(response,status){const ajaxCommands=this.commands;return Object.keys(response||{}).reduce((executionQueue,key)=>executionQueue.then(()=>{const {command}=response[key];if(command&&ajaxCommands[command])return ajaxCommands[command](this,response[key],status);}),Promise.resolve());};Drupal.Ajax.prototype.success=function(response,status){if(this.progress.element)$(this.progress.element).remove();if(this.progress.object)this.progress.object.stopMonitoring();$(this.element).prop('disabled',false);const elementParents=$(this.element).parents('[data-drupal-selector]').addBack().toArray();const focusChanged=Object.keys(response||{}).some((key)=>{const {command,method}=response[key];return (command==='focusFirst'||command==='openDialog'||(command==='invoke'&&method==='focus'));});return (this.commandExecutionQueue(response,status).then(()=>{if(!focusChanged){let target=false;if(this.element){if($(this.element).data('refocus-blur')&&this.preCommandsFocusedElementSelector)target=document.querySelector(`[data-drupal-selector="${this.preCommandsFocusedElementSelector}"]`);if(!target&&!$(this.element).data('disable-refocus')){for(let n=elementParents.length-1;!target&&n>=0;n--)target=document.querySelector(`[data-drupal-selector="${elementParents[n].getAttribute('data-drupal-selector')}"]`);}}if(target)$(target).trigger('focus');}if(this.$form&&document.body.contains(this.$form.get(0))){const settings=this.settings||drupalSettings;Drupal.attachBehaviors(this.$form.get(0),settings);}this.settings=null;}).catch((error)=>console.error(Drupal.t('An error occurred during the execution of the Ajax response: !error',{'!error':error}))));};Drupal.Ajax.prototype.getEffect=function(response){const type=response.effect||this.effect;const speed=response.speed||this.speed;const effect={};if(type==='none'){effect.showEffect='show';effect.hideEffect='hide';effect.showSpeed='';}else if(type==='fade'){effect.showEffect='fadeIn';effect.hideEffect='fadeOut';effect.showSpeed=speed;}else{effect.showEffect=`${type}Toggle`;effect.hideEffect=`${type}Toggle`;effect.showSpeed=speed;}return effect;};Drupal.Ajax.prototype.error=function(xmlhttprequest,uri,customMessage){if(this.progress.element)$(this.progress.element).remove();if(this.progress.object)this.progress.object.stopMonitoring();$(this.wrapper).show();$(this.element).prop('disabled',false);if(this.$form&&document.body.contains(this.$form.get(0))){const settings=this.settings||drupalSettings;Drupal.attachBehaviors(this.$form.get(0),settings);}throw new Drupal.AjaxError(xmlhttprequest,uri,customMessage);};Drupal.theme.ajaxWrapperNewContent=($newContent,ajax,response)=>(response.effect||ajax.effect)!=='none'&&$newContent.filter((i)=>!(($newContent[i].nodeName==='#comment'||($newContent[i].nodeName==='#text'&&/^(\s|\n|\r)*$/.test($newContent[i].textContent))))).length>1?Drupal.theme('ajaxWrapperMultipleRootElements',$newContent):$newContent;Drupal.theme.ajaxWrapperMultipleRootElements=($elements)=>$('<div></div>').append($elements);Drupal.AjaxCommands=function(){};Drupal.AjaxCommands.prototype={insert(ajax,response){const $wrapper=response.selector?$(response.selector):$(ajax.wrapper);const method=response.method||ajax.method;const effect=ajax.getEffect(response);const settings=response.settings||ajax.settings||drupalSettings;const parseHTML=(htmlString)=>{const fragment=document.createDocumentFragment();const template=fragment.appendChild(document.createElement('template'));template.innerHTML=htmlString;return template.content.childNodes;};let $newContent=$(parseHTML(response.data));
14$newContent=Drupal.theme('ajaxWrapperNewContent',$newContent,ajax,response);switch(method){case 'html':case 'replaceWith':case 'replaceAll':case 'empty':case 'remove':Drupal.detachBehaviors($wrapper.get(0),settings);break;default:break;}$wrapper[method]($newContent);if(effect.showEffect!=='show')$newContent.hide();const $ajaxNewContent=$newContent.find('.ajax-new-content');if($ajaxNewContent.length){$ajaxNewContent.hide();$newContent.show();$ajaxNewContent[effect.showEffect](effect.showSpeed);}else{if(effect.showEffect!=='show')$newContent[effect.showEffect](effect.showSpeed);}$newContent.each((index,element)=>{if(element.nodeType===Node.ELEMENT_NODE&&document.documentElement.contains(element))Drupal.attachBehaviors(element,settings);});},remove(ajax,response,status){const settings=response.settings||ajax.settings||drupalSettings;$(response.selector).each(function(){Drupal.detachBehaviors(this,settings);}).remove();},changed(ajax,response,status){const $element=$(response.selector);if(!$element.hasClass('ajax-changed')){$element.addClass('ajax-changed');if(response.asterisk)$element.find(response.asterisk).append(` <abbr class="ajax-changed" title="${Drupal.t('Changed')}">*</abbr> `);}},alert(ajax,response,status){window.alert(response.text);},announce(ajax,response){if(response.priority)Drupal.announce(response.text,response.priority);else Drupal.announce(response.text);},redirect(ajax,response,status){window.location=response.url;},css(ajax,response,status){$(response.selector).css(response.argument);},settings(ajax,response,status){const ajaxSettings=drupalSettings.ajax;if(ajaxSettings)Drupal.ajax.expired().forEach((instance)=>{if(instance.selector){const selector=instance.selector.replace('#','');if(selector in ajaxSettings)delete ajaxSettings[selector];}});if(response.merge)$.extend(true,drupalSettings,response.settings);else ajax.settings=response.settings;},data(ajax,response,status){$(response.selector).data(response.name,response.value);},focusFirst(ajax,response,status){let focusChanged=false;const container=document.querySelector(response.selector);if(container){const tabbableElements=tabbable(container);if(tabbableElements.length){tabbableElements[0].focus();focusChanged=true;}else{if(isFocusable(container)){container.focus();focusChanged=true;}}}if(ajax.hasOwnProperty('element')&&!focusChanged)ajax.element.focus();},invoke(ajax,response,status){const $element=$(response.selector);$element[response.method](...response.args);},restripe(ajax,response,status){$(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even');},update_build_id(ajax,response,status){document.querySelectorAll(`input[name="form_build_id"][value="${response.old}"]`).forEach((item)=>{item.value=response.new;});},add_css(ajax,response,status){if(typeof response.data==='string'){Drupal.deprecationError({message:'Passing a string to the Drupal.ajax.add_css() method is deprecated in 10.1.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3154948.'});$('head').prepend(response.data);return;}const allUniqueBundleIds=response.data.map(function(style){const uniqueBundleId=style.href;if(!loadjs.isDefined(uniqueBundleId))loadjs(`css!${style.href}`,uniqueBundleId,{before(path,styleEl){Object.keys(style).forEach((attributeKey)=>{styleEl.setAttribute(attributeKey,style[attributeKey]);});}});return uniqueBundleId;});return new Promise((resolve,reject)=>{loadjs.ready(allUniqueBundleIds,{success(){resolve();},error(depsNotFound){const message=Drupal.t(`The following files could not be loaded: @dependencies`,{'@dependencies':depsNotFound.join(', ')});reject(message);}});});},message(ajax,response){const messages=new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector));if(response.clearPrevious)messages.clear();messages.add(response.message,response.messageOptions);},add_js(ajax,response,status){const parentEl=document.querySelector(response.selector||'body');const settings=ajax.settings||drupalSettings;const allUniqueBundleIds=response.data.map((script)=>{const uniqueBundleId=script.src;
14if(!loadjs.isDefined(uniqueBundleId))loadjs(script.src,uniqueBundleId,{async:false,before(path,scriptEl){Object.keys(script).forEach((attributeKey)=>{scriptEl.setAttribute(attributeKey,script[attributeKey]);});parentEl.appendChild(scriptEl);return false;}});return uniqueBundleId;});return new Promise((resolve,reject)=>{loadjs.ready(allUniqueBundleIds,{success(){Drupal.attachBehaviors(parentEl,settings);resolve();},error(depsNotFound){const message=Drupal.t(`The following files could not be loaded: @dependencies`,{'@dependencies':depsNotFound.join(', ')});reject(message);}});});},scrollTop(ajax,response){document.querySelector(response.selector)?.scrollIntoView();}};const stopEvent=(xhr,settings)=>{return (xhr.getResponseHeader('X-Drupal-Ajax-Token')==='1'&&settings.isInProgress&&settings.isInProgress());};$.extend(true,$.event.special,{ajaxSuccess:{trigger(event,xhr,settings){if(stopEvent(xhr,settings))return false;}},ajaxComplete:{trigger(event,xhr,settings){if(stopEvent(xhr,settings)){$.active++;return false;}}}});})(jQuery,window,Drupal,drupalSettings,loadjs,window.tabbable);;
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.