New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

creepyface

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

creepyface - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

16

dist/creepyface.cjs.js

@@ -6,3 +6,2 @@ 'use strict';

var loadImages = _interopDefault(require('image-promise'));
var isFirefox = _interopDefault(require('is-firefox'));
var parseDataAttributes = _interopDefault(require('data-attrs-to-js'));

@@ -14,16 +13,2 @@ var getElementCenter = _interopDefault(require('get-element-center'));

/* global HTMLImageElement */
function showAndHideImages(imgs) {
imgs.forEach(function (img) {
img.style.position = 'fixed';
img.style.height = '0px';
var body = document.body;
if (body) {
body.appendChild(img);
setTimeout(function () {
return body.removeChild(img);
}, 1000);
}
});
}
var getSrcs = function getSrcs(options) {

@@ -42,3 +27,2 @@ var srcs = options.looks.map(function (_ref) {

img.creepyFaceReachableImages = imgs;
if (isFirefox) showAndHideImages(imgs);
});

@@ -45,0 +29,0 @@ }

import loadImages from 'image-promise';
import isFirefox from 'is-firefox';
import parseDataAttributes from 'data-attrs-to-js';

@@ -9,16 +8,2 @@ import getElementCenter from 'get-element-center';

/* global HTMLImageElement */
function showAndHideImages(imgs) {
imgs.forEach(function (img) {
img.style.position = 'fixed';
img.style.height = '0px';
var body = document.body;
if (body) {
body.appendChild(img);
setTimeout(function () {
return body.removeChild(img);
}, 1000);
}
});
}
var getSrcs = function getSrcs(options) {

@@ -37,3 +22,2 @@ var srcs = options.looks.map(function (_ref) {

img.creepyFaceReachableImages = imgs;
if (isFirefox) showAndHideImages(imgs);
});

@@ -40,0 +24,0 @@ }

2

