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.26 to 2.0.1

dist/cjs/index.js

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 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}]);
!function(e){var n={};function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:i})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(i,r,function(n){return e[n]}.bind(null,r));return i},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/",t(t.s=0)}([function(e,n,t){"use strict";function i(e){return e instanceof HTMLElement||e instanceof Element}function r(e,n){if(e instanceof Window)return e;if(i(e))return e;if(void 0!==n){const t=r(n);if(t)return t.querySelector(e)}return document.querySelector(e)}t.r(n),window.nodeMarquee=function(e={}){const n="node-marquee",t=r((e=Object.assign({selector:".node-marquee",speed:1,autoplay:!0,pauseOnHover:!1,applyOuterStyles:!0},e)).selector);if(!i(t))return!1;t.classList.add(n);let o=t.innerHTML,s=0,u=[],l=0,c=!1,d=!1;const a=b.bind(this),f=function(){e.pauseOnHover&&O()}.bind(this),p=function(){e.pauseOnHover&&L()}.bind(this);b();let y=!1;function b(){v(),s=0,u=[],t.innerHTML="",e.applyOuterStyles&&(t.style.position="relative",t.style.width="100%",t.style.overflow="hidden",t.style.whiteSpace="nowrap");let n=m().clientWidth;n<=0&&(n=window.innerWidth),n<t.clientWidth&&(s=Math.ceil(1.5*t.clientWidth/n)),s<4&&(s=4);for(let e=0;e<s-1;e++)m(!0,!0);w(),function(){const e={childList:!0};d=new MutationObserver(e=>{for(const n of e)"childList"===n.type&&(o=t.innerHTML,b())}),d.observe(t,e)}()}function m(e=!1,n=!1){const i=document.createElement("div");return i.classList.add("node-marquee__el"),i.innerHTML=n?"&nbsp;"+o:o,e&&(i.style.position="absolute",i.style.top="0",i.style.left="0"),i.style.display="inline-block",t.appendChild(i),u.push(i),i}function v(){d&&d.disconnect()}function h(){w(),c&&(y=window.requestAnimationFrame(h.bind(this)))}function w(){l+=e.speed;let n=!1,t=0;for(let e=0;e<s;e++){const i=u[e],r=t-l;t+=i.clientWidth,i.style.transform=`translate(${r}px, 0)`,r<-1*i.clientWidth&&(n=i)}n&&(u.push(u.splice(u.indexOf(n),1)[0]),l-=n.clientWidth)}function L(){y||(c=!0,y=window.requestAnimationFrame(h.bind(this)))}function O(){c=!1,y&&(window.cancelAnimationFrame(y),y=!1)}return e.autoplay&&L(),window.addEventListener("resize",a,!1),t.addEventListener("mouseenter",f,!1),t.addEventListener("mouseleave",p,!1),{play:L.bind(this),pause:O.bind(this),isPlaying:()=>c,render:w.bind(this),recreate:b.bind(this),destroy:function(){O(),v(),window.removeEventListener("resize",a,!1),t.removeEventListener("mouseenter",f,!1),t.removeEventListener("mouseleave",p,!1),t.innerHTML=o}.bind(this)}}}]);

@@ -1,30 +0,54 @@

