PageSourceSearch

https://www.sd511.org/atis-static.iteriscdn.com/WebApps/SD/SafeTravel4/v1.0/js/bootstrap_utilities.js?v=1.9.16

js sd511.org collected 2026-09-24 12:09:11 UTC 6,449 bytes, 238 lines download raw bytes

1var hashmap = {
2	"road-work": "acon",
3	"restriction": "cvo",
4	"obstructions": "obst",
5	"disturbances": "dstb",
6	"disasters": "dstr",
7	"scheduled-events": "schd",
8	"incidents-accidents": "incd"
9};
10
11var showFeature = null, showError = null;
12
13// function go_to_coords(lng, lat) {
14// 	map.flyTo({
15// 		center: [lng, lat],
16// 		zoom: 15
17// 	});
18// }
19
20function createCookie(name,value,days) {
21	var sameSite = "; SameSite=None; Secure";
22	if (days) {
23		var date = new Date();
24		date.setTime(date.getTime()+(days*24*60*60*1000));
25		var expires = "; expires="+date.toGMTString();
26	}
27	else var expires = "";
28	document.cookie = name+"="+value+expires+"; path=/"+sameSite;
29}
30
31function readCookie(name) {
32	var nameEQ = name + "=";
33	var ca = document.cookie.split(';');
34	for(var i=0;i < ca.length;i++) {
35		var c = ca[i];
36		while (c.charAt(0)==' ') c = c.substring(1,c.length);
37		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
38	}
39	return null;
40}
41
42function removeCookie(name) {
43	createCookie(name,"",-1);
44}
45
46if (!readCookie('visited')) {
47	$(document).ready(function() {
48		$("#newUser").show();
49		createCookie('visited','visited',365);
50	});
51}
52
53// if (!readCookie('waze')) {
54// 	$(document).ready(function(){
55// 		$("#newWaze").show();
56// 		createCookie('waze','waze',365);
57// 	});
58// }
59
60var getCurrentCookie = function() {
61	var locationHash;
62	if ($.cookie("current") !== "") {
63		locationHash = $.cookie("current");
64	} else {
65		locationHash = location.hash.substring(1);
66		$.cookie("current", locationHash, {expires: 365});
67	}
68	return locationHash;
69};
70
71function determineRoute(vars, cat) {
72	var myhash = decodeURIComponent(vars.substring(1).replace(/\+/g,  " ")).split("&");
73	var cat, id, string;
74	for (var i=0; i<myhash.length; i++) { // if the parameter is in the hash, update it.
75		var myInnerHash = myhash[i].split("=");
76		// console.log("#",i, " cat(",myInnerHash[0],") | id(",myInnerHash[1], ")");
77		if (myInnerHash[0] == "cat") {
78			cat = myInnerHash[1];
79		}
80		if (myInnerHash[0] == "id") {
81			id = myInnerHash[1];
82		}
83	}
84	if (cat && id) { //neither are undefined
85		string = cdn_metadata + "icons."+ cat +".geojson";
86		$.ajax({
87			url: string,
88			async: false,    //very important: else my_data will be returned even before we get Json from the url
89			dataType: 'json',
90			success: function (json) {
91				for (var j = 0; j < json.features.length; j++) {
92					if (json.features[j].id == id) {
93						showFeature = json.features[j];
94						//go_to_coords(json.features[j].geometry.coordinates[0],json.features[j].geometry.coordinates[1]);	
95					}
96				}
97				if (showFeature) {
98					showFeature.cat = hashmap[cat];
99					//go_to_coords(showFeature.geometry.coordinates[0],showFeature.geometry.coordinates[1]);	
100				} else {
101					showError = true;
102				}
103			}
104		});
105	}
106}
107
108//  FUNCTION:
109//     setCheckboxStatus
110//  DESCRIPTION:
111//     set the Initial check state for a checkbox based off the url
112//  PARAMS:
113//     element -- checkbox
114
115function setCheckboxStatus(idx){
116	var queryString = location.hash.replace('#','');
117	var anchors = queryString.split('&');
118	// If empty string, then this is the first time this first time the site is used. Leave the checkbox with the default state
119	var index = -1;  //initially set index as "not found"
120	var $el = document.querySelector("#cbx_"+idx);
121	if (!Array.prototype.indexOf) {
122		index = ArrayElementIndex(anchors, idx);
123	} else {
124		index = anchors.indexOf(idx);
125	}
126	// If idx is a parameter in the query string, set the element as checked.
127	if (index > -1){
128		$el.checked = true;
129		switch(idx) {
130			case "trfc":
131				map.setLayoutProperty(currentTrafficLayer, 'visibility', 'visible');
132				break;
133			case "radar":
134				map.setLayoutProperty(currentRadarLayer, 'visibility', 'visible');
135				break;
136			case "temp":
137				map.setLayoutProperty(currentTempLayer, 'visibility', 'visible');
138				break;
139			case "wind":
140				map.setLayoutProperty(currentWindLayer, 'visibility', 'visible');
141				break;
142			default:
143				map.setLayoutProperty(idx, 'visibility', 'visible');
144				break;
145		}
146	} else {
147		$el.checked = false;
148		switch(idx) {
149			case "trfc":
150				map.setLayoutProperty(currentTrafficLayer, 'visibility', 'none');
151				break;
152			case "radar":
153				map.setLayoutProperty(currentRadarLayer, 'visibility', 'none');
154				break;
155			default:
156				map.setLayoutProperty(idx, 'visibility', 'none');
157				break;
158		}
159	}
160	//setVisibilityFromCheckboxState(idx);
161}
162
163function updateURL(cbox) {
164	var layer = cbox.split('_')[1];
165	document.querySelector('input#'+cbox).checked?addAnchorToURL(layer):removeAnchorFromURL(layer);
166}
167
168//  FUNCTION:
169//     addAnchorToURL
170//  DESCRIPTION:
171//     Adds an anchor to the url.
172//  PARAMS:
173//     inAnchor {String} -- anchor to be added to the url
174function addAnchorToURL(inAnchor) {
175	var queryString  =  location.hash.substring(1).split("&");
176	if (queryString.indexOf(inAnchor) === -1) {
177		queryString.push(inAnchor);
178	}
179	location.replace("#"+queryString.join('&'));
180	updateCookie();
181};
182
183//  FUNCTION:
184//     removeAnchorFromURL
185//  DESCRIPTION:
186//     remove an anchor from the url.
187//  PARAMS:
188//     inAnchor {String} -- anchor to be removed from the url
189
190function removeAnchorFromURL(inAnchor) {
191	var queryString = [], anchors = location.hash.substring(1).split("&");
192	$.each(anchors, function(k,v) {
193		if (v !== inAnchor) {
194			queryString.push(v);
195		}
196	});
197	location.replace("#"+queryString.join("&"));
198	updateCookie();
199};
200
201function ArrayElementIndex(inArray, inString){
202	var index = 0;
203	for(index = 0; index < inArray.length; index++){
204		if(inArray[index] == inString){
205			return index;
206		}
207	}
208	return -1;
209};
210
211function setVisibilityFromCheckboxState(element) {
212	var $el = document.querySelector("#cbx_"+element);
213	$el.checked ? addAnchorToURL(element) : removeAnchorFromURL(element);
214	if(!map.getLayer(element)) return;
215	if($el.checked) {
216		map.setLayoutProperty(element, 'visibility', 'visible');
217		//this.toggleLegend(element, true);
218		// gtag('event','Layer Active', {
219		// 	"Checked": $el.id
220		// });
221		window.dataLayer.push({
222			'event': 'Layer Active',
223			"Checked": $el.id
224		});
225		//_paq.push(['trackEvent', 'Layers', "Layer Active", $el.id]);
226	} else {
227		map.setLayoutProperty(element, 'visibility', 'none');
228		//this.toggleLegend(element, false);
229		// gtag('event','Layer Inactive', {
230		// 	"Unchecked": $el.id
231		// });
232		window.dataLayer.push({
233			'event': 'Layer Inactive',
234			"Unchecked": $el.id
235		});
236		//_paq.push(['trackEvent', 'Layers', "Layer Inactive", $el.id]);
237	}
238}

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.