node-marquee
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -11,2 +11,2 @@ /* | ||
*/ | ||
!function(n){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i(i.s=0)}([function(e,t,n){"use strict";function w(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}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 r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.r(t);function r(e){var o=0<arguments.length&&void 0!==e?e:{};o=Object.assign({selector:".node-marquee",speed:1,autoplay:!0},o);var t,a=(t=o.selector)instanceof HTMLElement||t instanceof Window?t:document.querySelector(t);if(null==a)return!1;a.classList.add("node-marquee");var u=a.innerText,l=0,c=[],s=0,n=!1,r=5,i=!1;function d(){i&&i.disconnect()}p();var f=p.bind(this);window.addEventListener("resize",f,!1);var y=!1;function p(){d(),l=0,c=[],a.innerHTML="",a.style.position="relative",a.style.width="100%",a.style.overflow="hidden",a.style.whiteSpace="nowrap";var e=v().clientWidth;e<a.clientWidth&&(l=Math.ceil(a.clientWidth/e)),l<r&&(l=r);for(var t=0;t<l-1;t++)v(!0,!0);b(),(i=new MutationObserver(function(e){var t,n=w(e);try{for(n.s();!(t=n.n()).done;){"childList"===t.value.type&&(u=a.innerText,p())}}catch(e){n.e(e)}finally{n.f()}})).observe(a,{childList:!0})}function v(e,t){var n=0<arguments.length&&void 0!==e&&e,r=1<arguments.length&&void 0!==t&&t,i=document.createElement("div");return i.classList.add("node-marquee__el"),i.innerHTML=r?" "+u:u,n&&(i.style.position="absolute",i.style.top="0",i.style.left="0"),i.style.display="inline-block",a.appendChild(i),c.push(i),i}function b(){s+=o.speed;for(var e=!1,t=0,n=0;n<l;n++){var r=c[n],i=t-s;t+=r.clientWidth,r.style.transform="translate(".concat(i,"px, 0)"),i<-1*r.clientWidth&&(e=r)}e&&(c.push(c.splice(c.indexOf(e),1)[0]),s-=e.clientWidth)}function h(){y||(n=!0,y=window.requestAnimationFrame(function e(){b(),n&&(y=window.requestAnimationFrame(e.bind(this)))}.bind(this)))}function m(){n=!1,y&&(window.cancelAnimationFrame(y),y=!1)}return o.autoplay&&h(),{play:h.bind(this),pause:m.bind(this),destroy:function(){m(),d(),a.innerHTML=u}.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 g(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,n){if(!e)return;if("string"==typeof e)return u(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(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return u(e,n)}(e))){var n=0,t=function(){};return{s:t,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t}}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 r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function u(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 o=0<arguments.length&&void 0!==e?e:{};o=Object.assign({selector:".node-marquee",speed:1,autoplay:!0},o);var n,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=a.innerText,l=0,c=[],s=0,t=!1,r=5,i=!1;function d(){i&&i.disconnect()}p();var f=p.bind(this);window.addEventListener("resize",f,!1);var y=!1;function p(){d(),l=0,c=[],a.innerHTML="",a.style.position="relative",a.style.width="100%",a.style.overflow="hidden",a.style.whiteSpace="nowrap";var e=v().clientWidth;e<a.clientWidth&&(l=Math.ceil(a.clientWidth/e)),l<r&&(l=r);for(var n=0;n<l-1;n++)v(!0,!0);h(),(i=new MutationObserver(function(e){var n,t=g(e);try{for(t.s();!(n=t.n()).done;){"childList"===n.value.type&&(u=a.innerText,p())}}catch(e){t.e(e)}finally{t.f()}})).observe(a,{childList:!0})}function v(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?" "+u:u,t&&(i.style.position="absolute",i.style.top="0",i.style.left="0"),i.style.display="inline-block",a.appendChild(i),c.push(i),i}function b(){h(),t&&(y=window.requestAnimationFrame(b.bind(this)))}function h(){s+=o.speed;for(var e=!1,n=0,t=0;t<l;t++){var r=c[t],i=n-s;n+=r.clientWidth,r.style.transform="translate(".concat(i,"px, 0)"),i<-1*r.clientWidth&&(e=r)}e&&(c.push(c.splice(c.indexOf(e),1)[0]),s-=e.clientWidth)}function m(){y||(t=!0,y=window.requestAnimationFrame(b.bind(this)))}function w(){t=!1,y&&(window.cancelAnimationFrame(y),y=!1)}return o.autoplay&&m(),{play:m.bind(this),pause:w.bind(this),destroy:function(){w(),d(),a.innerHTML=u}.bind(this),render:b.bind(this)}}window.nodeMarquee=r}]); |
@@ -29,2 +29,4 @@ "use strict"; | ||
* @property {Function} pause | ||
* @property {Function} destroy | ||
* @property {Function} render | ||
*/ | ||
@@ -239,3 +241,4 @@ | ||
pause: pause.bind(this), | ||
destroy: destroy.bind(this) | ||
destroy: destroy.bind(this), | ||
render: render.bind(this) | ||
}; | ||
@@ -242,0 +245,0 @@ } |
@@ -18,2 +18,4 @@ export = nodeMarquee; | ||
* @property {Function} pause | ||
* @property {Function} destroy | ||
* @property {Function} render | ||
*/ | ||
@@ -23,2 +25,4 @@ declare type Returns = { | ||
pause: (...params: any[]) => any; | ||
destroy: (...params: any[]) => any; | ||
render: (...params: any[]) => any; | ||
}; | ||
@@ -25,0 +29,0 @@ |
{ | ||
"name": "node-marquee", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "Custom Marquee element with JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
646338
1310