PageSourceSearch

https://jug-zueri.ch/modules/mod_ebajaxsearch/assets/js/eb_ajaxsearch.js

js jug-zueri.ch collected 2026-10-04 01:28:42 UTC 2,135 bytes, 60 lines download raw bytes

1jQuery.fn.ebajaxsearchhighlight = function(pat) {���
2 function innerHighlight(node, pat) {���
3  var skip = 0;���
4  if (node.nodeType == 3) {���
5   var pos = node.data.toUpperCase().indexOf(pat);���
6   if (pos >= 0) {���
7    var spannode = document.createElement('mark');���
8    spannode.className = 'highlight';���
9    var middlebit = node.splitText(pos);���
10    var endbit = middlebit.splitText(pat.length);���
11    var middleclone = middlebit.cloneNode(true);���
12    spannode.appendChild(middleclone);���
13    middlebit.parentNode.replaceChild(spannode, middlebit);���
14    skip = 1;���
15   }���
16  }���
17  else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {���
18   for (var i = 0; i < node.childNodes.length; ++i) {���
19    i += innerHighlight(node.childNodes[i], pat);���
20   }���
21  }���
22  return skip;���
23 }���
24 return this.each(function() {���
25  innerHighlight(this, pat.toUpperCase());���
26 });���
27};���
28���
29jQuery.fn.removeHighlight = function() {���
30 function newNormalize(node) {���
31    for (var i = 0, children = node.childNodes, nodeCount = children.length; i < nodeCount; i++) {���
32        var child = children[i];���
33        if (child.nodeType == 1) {���
34            newNormalize(child);���
35            continue;���
36        }���
37        if (child.nodeType != 3) { continue; }���
38        var next = child.nextSibling;���
39        if (next == null || next.nodeType != 3) { continue; }���
40        var combined_text = child.nodeValue + next.nodeValue;���
41        new_node = node.ownerDocument.createTextNode(combined_text);���
42        node.insertBefore(new_node, child);���
43        node.removeChild(child);���
44        node.removeChild(next);���
45        i--;���
46        nodeCount--;���
47    }���
48 }���
49���
50 return this.find("mark.highlight").each(function() {���
51    var thisParent = this.parentNode;���
52    thisParent.replaceChild(this.firstChild, this);���
53    newNormalize(thisParent);���
54 }).end();���
55};���
56���
57function replaceNbsps(str) {���
58  var re = new RegExp(String.fromCharCode(160), "g");���
59  return str.replace(re, " ");���
60}

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.