PageSourceSearch

https://crabsonthebeach.com/assets/js/webpages.js

js crabsonthebeach.com collected 2026-10-10 01:08:21 UTC 4,614 bytes, 156 lines download raw bytes

1
2/** Remove Panel
3	Function called by app.js on panel Close (remove)
4	************************************************** **/
5	function _closePanel(panel_id) {
6	/** 
7		EXAMPLE - LOCAL STORAGE PANEL REMOVE|UNREMOVE
8
9		// SET PANEL HIDDEN
10		localStorage.setItem(panel_id, 'closed');
11		
12		// SET PANEL VISIBLE
13		localStorage.removeItem(panel_id);
14		**/	
15	}
16
17	/** Get Cookie **/
18	function getCookie(cname) {
19		var name = cname + "=";
20		var ca = document.cookie.split(';');
21		for(var i = 0; i <ca.length; i++) {
22			var c = ca[i];
23			while (c.charAt(0)==' ') {
24				c = c.substring(1);
25			}
26			if (c.indexOf(name) == 0) {
27				return c.substring(name.length,c.length);
28			}
29		}
30		return "";
31	}
32	
33	/** Code to manage roles protection on content of a page **/
34// Get client role from cookie
35var loggedin_client_role = getCookie("client_role");
36
37document.addEventListener('DOMContentLoaded',function(){
38	// show the content related to logged in client role
39	$(".roleclass_"+loggedin_client_role).show();
40	
41	// remove all the content divs which are not related to that role
42	$(".roleclass:hidden").remove();
43});
44
45function getParameterByName(name, url) {
46	if (!url) {
47		url = window.location.href;
48	}
49	if (!name) {
50		name = '';
51	}
52	name = name.replace(/[\[\]]/g, "\\$&");
53	var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
54	results = regex.exec(url);
55	if (!results) return null;
56	if (!results[2]) return '';
57	return decodeURIComponent(results[2].replace(/\+/g, " "));
58}
59$.extend($.expr[":"], {
60	"containsIN": function(elem, i, match, array) {
61		return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
62	}
63});
64document.addEventListener('DOMContentLoaded',function(){
65
66    // pull in the new value
67    var search_param = getParameterByName('search_param');
68
69    // remove any old highlighted terms
70    $('body').removeHighlight();
71
72    // disable highlighting if empty
73    if (search_param != '' && getParameterByName(search_param) != '') {
74        // highlight the new term
75        $('body').highlight(getParameterByName(search_param));
76        $('input[name="'+search_param+'"]').val(getParameterByName(search_param));
77    }
78
79    //Directory search form scripts start
80    $(document).on('change','select[name="directory_category"]',function(){
81    	var cat_id = $(this).val();
82    	if( cat_id > 0 ){
83    		var queries_url = '/action/queries.php';
84			$.post(queries_url, {form_action:'get_directory_subcategories',catid:cat_id}, function(data){
85	    		$('select[name="directory_subcategory"]').html($.trim(data));
86    		});
87    	}else{
88    		$('select[name="directory_subcategory"]').html('<option value="">Select Category</option>');
89    	}
90    });
91    //Directory search form scripts end
92
93});
94jQuery.fn.highlight = function(pat) {
95	if(!pat) return;
96	function innerHighlight(node, pat) {
97		var skip = 0;
98		if (node.nodeType == 3) {
99			var pos = node.data.toUpperCase().indexOf(pat);
100			if (pos >= 0) {
101				var spannode = document.createElement('span');
102				spannode.className = 'highlight';
103				var middlebit = node.splitText(pos);
104				var endbit = middlebit.splitText(pat.length);
105				var middleclone = middlebit.cloneNode(true);
106				spannode.appendChild(middleclone);
107				middlebit.parentNode.replaceChild(spannode, middlebit);
108				skip = 1;
109			}
110		} else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
111			for (var i = 0; i < node.childNodes.length; ++i) {
112				i += innerHighlight(node.childNodes[i], pat);
113			}
114		}
115		return skip;
116	}
117	return this.each(function() {
118		innerHighlight(this, pat.toUpperCase());
119	});
120};
121
122jQuery.fn.removeHighlight = function() {
123
124	function newNormalize(node) {
125		for (var i = 0, children = node.childNodes, nodeCount = children.length; i < nodeCount; i++) {
126			var child = children[i];
127
128			if (child.nodeType == 1) {
129
130				newNormalize(child);
131				continue;
132			}
133
134			if (child.nodeType != 3) {
135				continue;
136			}
137			var next = child.nextSibling;
138			if (next == null || next.nodeType != 3) {
139				continue;
140			}
141			var combined_text = child.nodeValue + next.nodeValue;
142			new_node = node.ownerDocument.createTextNode(combined_text);
143			node.insertBefore(new_node, child);
144			node.removeChild(child);
145			node.removeChild(next);
146			i--;
147			nodeCount--;
148		}
149	}
150
151	return this.find("span.highlight").each(function() {
152		var thisParent = this.parentNode;
153		thisParent.replaceChild(this.firstChild, this);
154		newNormalize(thisParent);
155	}).end();
156};

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.