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

node-marquee

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-marquee - npm Package Compare versions

Comparing version 1.0.25 to 1.0.26

2

dist/cdn/index.js

@@ -11,2 +11,2 @@ /*

*/
!function(t){var r={};function i(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=r,i.d=function(e,n,t){i.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(n,e){if(1&e&&(n=i(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)i.d(t,r,function(e){return n[e]}.bind(null,r));return t},i.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(n,"a",n),n},i.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},i.p="/",i(i.s=0)}([function(e,n,t){"use strict";function M(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}t.r(n);function r(e){var n,o=0<arguments.length&&void 0!==e?e:{},o=Object.assign({selector:".node-marquee",speed:1,autoplay:!0,pauseOnHover:!1,source:"innerHTML"},o),a=(n=o.selector)instanceof HTMLElement||n instanceof Window?n:document.querySelector(n);if(null==a)return!1;a.classList.add("node-marquee");var u="innerHTML"==o.source?a.innerHTML:a.innerText,l=0,s=[],c=0,t=!1,r=4,i=!1;function d(){i&&i.disconnect()}m();var f=m.bind(this);window.addEventListener("resize",f,!1);var v=function(){o.pauseOnHover&&L()};a.addEventListener("mouseenter",v,!1);var p=function(){o.pauseOnHover&&g()};a.addEventListener("mouseleave",p,!1);var y=!1;function m(){d(),l=0,s=[],a.innerHTML="",a.style.position="relative",a.style.width="100%",a.style.overflow="hidden",a.style.whiteSpace="nowrap";var e=b().clientWidth;e<a.clientWidth&&(l=Math.ceil(1.5*a.clientWidth/e)),l<r&&(l=r);for(var n=0;n<l-1;n++)b(!0,!0);w(),(i=new MutationObserver(function(e){var n,t=M(e);try{for(t.s();!(n=t.n()).done;){"childList"===n.value.type&&(u=a.innerText,m())}}catch(e){t.e(e)}finally{t.f()}})).observe(a,{childList:!0})}function b(e,n){var t=0<arguments.length&&void 0!==e&&e,r=1<arguments.length&&void 0!==n&&n,i=document.createElement("div");return i.classList.add("node-marquee__el"),i.innerHTML=r?"&nbsp;"+u:u,t&&(i.style.position="absolute",i.style.top="0",i.style.left="0"),i.style.display="inline-block",a.appendChild(i),s.push(i),i}function h(){w(),t&&(y=window.requestAnimationFrame(h.bind(this)))}function w(){c+=o.speed;for(var e=!1,n=0,t=0;t<l;t++){var r=s[t],i=n-c;n+=r.clientWidth,r.style.transform="translate(".concat(i,"px, 0)"),i<-1*r.clientWidth&&(e=r)}e&&(s.push(s.splice(s.indexOf(e),1)[0]),c-=e.clientWidth)}function g(){y||(t=!0,y=window.requestAnimationFrame(h.bind(this)))}function L(){t=!1,y&&(window.cancelAnimationFrame(y),y=!1)}return o.autoplay&&g(),{play:g.bind(this),pause:L.bind(this),destroy:function(){L(),d(),window.removeEventListener("resize",f,!1),a.removeEventListener("mouseenter",v,!1),a.removeEventListener("mouseleave",p,!1),a.innerHTML=u}.bind(this),render:h.bind(this)}}window.nodeMarquee=r}]);
!function(t){var r={};function i(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=r,i.d=function(e,n,t){i.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(n,e){if(1&e&&(n=i(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)i.d(t,r,function(e){return n[e]}.bind(null,r));return t},i.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(n,"a",n),n},i.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},i.p="/",i(i.s=0)}([function(e,n,t){"use strict";function O(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"==typeof e)return l(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,n)}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}t.r(n);function r(e){var n,o=0<arguments.length&&void 0!==e?e:{},o=Object.assign({selector:".node-marquee",speed:1,autoplay:!0,pauseOnHover:!1,source:"innerHTML",applyOuterStyles:!0},o),a=(n=o.selector)instanceof HTMLElement||n instanceof Window?n:document.querySelector(n);if(null==a)return!1;a.classList.add("node-marquee");var u="innerHTML"==o.source?a.innerHTML:a.innerText,l=0,s=[],c=0,t=!1,r=4,i=!1;function d(){i&&i.disconnect()}m();var f=m.bind(this);window.addEventListener("resize",f,!1);var p=function(){o.pauseOnHover&&L()};a.addEventListener("mouseenter",p,!1);var v=function(){o.pauseOnHover&&g()};a.addEventListener("mouseleave",v,!1);var y=!1;function m(){d(),l=0,s=[],a.innerHTML="",o.applyOuterStyles&&(a.style.position="relative",a.style.width="100%",a.style.overflow="hidden",a.style.whiteSpace="nowrap");var e=b().clientWidth;e<a.clientWidth&&(l=Math.ceil(1.5*a.clientWidth/e)),l<r&&(l=r);for(var n=0;n<l-1;n++)b(!0,!0);w(),(i=new MutationObserver(function(e){var n,t=O(e);try{for(t.s();!(n=t.n()).done;){"childList"===n.value.type&&(u=a.innerText,m())}}catch(e){t.e(e)}finally{t.f()}})).observe(a,{childList:!0})}function b(e,n){var t=0<arguments.length&&void 0!==e&&e,r=1<arguments.length&&void 0!==n&&n,i=document.createElement("div");return i.classList.add("node-marquee__el"),i.innerHTML=r?"&nbsp;"+u:u,t&&(i.style.position="absolute",i.style.top="0",i.style.left="0"),i.style.display="inline-block",a.appendChild(i),s.push(i),i}function h(){w(),t&&(y=window.requestAnimationFrame(h.bind(this)))}function w(){c+=o.speed;for(var e=!1,n=0,t=0;t<l;t++){var r=s[t],i=n-c;n+=r.clientWidth,r.style.transform="translate(".concat(i,"px, 0)"),i<-1*r.clientWidth&&(e=r)}e&&(s.push(s.splice(s.indexOf(e),1)[0]),c-=e.clientWidth)}function g(){y||(t=!0,y=window.requestAnimationFrame(h.bind(this)))}function L(){t=!1,y&&(window.cancelAnimationFrame(y),y=!1)}return o.autoplay&&g(),{play:g.bind(this),pause:L.bind(this),destroy:function(){L(),d(),window.removeEventListener("resize",f,!1),a.removeEventListener("mouseenter",p,!1),a.removeEventListener("mouseleave",v,!1),a.innerHTML=u}.bind(this),render:h.bind(this)}}window.nodeMarquee=r}]);

@@ -25,2 +25,3 @@ "use strict";

* @property { "innerHTML" | "innerText" } [source="innerHTML"] The source of text.
* @property { boolean } [applyOuterStyles=true] If you need to apply default style to the outer element.
*/

@@ -51,3 +52,4 @@

pauseOnHover: false,
source: "innerHTML"
source: "innerHTML",
applyOuterStyles: true
};

@@ -149,7 +151,10 @@ prop = Object.assign(DEFAULT_PROP, prop); // check if the element exists

OUTER.style.position = 'relative';
OUTER.style.width = '100%';
OUTER.style.overflow = 'hidden';
OUTER.style.whiteSpace = 'nowrap'; // create first element
if (prop.applyOuterStyles) {
OUTER.style.position = 'relative';
OUTER.style.width = '100%';
OUTER.style.overflow = 'hidden';
OUTER.style.whiteSpace = 'nowrap';
} // create first element
var firstEl = createElement(); // calculate how much elements we need to create in addition to the first one

@@ -156,0 +161,0 @@

@@ -8,2 +8,3 @@ export = nodeMarquee;

* @property [source = "innerHTML"] - <p>The source of text.</p>
* @property [applyOuterStyles = true] - <p>If you need to apply default style to the outer element.</p>
*/

@@ -16,2 +17,3 @@ declare type Prop = {

source?: "innerHTML" | "innerText";
applyOuterStyles?: boolean;
};

@@ -18,0 +20,0 @@

{
"name": "node-marquee",
"version": "1.0.25",
"version": "1.0.26",
"description": "Custom Marquee element with JavaScript",

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

@@ -45,2 +45,3 @@ # Custom Marquee element with JavaScript.

source | "innerHTML" \| "innerText" | "innerHTML" | Text source.
applyOuterStyles | boolean | true | If you need to apply default style to the outer element.

@@ -47,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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