MCPcopy Create free account
hub / github.com/kkroening/ffmpeg-python / highlight

Function highlight

doc/html/_static/doctools.js:69–108  ·  view source on GitHub ↗
(node, addItems)

Source from the content-addressed store, hash-verified

67 */
68jQuery.fn.highlightText = function(text, className) {
69 function highlight(node, addItems) {
70 if (node.nodeType === 3) {
71 var val = node.nodeValue;
72 var pos = val.toLowerCase().indexOf(text);
73 if (pos >= 0 &&
74 !jQuery(node.parentNode).hasClass(className) &&
75 !jQuery(node.parentNode).hasClass("nohighlight")) {
76 var span;
77 var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
78 if (isInSVG) {
79 span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
80 } else {
81 span = document.createElement("span");
82 span.className = className;
83 }
84 span.appendChild(document.createTextNode(val.substr(pos, text.length)));
85 node.parentNode.insertBefore(span, node.parentNode.insertBefore(
86 document.createTextNode(val.substr(pos + text.length)),
87 node.nextSibling));
88 node.nodeValue = val.substr(0, pos);
89 if (isInSVG) {
90 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
91 var bbox = node.parentElement.getBBox();
92 rect.x.baseVal.value = bbox.x;
93 rect.y.baseVal.value = bbox.y;
94 rect.width.baseVal.value = bbox.width;
95 rect.height.baseVal.value = bbox.height;
96 rect.setAttribute('class', className);
97 addItems.push({
98 "parent": node.parentNode,
99 "target": rect});
100 }
101 }
102 }
103 else if (!jQuery(node).is("button, select, textarea")) {
104 jQuery.each(node.childNodes, function() {
105 highlight(this, addItems);
106 });
107 }
108 }
109 var addItems = [];
110 var result = this.each(function() {
111 highlight(this, addItems);

Callers 1

doctools.jsFile · 0.85

Calls 1

jQueryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…