Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "hrjs", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Tiny JavaScript plugin for gighlighting and replacing text in the dom", | ||
@@ -21,2 +21,2 @@ "main": "src/hr.min.js", | ||
"homepage": "https://mburakerman.github.io/hrjs/" | ||
} | ||
} |
@@ -1,1 +0,2 @@ | ||
var HR=function(n,o){this.el=document.querySelectorAll(n);this.options=o||{}};HR.prototype.defaultOptions={highlight:null,replaceWith:null,backgroundColor:"#FFDE70"};HR.prototype.bcolor=function(n){var o=n.querySelectorAll('[data-hr]');for(var e=0;e<o.length;e++)o[e].style.backgroundColor=this.defaultOptions.backgroundColor,typeof this.options.backgroundColor!=='undefined'&&(o[e].style.backgroundColor=this.options.backgroundColor)};HR.prototype.hr=function(){for(var n=0;n<this.el.length;n++){if(typeof this.options.replaceWith==='undefined'&&typeof this.options.highlight!=='undefined'){if(Array.isArray(this.options.highlight)){for(var o=0;o<this.options.highlight.length;o++)this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp("("+this.options.highlight[o]+")",'gi'),'<span data-hr>$1</span>')}else this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp("("+this.options.highlight+")",'i'),'<span data-hr>$1</span>');this.bcolor(this.el[n])}if(typeof this.options.highlight!=='undefined'&&this.options.highlight!==null&&(typeof this.options.replaceWith!=='undefined'&&this.options.replaceWith!==null)){if(Array.isArray(this.options.highlight)&&Array.isArray(this.options.replaceWith)){for(var e=0;e<this.options.highlight.length;e++)typeof this.options.replaceWith[e]!=='undefined'&&(this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp(this.options.highlight[e],'gi'),'<span data-hr>'+this.options.replaceWith[e]+'</span>'))}else this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp(this.options.highlight,'gi'),'<span data-hr>'+this.options.replaceWith+'</span>');this.bcolor(this.el[n])}}} | ||
var HR=function(n,o){this.el=document.querySelectorAll(n);this.options=o||{}};HR.prototype.defaultOptions={highlight:null,replaceWith:null,backgroundColor:"#FFDE70"};HR.prototype.bcolor=function(n){var o=n.querySelectorAll('[data-hr]');for(var e=0;e<o.length;e++)o[e].style.backgroundColor=this.defaultOptions.backgroundColor,typeof this.options.backgroundColor!=='undefined'&&(o[e].style.backgroundColor=this.options.backgroundColor)};HR.prototype.hr=function(){for(var n=0;n<this.el.length;n++){if(typeof this.options.replaceWith==='undefined'&&typeof this.options.highlight!=='undefined'){if(Array.isArray(this.options.highlight)){for(var o=0;o<this.options.highlight.length;o++)this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp("("+this.options.highlight[o]+")",'gi'),'<span data-hr>$1</span>')}else this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp("("+this.options.highlight+")",'i'),'<span data-hr>$1</span>');this.bcolor(this.el[n])}if(typeof this.options.highlight!=='undefined'&&this.options.highlight!==null&&(typeof this.options.replaceWith!=='undefined'&&this.options.replaceWith!==null)){if(Array.isArray(this.options.highlight)&&Array.isArray(this.options.replaceWith)){for(var e=0;e<this.options.highlight.length;e++)typeof this.options.replaceWith[e]!=='undefined'&&(this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp(this.options.highlight[e],'gi'),'<span data-hr>'+this.options.replaceWith[e]+'</span>'))}else this.el[n].innerHTML=this.el[n].innerHTML.replace(new RegExp(this.options.highlight,'gi'),'<span data-hr>'+this.options.replaceWith+'</span>');this.bcolor(this.el[n])}}} | ||
module.exports = HR; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45731
252