export = nodeMarquee;
/**
* @property [selector = .node-marquee] - <p>The selector of the element or the elements itself.</p>
* @property [speed = 1] - <p>The amount of pixels to move with each frame.</p>
* @property [autoplay = true] - <p>If you want the marquee element to start moving after its initializing.</p>
* @property [pauseOnHover = false] - <p>Stop the marquee on hover.</p>
* @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>
*/
declare type Prop = {
selector?: string | HTMLElement;
export interface NodeMarqueeProp {
/**
* The selector of the element or the elements itself.
* @default '.node-marquee'
*/
selector?: HTMLElement | string;
/**
* The amount of pixels to move with each frame.
* @default 1
*/
speed?: number;
/**
* If you want the marquee element to start moving after its initializing.
* @default true
*/
autoplay?: boolean;
/**
* Stop the marquee on hover
* @default false
*/
pauseOnHover?: boolean;
source?: "innerHTML" | "innerText";
/**
* If you need to apply default style to the outer element
* @default true
*/
applyOuterStyles?: boolean;
};
declare type Returns = {
play: (...params: any[]) => any;
pause: (...params: any[]) => any;
destroy: (...params: any[]) => any;
render: (...params: any[]) => any;
};
/**
* @returns <p>Returns a set of methods.</p>
*/
declare function nodeMarquee(prop: Prop): Returns | false;
}
export interface NodeMarquee {
/**
* Start the marquee animation
*/
play: () => void;
/**
* Stop the marquee animation
*/
pause: () => void;
/**
* Check if animation is launched
*/
isPlaying: () => boolean;
/**
* Render the marquee
*/
render: () => void;
/**
* Destroy and create
*/
recreate: () => void;
/**
* Destroy the marquee
*/
destroy: () => void;
}
//# sourceMappingURL=types.d.ts.map
{
"name": "node-marquee",
"version": "1.0.26",
"description": "Custom Marquee element with JavaScript",
"main": "dist/index.js",
"jsdelivr": "dist/cdn/index.js",
"types": "dist/types/types.d.ts",
"version": "2.0.1",
"description": "Custom Marquee element",
"scripts": {
"dev": "NODE_ENV=development webpack --config ./webpack/webpack.dev.conf.js",
"build": "NODE_ENV=production webpack --config ./webpack/webpack.build.conf.js",
"start": "webpack-dev-server --config ./webpack/webpack.dev.conf.js",
"docs": "npm run docs:default && npm run docs:types",
"docs:default": "./node_modules/.bin/jsdoc -c jsdoc/jsdoc.json -R README.md",
"docs:types": "./node_modules/.bin/jsdoc -c jsdoc/jsdoc.types.json && node jsdoc/exportJsDoc.js",
"prepare": "npm version patch && npm run prepare:cjs && npm run docs && npm run build && npm run prepare:cdn",
"prepare:cjs": "NODE_ENV=cjs babel ./src --out-dir ./dist",
"release": "npm publish",
"prepare": "npm version patch && npm run prepare:all && npm run docs && npm run demo-build",
"docs": "typedoc --out docs ./src/ts --theme default --hideGenerator",
"prepare:all": "npm run prepare:es && npm run prepare:cjs && npm run prepare:cdn",
"prepare:es": "tsc ./src/ts/index.ts --allowJs true --outDir ./dist/es --target es6 --moduleResolution node --declaration true --declarationDir ./dist/types --declarationMap true",
"prepare:cjs": "tsc ./src/ts/index.ts --allowJs true --outDir ./dist/cjs --target es5 --module commonjs",
"prepare:cdn": "NODE_ENV=production webpack --config ./webpack/webpack.cdn.conf.js",
"release": "npm publish"
"demo-build": "NODE_ENV=production webpack --config ./webpack/webpack.build.conf.js",
"demo-start": "webpack-dev-server --config ./webpack/webpack.dev.conf.js",
"lint:js": "eslint . --ext .ts,.js",
"lint:scss": "npx stylelint \"**/*.scss\"",
"precommit": "npm run lint:js && npm run lint:scss"
},
"main": "dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"module": "./dist/es/index.js",
"jsdelivr": "dist/cdn/index.js",
"repository": {

@@ -25,46 +28,47 @@ "type": "git",

"keywords": [
"marquee",
"js",
"text"
"keyword"
],
"author": "Anthony Bobrov <anton.bobrov@hotmail.com>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.8.4",
"@pixi/jsdoc-template": "^2.4.2",
"autoprefixer": "^9.7.4",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-polyfill": "^6.26.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.4",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.0.3",
"css-loader": "^4.2.2",
"css-mqpacker": "^7.0.0",
"cssnano": "^4.1.10",
"eslint": "^6.8.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-jsdoc": "^15.9.2",
"file-loader": "^5.0.2",
"fs": "0.0.1-security",
"html-webpack-plugin": "^3.2.0",
"imagemin-webpack-plugin": "^2.4.2",
"jsdoc": "^3.6.3",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.13.1",
"normalize-scss": "^7.0.1",
"path": "^0.12.7",
"eslint": "^7.5.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.0.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"file-loader": "^6.0.0",
"html-webpack-plugin": "^4.3.0",
"mini-css-extract-plugin": "^0.10.0",
"postcss-loader": "^3.0.0",
"sass-lint": "^1.13.1",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"ts-loader": "^6.2.1",
"tsd-jsdoc": "^2.3.0",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^4.2.2"
"sass": "^1.26.10",
"sass-loader": "^10.0.1",
"source-map": "^0.7.3",
"style-loader": "^1.2.1",
"stylelint": "^13.6.1",
"stylelint-scss": "^3.18.0",
"terser-webpack-plugin": "^4.1.0",
"ts-loader": "^8.0.3",
"typedoc": "^0.18.0",
"typescript": "^4.0.2",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.1.2",
"normalize-scss": "^7.0.1"
},
"dependencies": {
"vevet-dom": "0.0.4"
}
}

@@ -1,5 +0,3 @@

# Custom Marquee element with JavaScript.
# Custom Marquee element
## Documentation: https://antonbobrov.github.io/node-marquee/

@@ -32,26 +30,2 @@

});
```
## Settings
Option | Type | Default | Description
------ | ---- | ------- | -----------
selector | string\|HTMLElement | .node-marquee | The selector of the element or the elements itself.
speed | number | 1 | The amount of pixels to move with each frame.
autoplay | boolean | true | If you want the marquee element to start moving after its initializing.
pauseOnHover | boolean | false | Pause animation on mouse enter.
source | "innerHTML" \| "innerText" | "innerHTML" | Text source.
applyOuterStyles | boolean | true | If you need to apply default style to the outer element.
## Methods
Method Name | Description
----------- | -----------
play | Start animation.
pause | Pause animation.
destroy | Destroy the marquee.
render | Imitate rendering.
```

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