PageSourceSearch

https://www.szamlazz.hu/szamla/javascript/jquery.highlight-4.js

js szamlazz.hu collected 2026-09-24 08:41:33 UTC 1,379 bytes, 53 lines download raw bytes

1/*
2
3highlight v4
4
5Highlights arbitrary terms.
6
7<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
8
9MIT license.
10
11Johann Burkard
12<http://johannburkard.de>
13<mailto:[email protected]>
14
15*/
16
17jQuery.fn.highlight = function(pat) {
18 function innerHighlight(node, pat) {
19  var skip = 0;
20  if (node.nodeType == 3) {
21   var pos = node.data.toUpperCase().indexOf(pat.toUpperCase());
22   if (pos >= 0) {
23    var spannode = document.createElement('span');
24    spannode.className = 'highlight';
25    var middlebit = node.splitText(pos);
26    var endbit = middlebit.splitText(pat.length);
27    var middleclone = middlebit.cloneNode(true);
28    spannode.appendChild(middleclone);
29    middlebit.parentNode.replaceChild(spannode, middlebit);
30    skip = 1;
31   }
32  }
33  else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
34   for (var i = 0; i < node.childNodes.length; ++i) {
35    i += innerHighlight(node.childNodes[i], pat);
36   }
37  }
38  return skip;
39 }
40 return this.length && pat && pat.length ? this.each(function() {
41  innerHighlight(this, pat.toUpperCase());
42 }) : this;
43};
44
45jQuery.fn.removeHighlight = function() {
46 return this.find("span.highlight").each(function() {
47  this.parentNode.firstChild.nodeName;
48  with (this.parentNode) {
49   replaceChild(this.firstChild, this);
50   normalize();
51  }
52 }).end();
53};

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.