dist/creepyface.umd.js

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.creepyFace=t()}(this,function(){"use strict";function n(t){if(!t)return Promise.reject();if("string"==typeof t){var e=t;(t=new Image).src=e}else{if(void 0!==t.length){var r=[].map.call(t,function(t){return n(t).catch(function(n){return n})});return Promise.all(r).then(function(n){var t=n.filter(function(n){return n.naturalWidth});return t.length===n.length?t:Promise.reject({loaded:t,errored:n.filter(function(n){return!n.naturalWidth})})})}if("IMG"!==t.tagName)return Promise.reject()}var o=new Promise(function(n,e){function r(){t.naturalWidth?n(t):e(t),t.removeEventListener("load",r),t.removeEventListener("error",r)}t.naturalWidth?n(t):t.complete?e(t):(t.addEventListener("load",r),t.addEventListener("error",r))});return o.image=t,o}function t(n){n.forEach(function(n){n.style.position="fixed",n.style.height="0px";var t=document.body;t&&(t.appendChild(n),setTimeout(function(){return t.removeChild(n)},1e3))})}function e(n,e){return a(s(e)).then(function(e){n.creepyFaceReachableImages=e,f&&t(e)})}function r(n){return function(t){var e;return e=/^data\-/.test(t.name),void 0===n?e:e&&n.test(t.name.slice(5))}}function o(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function i(n){var t=l(n),e=t.src,r=void 0===e?{}:e,o=t.fieldofvision,i=t.timetodefault,u={src:n.getAttribute("src")};return i&&(u.timeToDefault=parseFloat(i)),o&&(u.fieldOfVision=parseFloat(o)),r.hover&&(u.hover=r.hover),r.look&&(u.looks=L(r.look)),u}function u(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign({},i(n),t);if(!e.src)throw new Error("A default URL must be specified");return{fieldOfVision:e.fieldOfVision||150,src:e.src,hover:e.hover||"",points:e.points||D([h,x]),looks:e.looks||[],timeToDefault:e.timeToDefault||1e3,onDebug:e.onDebug||function(){},onAttach:e.onAttach||function(){},onDetach:e.onDetach||function(){}}}function c(n,t){var e=function(){},r=X(n,function(){e=W(n,t)},function(){e()});return function(){r(),e()}}var a=n,f="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=function(n){var t=n.looks.map(function(n){return n.src});return n.src&&t.push(n.src),n.hover&&t.push(n.hover),t},l=function(n,t){var e={};return void 0===(t=t||{}).separator&&(t.separator="-"),Array.prototype.slice.call(n.attributes).filter(r(t.pattern)).forEach(function(n){n.name.slice(5).split(t.separator).reduce(function(t,e,r,o){return"data"===e?t:(r===o.length-1?t[e]=n.value:t[e]=t[e]||{},t[e])},e)}),e},d=function(){function n(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}return function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}}(),v=function(){function n(t){o(this,n),this.subscriber=function(n){return function(){}},this.subscriber=t}return d(n,[{key:"subscribe",value:function(n){var t={next:n},e=this.subscriber(t);return"function"==typeof e?{unsubscribe:e}:e}}]),n}(),h=new v(function(n){var t=function(t){return n.next([t.clientX,t.clientY])};return document.addEventListener("mousemove",t,!0),function(){return document.removeEventListener("mousemove",t,!0)}}),m=function(n,t){return n.map(function(n,e){return n-t[e]})},p=function(n,t){return n.map(function(n,e){return n+t[e]})},b=function(n){return n?n<0?-1:1:0},y=function(n){return n*Math.PI/180},g=function(n){return 180*n/Math.PI},w=function(n,t){return(t+n%t)%t},E=function(n){return g(w(Math.atan2(n[1],n[0]),2*Math.PI))},M=function(n,t){return[n[0]*Math.cos(y(t))-n[1]*Math.sin(y(t)),n[0]*Math.sin(y(t))+n[1]*Math.cos(y(t))]},x=new v(function(n){var t=function(t){var e=[0,0],r=!0,o=!1,i=void 0;try{for(var u,c=t.touches[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var a=u.value;e=p(e,[a.clientX,a.clientY])}}catch(n){o=!0,i=n}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}n.next(e)};return document.addEventListener("touchmove",t,!0),function(){return document.removeEventListener("touchmove",t,!0)}}),D=function(n){return new v(function(t){var e=t.next.bind(t),r=n.map(function(n){return n.subscribe(e)});return function(){return r.forEach(function(n){return n.unsubscribe()})}})},L=function(n){var t=[],e=!0,r=!1,o=void 0;try{for(var i,u=Object.keys(n)[Symbol.iterator]();!(e=(i=u.next()).done);e=!0){var c=i.value,a=n[c];a&&t.push({angle:parseFloat(c),src:a})}}catch(n){r=!0,o=n}finally{try{!e&&u.return&&u.return()}finally{if(r)throw o}}return t},O=function(n){var t=n.getBoundingClientRect();return{y:t.top+window.pageYOffset+t.height/2,x:t.left+window.pageXOffset+t.width/2}},T=function(n){var t=O(n);return[t.x,t.y]},j=function(n,t){return E(M(m(p([window.scrollX,window.scrollY],t),T(n)),90))},k=function(){function n(n,t){var e=[],r=!0,o=!1,i=void 0;try{for(var u,c=n[Symbol.iterator]();!(r=(u=c.next()).done)&&(e.push(u.value),!t||e.length!==t);r=!0);}catch(n){o=!0,i=n}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}return e}return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return n(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=function(n){return Math.abs(n)>180?n-360*b(n):n},A=function(n){return function(t,e){return Math.abs(P(t.angle-n))-Math.abs(P(e.angle-n))}},I=function(n,t){return t.slice(0).sort(A(n))[0]},F=function(n,t,e){return n>=t&&n<=e},N=function(n,t){var e=n.left,r=n.top,o=n.right,i=n.bottom,u=k(t,2),c=u[0],a=u[1];return F(c,e,o)&&F(a,r,i)},S=function(n,t){var e=k(t,2),r=e[0],o=e[1];return document.elementFromPoint?document.elementFromPoint(r,o)===n:N(n.getBoundingClientRect(),[r,o])},C=function(n,t,e,r){var o=r.looks,i=r.hover,u=r.fieldOfVision,c=r.src;if(i&&S(n,t))c=i;else{var a=I(e,o);a&&Math.abs(P(a.angle-e))<u/2&&(c=a.src)}return c},R=function(n,t,e){function r(){var f=Date.now()-c;f<t&&f>=0?o=setTimeout(r,t-f):(o=null,e||(a=n.apply(u,i),u=i=null))}var o,i,u,c,a;null==t&&(t=100);var f=function(){u=this,i=arguments,c=Date.now();var f=e&&!o;return o||(o=setTimeout(r,t)),f&&(a=n.apply(u,i),u=i=null),a};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.flush=function(){o&&(a=n.apply(u,i),u=i=null,clearTimeout(o),o=null)},f},V=function(n,t){return new v(function(e){var r=R(function(){return e.next({src:t.src,options:t})},t.timeToDefault),o=t.points.subscribe(function(o){var i=j(n,o),u=C(n,o,i,t);e.next({point:o,angle:i,src:u,options:t}),r()});return function(){r.clear(),o.unsubscribe()}})},W=function(n,t){var r=u(n,t),o=function(t){n.src=t},i=e(n,r).then(function(){return r.onAttach(),V(n,r).subscribe(function(n){o(n.src),r.onDebug(n)})});return function(){return i.then(function(n){n.unsubscribe(),o(r.src),r.onDetach()})}},X=function(n,t,e){var r=function(n){return n?t():e()},o=window.MutationObserver;if(o){var i=document.body&&document.body.contains(n);i&&r(!0);var u=new o(function(t){var e=document.body&&document.body.contains(n);!e&&i?(r(!1),i=!1):e&&!i&&(r(!0),i=!0)});return u.observe(document,{childList:!0,subtree:!0}),function(){return u.disconnect()}}return document.body&&document.body.contains(n)&&r(!0),n.addEventListener("DOMNodeInserted",function(){return r(!0)},!1),n.addEventListener("DOMNodeRemoved",function(){return r(!1)},!1),function(){}},Y=function(n){return!(!n||"object"!=typeof n)&&("object"==typeof window&&"object"==typeof window.Node?n instanceof window.Node:"number"==typeof n.nodeType&&"string"==typeof n.nodeName)};return function(n){return Y(n)?[n]:"string"==typeof n?[].slice.call(document.querySelectorAll(n)):void 0}("img[data-creepy]").forEach(function(n){n instanceof HTMLImageElement&&c(n)}),c});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.creepyFace=t()}(this,function(){"use strict";function n(t){if(!t)return Promise.reject();if("string"==typeof t){var e=t;(t=new Image).src=e}else{if(void 0!==t.length){var r=[].map.call(t,function(t){return n(t).catch(function(n){return n})});return Promise.all(r).then(function(n){var t=n.filter(function(n){return n.naturalWidth});return t.length===n.length?t:Promise.reject({loaded:t,errored:n.filter(function(n){return!n.naturalWidth})})})}if("IMG"!==t.tagName)return Promise.reject()}var o=new Promise(function(n,e){function r(){t.naturalWidth?n(t):e(t),t.removeEventListener("load",r),t.removeEventListener("error",r)}t.naturalWidth?n(t):t.complete?e(t):(t.addEventListener("load",r),t.addEventListener("error",r))});return o.image=t,o}function t(n,t){return c(a(t)).then(function(t){n.creepyFaceReachableImages=t})}function e(n){return function(t){var e;return e=/^data\-/.test(t.name),void 0===n?e:e&&n.test(t.name.slice(5))}}function r(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function o(n){var t=f(n),e=t.src,r=void 0===e?{}:e,o=t.fieldofvision,u=t.timetodefault,i={src:n.getAttribute("src")};return u&&(i.timeToDefault=parseFloat(u)),o&&(i.fieldOfVision=parseFloat(o)),r.hover&&(i.hover=r.hover),r.look&&(i.looks=D(r.look)),i}function u(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign({},o(n),t);if(!e.src)throw new Error("A default URL must be specified");return{fieldOfVision:e.fieldOfVision||150,src:e.src,hover:e.hover||"",points:e.points||M([d,E]),looks:e.looks||[],timeToDefault:e.timeToDefault||1e3,onDebug:e.onDebug||function(){},onAttach:e.onAttach||function(){},onDetach:e.onDetach||function(){}}}function i(n,t){var e=function(){},r=W(n,function(){e=V(n,t)},function(){e()});return function(){r(),e()}}var c=n,a=function(n){var t=n.looks.map(function(n){return n.src});return n.src&&t.push(n.src),n.hover&&t.push(n.hover),t},f=function(n,t){var r={};return void 0===(t=t||{}).separator&&(t.separator="-"),Array.prototype.slice.call(n.attributes).filter(e(t.pattern)).forEach(function(n){n.name.slice(5).split(t.separator).reduce(function(t,e,r,o){return"data"===e?t:(r===o.length-1?t[e]=n.value:t[e]=t[e]||{},t[e])},r)}),r},s=function(){function n(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}return function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}}(),l=function(){function n(t){r(this,n),this.subscriber=function(n){return function(){}},this.subscriber=t}return s(n,[{key:"subscribe",value:function(n){var t={next:n},e=this.subscriber(t);return"function"==typeof e?{unsubscribe:e}:e}}]),n}(),d=new l(function(n){var t=function(t){return n.next([t.clientX,t.clientY])};return document.addEventListener("mousemove",t,!0),function(){return document.removeEventListener("mousemove",t,!0)}}),v=function(n,t){return n.map(function(n,e){return n-t[e]})},h=function(n,t){return n.map(function(n,e){return n+t[e]})},m=function(n){return n?n<0?-1:1:0},b=function(n){return n*Math.PI/180},p=function(n){return 180*n/Math.PI},y=function(n,t){return(t+n%t)%t},w=function(n){return p(y(Math.atan2(n[1],n[0]),2*Math.PI))},g=function(n,t){return[n[0]*Math.cos(b(t))-n[1]*Math.sin(b(t)),n[0]*Math.sin(b(t))+n[1]*Math.cos(b(t))]},E=new l(function(n){var t=function(t){var e=[0,0],r=!0,o=!1,u=void 0;try{for(var i,c=t.touches[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var a=i.value;e=h(e,[a.clientX,a.clientY])}}catch(n){o=!0,u=n}finally{try{!r&&c.return&&c.return()}finally{if(o)throw u}}n.next(e)};return document.addEventListener("touchmove",t,!0),function(){return document.removeEventListener("touchmove",t,!0)}}),M=function(n){return new l(function(t){var e=t.next.bind(t),r=n.map(function(n){return n.subscribe(e)});return function(){return r.forEach(function(n){return n.unsubscribe()})}})},D=function(n){var t=[],e=!0,r=!1,o=void 0;try{for(var u,i=Object.keys(n)[Symbol.iterator]();!(e=(u=i.next()).done);e=!0){var c=u.value,a=n[c];a&&t.push({angle:parseFloat(c),src:a})}}catch(n){r=!0,o=n}finally{try{!e&&i.return&&i.return()}finally{if(r)throw o}}return t},x=function(n){var t=n.getBoundingClientRect();return{y:t.top+window.pageYOffset+t.height/2,x:t.left+window.pageXOffset+t.width/2}},L=function(n){var t=x(n);return[t.x,t.y]},O=function(n,t){return w(g(v(h([window.scrollX,window.scrollY],t),L(n)),90))},T=function(){function n(n,t){var e=[],r=!0,o=!1,u=void 0;try{for(var i,c=n[Symbol.iterator]();!(r=(i=c.next()).done)&&(e.push(i.value),!t||e.length!==t);r=!0);}catch(n){o=!0,u=n}finally{try{!r&&c.return&&c.return()}finally{if(o)throw u}}return e}return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return n(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),j=function(n){return Math.abs(n)>180?n-360*m(n):n},P=function(n){return function(t,e){return Math.abs(j(t.angle-n))-Math.abs(j(e.angle-n))}},k=function(n,t){return t.slice(0).sort(P(n))[0]},A=function(n,t,e){return n>=t&&n<=e},I=function(n,t){var e=n.left,r=n.top,o=n.right,u=n.bottom,i=T(t,2),c=i[0],a=i[1];return A(c,e,o)&&A(a,r,u)},F=function(n,t){var e=T(t,2),r=e[0],o=e[1];return document.elementFromPoint?document.elementFromPoint(r,o)===n:I(n.getBoundingClientRect(),[r,o])},N=function(n,t,e,r){var o=r.looks,u=r.hover,i=r.fieldOfVision,c=r.src;if(u&&F(n,t))c=u;else{var a=k(e,o);a&&Math.abs(j(a.angle-e))<i/2&&(c=a.src)}return c},R=function(n,t,e){function r(){var f=Date.now()-c;f<t&&f>=0?o=setTimeout(r,t-f):(o=null,e||(a=n.apply(i,u),i=u=null))}var o,u,i,c,a;null==t&&(t=100);var f=function(){i=this,u=arguments,c=Date.now();var f=e&&!o;return o||(o=setTimeout(r,t)),f&&(a=n.apply(i,u),i=u=null),a};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.flush=function(){o&&(a=n.apply(i,u),i=u=null,clearTimeout(o),o=null)},f},S=function(n,t){return new l(function(e){var r=R(function(){return e.next({src:t.src,options:t})},t.timeToDefault),o=t.points.subscribe(function(o){var u=O(n,o),i=N(n,o,u,t);e.next({point:o,angle:u,src:i,options:t}),r()});return function(){r.clear(),o.unsubscribe()}})},V=function(n,e){var r=u(n,e),o=function(t){n.src=t},i=t(n,r).then(function(){return r.onAttach(),S(n,r).subscribe(function(n){o(n.src),r.onDebug(n)})});return function(){return i.then(function(n){n.unsubscribe(),o(r.src),r.onDetach()})}},W=function(n,t,e){var r=function(n){return n?t():e()},o=window.MutationObserver;if(o){var u=document.body&&document.body.contains(n);u&&r(!0);var i=new o(function(t){var e=document.body&&document.body.contains(n);!e&&u?(r(!1),u=!1):e&&!u&&(r(!0),u=!0)});return i.observe(document,{childList:!0,subtree:!0}),function(){return i.disconnect()}}return document.body&&document.body.contains(n)&&r(!0),n.addEventListener("DOMNodeInserted",function(){return r(!0)},!1),n.addEventListener("DOMNodeRemoved",function(){return r(!1)},!1),function(){}},X=function(n){return!(!n||"object"!=typeof n)&&("object"==typeof window&&"object"==typeof window.Node?n instanceof window.Node:"number"==typeof n.nodeType&&"string"==typeof n.nodeName)};return function(n){return X(n)?[n]:"string"==typeof n?[].slice.call(document.querySelectorAll(n)):void 0}("img[data-creepy]").forEach(function(n){n instanceof HTMLImageElement&&i(n)}),i});
{
"name": "creepyface",
"version": "3.3.0",
"version": "3.3.1",
"author": "Alejandro Tardín <alejandro@tardin.com>",

@@ -37,3 +37,2 @@ "license": "MIT",

"image-promise": "^5.0.1",
"is-firefox": "^1.0.3",
"queryselectorall": "^0.1.0"

@@ -40,0 +39,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