PageSourceSearch

https://www.diginow.co.uk/js/Front/search/ajax.url.update.js

js diginow.co.uk collected 2026-10-06 07:18:53 UTC 2,397 bytes, 71 lines download raw bytes

1var objQueryString={};
2
3//Get querystring value
4function getParameterByName(name) {
5    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
6    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
7    results = regex.exec(location.search);
8    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
9}
10
11//Add or modify querystring
12function changeUrl(key,value) {
13	//Get query string value
14	var searchUrl=location.search;
15	searchUrl = decodeURIComponent(searchUrl.replace(/\+/g, " "));
16
17	if(searchUrl.indexOf("?")== "-1") {
18		var urlValue='?'+key+'='+value;
19		history.pushState({state:1, rand: Math.random()}, '', urlValue);
20	}
21	else {
22		//Check for key in query string, if not present
23		if(searchUrl.indexOf(key)== "-1") {
24			var urlValue=searchUrl+'&'+key+'='+value;
25		}
26		else {	//If key present in query string
27			oldValue = getParameterByName(key);
28			if(searchUrl.indexOf("?"+key+"=")!= "-1") {
29				urlValue = searchUrl.replace('?'+key+'='+oldValue,'?'+key+'='+value);
30			}
31			else {
32				urlValue = searchUrl.replace('&'+key+'='+oldValue,'&'+key+'='+value);	
33			}
34		}
35		history.pushState({state:1, rand: Math.random()}, '', urlValue);
36		//history.pushState function is used to add history state.
37		//It takes three parameters: a state object, a title (which is currently ignored), and (optionally) a URL.
38	}
39}
40
41//Function used to remove querystring
42function removeQString(key,value) {
43	var urlValue=document.location.href;
44	urlValue = decodeURIComponent(urlValue.replace(/\+/g, " "));
45	
46	//Get query string value
47	var searchUrl=location.search;
48	searchUrl = decodeURIComponent(searchUrl.replace(/\+/g, " "));
49	
50	if(key!="") {
51		oldValue = getParameterByName(key);
52		removeVal=key+"="+oldValue;
53		if(searchUrl.indexOf('?'+removeVal+'&')!= "-1") {
54			urlValue=urlValue.replace('?'+removeVal+'&','?');
55		}
56		else if(searchUrl.indexOf('&'+removeVal+'&')!= "-1") {
57			urlValue=urlValue.replace('&'+removeVal+'&','&');
58		}
59		else if(searchUrl.indexOf('?'+removeVal)!= "-1") {
60			urlValue=urlValue.replace('?'+removeVal,'');
61		}
62		else if(searchUrl.indexOf('&'+removeVal)!= "-1") {
63			urlValue=urlValue.replace('&'+removeVal,'');
64		}
65	}
66	else {
67		var searchUrl=location.search;
68		urlValue=urlValue.replace(searchUrl,'');
69	}
70	history.pushState({state:1, rand: Math.random()}, '', urlValue);
71}

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.