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

favicon-marquee

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

favicon-marquee - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

2

lib/main.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FaviconMarquee=e():t.FaviconMarquee=e()}(self,(function(){return function(){"use strict";var t={};function e(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}var i=function(){function t(e){var i,s,n,o,a,c;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.size=null!==(i=e.size)&&void 0!==i?i:32,this.text=null!==(s=e.text)&&void 0!==s?s:"SCROLLING TEXT",this.color=null!==(n=e.color)&&void 0!==n?n:"green",this.step=null!==(o=e.step)&&void 0!==o?o:.5,this.font=null!==(a=e.font)&&void 0!==a?a:"Arial, sans-serif",this.marginBottom=null!==(c=e.marginBottom)&&void 0!==c?c:0,this.background=e.background,this.pixelsScrolled=0}var i,s;return i=t,(s=[{key:"start",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3/24;this.favicon=document.createElement("link"),this.favicon.type="image/jpeg",this.favicon.rel="shortcut icon",document.head.appendChild(this.favicon),this.createCanvas(),setInterval((function(){return t.draw()}),e)}},{key:"createCanvas",value:function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.size,this.canvas.height=this.size,this.canvas.hidden=!0,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.size+"px "+this.font,this.textWidth=Math.ceil(this.ctx.measureText(this.text).width)}},{key:"draw",value:function(){this.background?(this.ctx.fillStyle=this.background,this.ctx.rect(0,0,this.size,this.size),this.ctx.fill()):this.ctx.clearRect(0,0,this.size,this.size),this.pixelsScrolled+=this.step,this.pixelsScrolled>this.textWidth+2*this.size&&(this.pixelsScrolled=0);var t=-1*this.pixelsScrolled+this.size;this.ctx.fillStyle=this.color,this.ctx.fillText(this.text,t,this.size-this.marginBottom),this.favicon.href=this.canvas.toDataURL("image/png",.3)}}])&&e(i.prototype,s),t}();return t.default=i,t.default}()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FaviconMarquee=e():t.FaviconMarquee=e()}(self,(function(){return function(){"use strict";var t={};function e(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}var i=function(){function t(e){var i,s,n,a,o,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.size=null!==(i=e.size)&&void 0!==i?i:32,this.text=null!==(s=e.text)&&void 0!==s?s:"SCROLLING TEXT",this.color=null!==(n=e.color)&&void 0!==n?n:"green",this.step=null!==(a=e.step)&&void 0!==a?a:.5,this.font=null!==(o=e.font)&&void 0!==o?o:"Arial, sans-serif",this.marginBottom=null!==(r=e.marginBottom)&&void 0!==r?r:0,this.background=e.background,this.pixelsScrolled=0,this.redraws=0}var i,s;return i=t,(s=[{key:"start",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3/24;this.favicon=document.createElement("link"),this.favicon.type="image/jpeg",this.favicon.rel="shortcut icon",document.head.appendChild(this.favicon),this.createCanvas(),this.interval=setInterval((function(){return t.draw()}),e)}},{key:"stop",value:function(){clearInterval(this.interval)}},{key:"createCanvas",value:function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.size,this.canvas.height=this.size,this.canvas.hidden=!0,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.size+"px "+this.font,this.textWidth=Math.ceil(this.ctx.measureText(this.text).width)}},{key:"draw",value:function(){500===this.redraws&&(this.createCanvas(),this.redraws=0),this.background?(this.ctx.fillStyle=this.background,this.ctx.rect(0,0,this.size,this.size),this.ctx.fill()):this.ctx.clearRect(0,0,this.size,this.size),this.pixelsScrolled+=this.step,this.pixelsScrolled>this.textWidth+2*this.size&&(this.pixelsScrolled=0);var t=-1*this.pixelsScrolled+this.size;this.ctx.fillStyle=this.color,this.ctx.fillText(this.text,t,this.size-this.marginBottom),this.favicon.href=this.canvas.toDataURL("image/png",.3),this.redraws++}}])&&e(i.prototype,s),t}();return t.default=i,t.default}()}));
{
"name": "favicon-marquee",
"version": "1.1.4",
"version": "1.1.5",
"description": "An animated scrolling favicon for your website",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -84,3 +84,3 @@ # favicon-marquee

```
`marquee.stop()` can be used to stop the marquee at any time, after which it can be restarted again with `marquee.start()`.
## Contributing and Issues

@@ -87,0 +87,0 @@

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