1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00
gho tik 36d3bd869b v2_03_73_src
Former-commit-id: 9754914d164fcaabfbb82e89cad744556e1afb18
2017-03-06 11:46:13 -05:00

1 line
1.2 KiB
JavaScript

jQuery.fn.highlight=function(a){function d(b,a){var e=0;if(b.nodeType==3){var c=b.data.toUpperCase().indexOf(a);if(c>=0){e=document.createElement("span");e.className="highlight";c=b.splitText(c);c.splitText(a.length);var g=c.cloneNode(!0);e.appendChild(g);c.parentNode.replaceChild(e,c);e=1}}else if(b.nodeType==1&&b.childNodes&&!/(script|style)/i.test(b.tagName))for(c=0;c<b.childNodes.length;++c)c+=d(b.childNodes[c],a);return e}return this.each(function(){d(this,a.toUpperCase())})}; jQuery.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){with(this.parentNode)replaceChild(this.firstChild,this),normalize()}).end()};$.extend({getUrlVars:function(){for(var a=[],d,b=document.location.href.slice(document.location.href.indexOf("?")+1).split("&"),f=0;f<b.length;f++)d=b[f].split("="),a.push(d[0]),a[d[0]]=d[1];return a},getUrlVar:function(a){return $.getUrlVars()[a]}}); $(document).ready(function(){var a=$.getUrlVar("search");a&&a!=""&&(a=unescape(a))&&$.each(a.split(" "),function(a,b){b!="AND"&&b!="NOT"&&b!="OR"&&b!=""&&b!=" "&&$("#topic_content").highlight(b)&&$("#topic_header_text").highlight(b)&&$("#topic_footer_content").highlight(b)})});