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 4.1.7 to 4.2.0

2

dist/creepyface.js

@@ -22,3 +22,3 @@ import attach from './util/attach';

document.addEventListener('DOMContentLoaded', () => {
const elements = document.querySelectorAll('img[data-creepy]');
const elements = document.querySelectorAll('img[data-creepy],img[data-creepyface]');
for (let i = 0; i < elements.length; i++) {

@@ -25,0 +25,0 @@ const el = elements[i];

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).creepyface=e()}(this,function(){"use strict";var s=function(o,c){var u=[];o.forEach(function(n){var e,t,r;e=n,t=function(n){u.push(n),u.length===o.length&&c(u)},(r=new Image).src=e,r.onload=r.onerror=function(){r.naturalWidth||console.error("Creepyface was unable to load ".concat(e)),delete r.onload,delete r.onerror,t(r)}})};var c=function(e){return{subscribe:function(n){return{unsubscribe:e({next:n})}}}},t=[];document.addEventListener("mousemove",function(e){return t.forEach(function(n){return n.next([e.clientX,e.clientY])})},!0);var u=c(function(n){return t.push(n),function(){t.splice(t.indexOf(n),1)}}),i=function(n,t){return n.map(function(n,e){return n+t[e]})},a=function(n){return n*Math.PI/180},f=function(n){return e=Math.atan2(n[1],n[0]),t=2*Math.PI,180*((t+e%t)%t)/Math.PI;var e,t},e=[];document.addEventListener("touchmove",function(o){return e.forEach(function(n){for(var e=[0,0],t=0;t<o.touches.length;t++){var r=o.touches[t];e=i(e,[r.clientX,r.clientY])}n.next(e)})},!0);var l=c(function(n){return e.push(n),function(){e.splice(e.indexOf(n),1)}}),d=function(){},r=function(n){var e=n?parseFloat(n):NaN;return isNaN(e)?void 0:e},v=function(n){return{hover:n.getAttribute("data-src-hover")||void 0,looks:function(n){for(var e=/data-src-look-(\d+)/i,t=[],r=0;r<n.attributes.length;r++){var o=n.attributes[r],c=e.exec(o.name);c&&t.push({angle:parseFloat(c[1]),src:o.value})}return t.length?t:void 0}(n),timeToDefault:r(n.getAttribute("data-timetodefault")),throttle:r(n.getAttribute("data-throttle")),fieldOfVision:r(n.getAttribute("data-fieldofvision")),resetOnCancel:"true"===n.getAttribute("data-resetoncancel")}};function h(n){var t,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=function(o){for(var n=1;n<arguments.length;n++){var c=null!=arguments[n]?arguments[n]:{},e=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(c).filter(function(n){return Object.getOwnPropertyDescriptor(c,n).enumerable}))),e.forEach(function(n){var e,t,r;e=o,r=c[t=n],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return o}({},v(n),e),o=n.src;if(!o)throw new Error("A default URL must be specified");return{fieldOfVision:r.fieldOfVision||150,src:o,hover:r.hover||"",points:r.points||(t=[u,l],c(function(e){var n=t.map(function(n){return n.subscribe(e.next)});return function(){return n.forEach(function(n){return n.unsubscribe()})}})),looks:r.looks||[],timeToDefault:r.timeToDefault||1e3,resetOnCancel:!(!1===r.resetOnCancel),throttle:r.throttle||100,onDebug:r.onDebug||d,onAttach:r.onAttach||d,onDetach:r.onDetach||d}}var b=function(n){var e=n.getBoundingClientRect(),t=e.top+window.pageYOffset+e.height/2,r=e.left+window.pageXOffset+e.width/2;return{y:t,x:r}};var m=function(n,e){return f((o=i([window.scrollX,window.scrollY],e),u=b(n),c=[u.x,u.y],t=o.map(function(n,e){return n-c[e]}),r=90,[t[0]*Math.cos(a(r))-t[1]*Math.sin(a(r)),t[0]*Math.sin(a(r))+t[1]*Math.cos(a(r))]));var t,r,o,c,u},p=function(n){return 180<Math.abs(n)?n-360*((e=n)?e<0?-1:1:0):n;var e},g=function(n,e){return e.slice(0).sort((t=n,function(n,e){return Math.abs(p(n.angle-t))-Math.abs(p(e.angle-t))}))[0];var t},y=function(n,e,t){return e<=n&&n<=t},O=function(n,e){return document.elementFromPoint?document.elementFromPoint(e[0],e[1])===n:(t=n.getBoundingClientRect(),r=[e[0],e[1]],o=t.left,c=t.top,u=t.right,i=t.bottom,y(r[0],o,u)&&y(r[1],c,i));var t,r,o,c,u,i},w=function(h,b){return c(function(r){var n,e,t,o,c,u,i,a,f,s,l,d=(n=function(){return r.next({src:b.src,options:b})},e=b.timeToDefault,(o=function(){t&&clearTimeout(t),t=setTimeout(function(){t=null,n()},e)}).clear=function(){t&&(clearTimeout(t),t=null)},o),v=b.points.subscribe((c=function(n){var e=m(h,n),t=function(n,e,t,r){var o=r.looks,c=r.hover,u=r.fieldOfVision,i=r.src;if(c&&O(n,e))i=c;else{var a=g(t,o);Math.abs(p(a.angle-t))<u/2&&(i=a.src)}return i}(h,n,e,b);r.next({point:n,angle:e,src:t,options:b}),d()},u=b.throttle,f=0,s=function(){f=Date.now(),i=null,c(a)},(l=function(n){var e=Date.now(),t=u-(e-f);a=n,t<=0||u<t?(i&&(clearTimeout(i),i=null),f=e,c(n)):i||(i=setTimeout(s,t))}).clear=function(){i&&clearTimeout(i),f=0,i=null},l));return function(){d.clear(),v.unsubscribe()}})},M=function(t,n){var e,r,o,c,u=h(t,n),i=function(n){t.src=n},a=!1,f=function(){a=!0};return e=t,r=function(n){if(!a){u.onAttach();var e=w(t,u).subscribe(function(n){i(n.src),u.onDebug(n)});f=function(){e.unsubscribe(),u.resetOnCancel&&i(u.src),u.onDetach(),n()}}},s((c=(o=u).looks.map(function(n){return n.src}),o.src&&c.push(o.src),o.hover&&c.push(o.hover),c),function(n){e.creepyfaceReachableImages=n,r(function(){delete e.creepyfaceReachableImages})}),function(){return f()}},o=function n(e,t){n.cancel(e);var r=d,o=function(t,e,r){var o=function(n){return n?e():r()};if(MutationObserver){var c=document.body&&document.body.contains(t);c&&o(!0);var n=new MutationObserver(function(n){var e=document.body&&document.body.contains(t);!e&&c?(o(!1),c=!1):e&&!c&&(o(!0),c=!0)});return n.observe(document,{childList:!0,subtree:!0}),function(){return n.disconnect()}}return document.body&&document.body.contains(t)&&o(!0),t.addEventListener("DOMNodeInserted",function(){return o(!0)},!1),t.addEventListener("DOMNodeRemoved",function(){return o(!1)},!1),d}(e,function(){r=M(e,t)},function(){return n.cancel(e)});return e.creepyfaceCancel=function(){o(),r(),delete e.creepyfaceCancel}};return o.cancel=function(n){var e=n.creepyfaceCancel;e&&e()},document.addEventListener("DOMContentLoaded",function(){for(var n=document.querySelectorAll("img[data-creepy]"),e=0;e<n.length;e++){var t=n[e];t instanceof HTMLImageElement&&o(t)}}),o});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).creepyface=n()}(this,function(){"use strict";var s=function(o,c){var u=[];o.forEach(function(e){var n,t,r;n=e,t=function(e){u.push(e),u.length===o.length&&c(u)},(r=new Image).src=n,r.onload=r.onerror=function(){r.naturalWidth||console.error("Creepyface was unable to load ".concat(n)),delete r.onload,delete r.onerror,t(r)}})};var c=function(n){return{subscribe:function(e){return{unsubscribe:n({next:e})}}}},t=[];document.addEventListener("mousemove",function(n){return t.forEach(function(e){return e.next([n.clientX,n.clientY])})},!0);var u=c(function(e){return t.push(e),function(){t.splice(t.indexOf(e),1)}}),i=function(e,t){return e.map(function(e,n){return e+t[n]})},a=function(e){return e*Math.PI/180},f=function(e){return n=Math.atan2(e[1],e[0]),t=2*Math.PI,180*((t+n%t)%t)/Math.PI;var n,t},n=[];document.addEventListener("touchmove",function(o){return n.forEach(function(e){for(var n=[0,0],t=0;t<o.touches.length;t++){var r=o.touches[t];n=i(n,[r.clientX,r.clientY])}e.next(n)})},!0);var l=c(function(e){return n.push(e),function(){n.splice(n.indexOf(e),1)}}),d=function(){},r=function(e){var n=e?parseFloat(e):NaN;return isNaN(n)?void 0:n},v=function(e){return{hover:e.getAttribute("data-src-hover")||void 0,looks:function(e){for(var n=/data-src-look-(\d+)/i,t=[],r=0;r<e.attributes.length;r++){var o=e.attributes[r],c=n.exec(o.name);c&&t.push({angle:parseFloat(c[1]),src:o.value})}return t.length?t:void 0}(e),timeToDefault:r(e.getAttribute("data-timetodefault")),throttle:r(e.getAttribute("data-throttle")),fieldOfVision:r(e.getAttribute("data-fieldofvision")),resetOnCancel:"true"===e.getAttribute("data-resetoncancel")}};function h(e){var t,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=function(o){for(var e=1;e<arguments.length;e++){var c=null!=arguments[e]?arguments[e]:{},n=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(c).filter(function(e){return Object.getOwnPropertyDescriptor(c,e).enumerable}))),n.forEach(function(e){var n,t,r;n=o,r=c[t=e],t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r})}return o}({},v(e),n),o=e.src;if(!o)throw new Error("A default URL must be specified");return{fieldOfVision:r.fieldOfVision||150,src:o,hover:r.hover||"",points:r.points||(t=[u,l],c(function(n){var e=t.map(function(e){return e.subscribe(n.next)});return function(){return e.forEach(function(e){return e.unsubscribe()})}})),looks:r.looks||[],timeToDefault:r.timeToDefault||1e3,resetOnCancel:!(!1===r.resetOnCancel),throttle:r.throttle||100,onDebug:r.onDebug||d,onAttach:r.onAttach||d,onDetach:r.onDetach||d}}var b=function(e){var n=e.getBoundingClientRect(),t=n.top+window.pageYOffset+n.height/2,r=n.left+window.pageXOffset+n.width/2;return{y:t,x:r}};var m=function(e,n){return f((o=i([window.scrollX,window.scrollY],n),u=b(e),c=[u.x,u.y],t=o.map(function(e,n){return e-c[n]}),r=90,[t[0]*Math.cos(a(r))-t[1]*Math.sin(a(r)),t[0]*Math.sin(a(r))+t[1]*Math.cos(a(r))]));var t,r,o,c,u},p=function(e){return 180<Math.abs(e)?e-360*((n=e)?n<0?-1:1:0):e;var n},g=function(e,n){return n.slice(0).sort((t=e,function(e,n){return Math.abs(p(e.angle-t))-Math.abs(p(n.angle-t))}))[0];var t},y=function(e,n,t){return n<=e&&e<=t},O=function(e,n){return document.elementFromPoint?document.elementFromPoint(n[0],n[1])===e:(t=e.getBoundingClientRect(),r=[n[0],n[1]],o=t.left,c=t.top,u=t.right,i=t.bottom,y(r[0],o,u)&&y(r[1],c,i));var t,r,o,c,u,i},w=function(h,b){return c(function(r){var e,n,t,o,c,u,i,a,f,s,l,d=(e=function(){return r.next({src:b.src,options:b})},n=b.timeToDefault,(o=function(){t&&clearTimeout(t),t=setTimeout(function(){t=null,e()},n)}).clear=function(){t&&(clearTimeout(t),t=null)},o),v=b.points.subscribe((c=function(e){var n=m(h,e),t=function(e,n,t,r){var o=r.looks,c=r.hover,u=r.fieldOfVision,i=r.src;if(c&&O(e,n))i=c;else{var a=g(t,o);Math.abs(p(a.angle-t))<u/2&&(i=a.src)}return i}(h,e,n,b);r.next({point:e,angle:n,src:t,options:b}),d()},u=b.throttle,f=0,s=function(){f=Date.now(),i=null,c(a)},(l=function(e){var n=Date.now(),t=u-(n-f);a=e,t<=0||u<t?(i&&(clearTimeout(i),i=null),f=n,c(e)):i||(i=setTimeout(s,t))}).clear=function(){i&&clearTimeout(i),f=0,i=null},l));return function(){d.clear(),v.unsubscribe()}})},M=function(t,e){var n,r,o,c,u=h(t,e),i=function(e){t.src=e},a=!1,f=function(){a=!0};return n=t,r=function(e){if(!a){u.onAttach();var n=w(t,u).subscribe(function(e){i(e.src),u.onDebug(e)});f=function(){n.unsubscribe(),u.resetOnCancel&&i(u.src),u.onDetach(),e()}}},s((c=(o=u).looks.map(function(e){return e.src}),o.src&&c.push(o.src),o.hover&&c.push(o.hover),c),function(e){n.creepyfaceReachableImages=e,r(function(){delete n.creepyfaceReachableImages})}),function(){return f()}},o=function e(n,t){e.cancel(n);var r=d,o=function(t,n,r){var o=function(e){return e?n():r()};if(MutationObserver){var c=document.body&&document.body.contains(t);c&&o(!0);var e=new MutationObserver(function(e){var n=document.body&&document.body.contains(t);!n&&c?(o(!1),c=!1):n&&!c&&(o(!0),c=!0)});return e.observe(document,{childList:!0,subtree:!0}),function(){return e.disconnect()}}return document.body&&document.body.contains(t)&&o(!0),t.addEventListener("DOMNodeInserted",function(){return o(!0)},!1),t.addEventListener("DOMNodeRemoved",function(){return o(!1)},!1),d}(n,function(){r=M(n,t)},function(){return e.cancel(n)});return n.creepyfaceCancel=function(){o(),r(),delete n.creepyfaceCancel}};return o.cancel=function(e){var n=e.creepyfaceCancel;n&&n()},document.addEventListener("DOMContentLoaded",function(){for(var e=document.querySelectorAll("img[data-creepy],img[data-creepyface]"),n=0;n<e.length;n++){var t=e[n];t instanceof HTMLImageElement&&o(t)}}),o});
{
"name": "creepyface",
"version": "4.1.7",
"version": "4.2.0",
"keywords": [

@@ -5,0 +5,0 @@ "face",

@@ -23,3 +23,3 @@ # [Creepyface](https://creepyface.io) &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/4lejandrito/creepyface/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/creepyface.svg?style=flat)](https://www.npmjs.com/package/creepyface) [![Build Status](https://api.travis-ci.org/4lejandrito/creepyface.svg?branch=master)](https://travis-ci.org/4lejandrito/creepyface) [![Coverage Status](https://coveralls.io/repos/github/4lejandrito/creepyface/badge.svg?branch=master)](https://coveralls.io/github/4lejandrito/creepyface?branch=master)

<img
data-creepy
data-creepyface
src="img/face/serious.jpg"

@@ -46,5 +46,5 @@ data-src-hover="img/face/crazy.jpg"

Creepyface will automatically detect your image (thanks to the `data-creepy` attribute) and make it look at the mouse or fingers depending on which device you are using.
Creepyface will automatically detect your image (thanks to the `data-creepyface` attribute) and make it look at the mouse or fingers depending on which device you are using.
You can add as many Creepyfaces as you want as long as they all have the `data-creepy` attribute.
You can add as many Creepyfaces as you want as long as they all have the `data-creepyface` attribute.

@@ -51,0 +51,0 @@ If you want to stop Creepyface on a given image:

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