(function(d){var g=function(c){if(c&&c.childNodes){var a=d.makeArray(c.childNodes),e=null;d.each(a,function(a,b){3===b.nodeType?""===b.nodeValue?c.removeChild(b):null!==e?(e.nodeValue+=b.nodeValue,c.removeChild(b)):e=b:(e=null,b.childNodes&&g(b))})}};d.fn.highlightRegex=function(c,a){"object"!==typeof c||"RegExp"==c.constructor.name||c instanceof RegExp||(a=c,c=void 0);"undefined"===typeof a&&(a={});a.className=a.className||"highlight";a.tagType=a.tagType||"i";a.highlight_color=a.highlight_color||
"";a.highlight_bg=a.highlight_bg||"";a.attrs=a.attrs||{};"undefined"===typeof c||""===c.source?d(this).find(a.tagType+"."+a.className).each(function(){d(this).replaceWith(d(this).text());g(d(this).parent().get(0))}):d(this).each(function(){var e=d(this).get(0);g(e);d.each(d.makeArray(e.childNodes),function(e,b){var k;g(b);if(3==b.nodeType){if(!d(b).parent(a.tagType+"."+a.className).length)for(;b.data&&0<=(k=b.data.search(c));){var h=b.data.slice(k).match(c)[0];if(0<h.length){var f=document.createElement(a.tagType);
f.className=a.className;f.style.backgroundColor=a.highlight_bg;f.style.color=a.highlight_color;d(f).attr(a.attrs);var m=b.parentNode;var l=b.splitText(k);b=l.splitText(h.length);h=l.cloneNode(!0);f.appendChild(h);m.replaceChild(f,l)}else break}}else d(b).highlightRegex(c,a)})});return d(this)}})(jQuery);