Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hrjs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hrjs - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

package.json
{
"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;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc