Socket
Socket
Sign inDemoInstall

ripple-js

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ripple-js - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

9

changelog.txt

@@ -26,2 +26,9 @@ !========_ Version 1.1 _========!

°Scrolling now gets disabled while a ripple element is being pressed
°Improved the README
°Improved the README
!========_ Version 1.2.1 _========!
°Scrolling no longer gets disabled

2

package.json
{
"name": "ripple-js",
"version": "1.2.0",
"version": "1.2.1",
"description": "A small library for ripple effects",

@@ -5,0 +5,0 @@ "main": "ripple.min.js",

@@ -15,3 +15,2 @@ //Written by Aaron Längert

rippleContainer.setAttribute("animating", "1");
document.styleSheets[0].insertRule("body, body * {overflow: hidden}", 0);
scroll = getScroll(e.target);

@@ -36,3 +35,2 @@ offsetX = typeof e.offsetX == "number" ? e.offsetX : e.touches[0].pageX - scroll.left;

rippleContainer.setAttribute("animating", "2");
document.styleSheets[0].deleteRule(0);
radius = window.getComputedStyle(rippleContainer, null).getPropertyValue("padding");

@@ -58,3 +56,2 @@ background = window.getComputedStyle(rippleContainer, null).getPropertyValue("background");

rippleContainer.setAttribute("animating", "3");
document.styleSheets[0].deleteRule(0);
collapseTime = e.target.getAttribute("ripple-leave-collapse-time") || .4;

@@ -61,0 +58,0 @@ rippleContainer.style.transition = "padding " + collapseTime + "s linear, box-shadow " + collapseTime + "s linear";

//Written by Aaron Längert
var ripple=function(){function t(t){rippleContainer=r(t.target),"0"!=rippleContainer.getAttribute("animating")&&rippleContainer.hasAttribute("animating")||(rippleContainer.setAttribute("animating","1"),document.styleSheets[0].insertRule("body, body * {overflow: hidden}",0),scroll=o(t.target),offsetX="number"==typeof t.offsetX?t.offsetX:t.touches[0].pageX-scroll.left,offsetY="number"==typeof t.offsetY?t.offsetY:t.touches[0].pageY-scroll.top,fullCoverRadius=Math.max(Math.sqrt(Math.pow(offsetX,2)+Math.pow(offsetY,2)),Math.sqrt(Math.pow(t.target.clientWidth-offsetX,2)+Math.pow(t.target.clientHeight-offsetY,2)),Math.sqrt(Math.pow(offsetX,2)+Math.pow(t.target.clientHeight-offsetY,2)),Math.sqrt(Math.pow(offsetY,2)+Math.pow(t.target.clientWidth-offsetX,2))),expandTime=t.target.getAttribute("ripple-press-expand-time")||3,rippleContainer.style.transition="padding "+expandTime+"s ease-out, box-shadow 0.1s linear",rippleContainer.style.background=t.target.getAttribute("ripple-color")||"white",rippleContainer.style.opacity=t.target.getAttribute("ripple-opacity")||"0.6",rippleContainer.style.boxShadow=t.target.getAttribute("ripple-shadow")||"none",rippleContainer.style.top=offsetY+"px",rippleContainer.style.left=offsetX+"px",rippleContainer.style.padding=fullCoverRadius+"px")}function e(t){rippleContainer=r(t.target),"1"==rippleContainer.getAttribute("animating")&&(rippleContainer.setAttribute("animating","2"),document.styleSheets[0].deleteRule(0),radius=window.getComputedStyle(rippleContainer,null).getPropertyValue("padding"),background=window.getComputedStyle(rippleContainer,null).getPropertyValue("background"),destinationRadius=t.target.clientWidth+t.target.clientHeight,rippleContainer.style.transition="none",rippleContainer.style.padding=radius,expandTime=t.target.getAttribute("ripple-release-expand-time")||.4,rippleContainer.style.transition="padding "+expandTime+"s linear, background "+expandTime+"s linear, opacity "+expandTime+"s ease-in-out",rippleContainer.style.padding=destinationRadius+"px",rippleContainer.style.background="radial-gradient(transparent 10%, "+background+" 40%)",rippleContainer.style.opacity="0",t.target.dispatchEvent(new CustomEvent("ripple-button-click",{target:t.target})))}function n(t){rippleContainer=r(t.target),"1"==rippleContainer.getAttribute("animating")&&(rippleContainer.setAttribute("animating","3"),document.styleSheets[0].deleteRule(0),collapseTime=t.target.getAttribute("ripple-leave-collapse-time")||.4,rippleContainer.style.transition="padding "+collapseTime+"s linear, box-shadow "+collapseTime+"s linear",rippleContainer.style.boxShadow="none",rippleContainer.style.padding="0px")}function r(t){for(childs=t.childNodes,ii=0;ii<childs.length;ii++)try{if(childs[ii].className.indexOf("rippleContainer")>-1)return childs[ii]}catch(e){}return t}function o(t){scroll={top:0+t.getBoundingClientRect().top,left:0+t.getBoundingClientRect().left};do scroll.top+=t.scrollTop||0,scroll.left+=t.scrollLeft||0;while(t=t.parentNode);return scroll}window.addEventListener("load",function(){css=document.createElement("style"),css.type="text/css",css.innerHTML=".ripple { overflow: hidden; position: relative; } .ripple .rippleContainer { display: inline-block; height: 0px !important; width: 0px !important; padding: 0px 0px 0px 0px; border-radius: 50%; position: absolute; top: 0px; left: 0px; transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); background-color: transparent; } .ripple * {pointer-events: none;}",document.head.appendChild(css),a.registerRipples()});var a={registerRipples:function(){for(rippleButtons=document.getElementsByClassName("ripple"),i=0;i<rippleButtons.length;i++)rippleButtons[i].addEventListener("touchstart",function(e){t(e)},!1),rippleButtons[i].addEventListener("touchmove",function(t){try{scroll=o(t.target),overEl=document.elementFromPoint(t.touches[0].pageX-scroll.left,t.touches[0].pageY-scroll.top).className.indexOf("ripple")>=0}catch(e){overEl=!1}overEl||n(t)},!1),rippleButtons[i].addEventListener("touchend",function(t){e(t)},!1),rippleButtons[i].addEventListener("mousedown",function(e){t(e)},!1),rippleButtons[i].addEventListener("mouseup",function(t){e(t)},!1),rippleButtons[i].addEventListener("mouseleave",function(t){n(t)},!1),rippleButtons[i].addEventListener("transitionend",function(t){("2"==t.target.getAttribute("animating")||"3"==t.target.getAttribute("animating"))&&(t.target.style.transition="none",t.target.style.padding="0px",t.target.style.boxShadow="none",t.target.setAttribute("animating","0"))},!1),r(rippleButtons[i])==rippleButtons[i]&&(rippleButtons[i].innerHTML+='<div class="rippleContainer"></div>')}};return a}();
var ripple=function(){function t(t){rippleContainer=r(t.target),"0"!=rippleContainer.getAttribute("animating")&&rippleContainer.hasAttribute("animating")||(rippleContainer.setAttribute("animating","1"),scroll=a(t.target),offsetX="number"==typeof t.offsetX?t.offsetX:t.touches[0].pageX-scroll.left,offsetY="number"==typeof t.offsetY?t.offsetY:t.touches[0].pageY-scroll.top,fullCoverRadius=Math.max(Math.sqrt(Math.pow(offsetX,2)+Math.pow(offsetY,2)),Math.sqrt(Math.pow(t.target.clientWidth-offsetX,2)+Math.pow(t.target.clientHeight-offsetY,2)),Math.sqrt(Math.pow(offsetX,2)+Math.pow(t.target.clientHeight-offsetY,2)),Math.sqrt(Math.pow(offsetY,2)+Math.pow(t.target.clientWidth-offsetX,2))),expandTime=t.target.getAttribute("ripple-press-expand-time")||3,rippleContainer.style.transition="padding "+expandTime+"s ease-out, box-shadow 0.1s linear",rippleContainer.style.background=t.target.getAttribute("ripple-color")||"white",rippleContainer.style.opacity=t.target.getAttribute("ripple-opacity")||"0.6",rippleContainer.style.boxShadow=t.target.getAttribute("ripple-shadow")||"none",rippleContainer.style.top=offsetY+"px",rippleContainer.style.left=offsetX+"px",rippleContainer.style.padding=fullCoverRadius+"px")}function e(t){rippleContainer=r(t.target),"1"==rippleContainer.getAttribute("animating")&&(rippleContainer.setAttribute("animating","2"),radius=window.getComputedStyle(rippleContainer,null).getPropertyValue("padding"),background=window.getComputedStyle(rippleContainer,null).getPropertyValue("background"),destinationRadius=t.target.clientWidth+t.target.clientHeight,rippleContainer.style.transition="none",rippleContainer.style.padding=radius,expandTime=t.target.getAttribute("ripple-release-expand-time")||.4,rippleContainer.style.transition="padding "+expandTime+"s linear, background "+expandTime+"s linear, opacity "+expandTime+"s ease-in-out",rippleContainer.style.padding=destinationRadius+"px",rippleContainer.style.background="radial-gradient(transparent 10%, "+background+" 40%)",rippleContainer.style.opacity="0",t.target.dispatchEvent(new CustomEvent("ripple-button-click",{target:t.target})))}function n(t){rippleContainer=r(t.target),"1"==rippleContainer.getAttribute("animating")&&(rippleContainer.setAttribute("animating","3"),collapseTime=t.target.getAttribute("ripple-leave-collapse-time")||.4,rippleContainer.style.transition="padding "+collapseTime+"s linear, box-shadow "+collapseTime+"s linear",rippleContainer.style.boxShadow="none",rippleContainer.style.padding="0px")}function r(t){for(childs=t.childNodes,ii=0;ii<childs.length;ii++)try{if(childs[ii].className.indexOf("rippleContainer")>-1)return childs[ii]}catch(e){}return t}function a(t){scroll={top:0+t.getBoundingClientRect().top,left:0+t.getBoundingClientRect().left};do scroll.top+=t.scrollTop||0,scroll.left+=t.scrollLeft||0;while(t=t.parentNode);return scroll}window.addEventListener("load",function(){css=document.createElement("style"),css.type="text/css",css.innerHTML=".ripple { overflow: hidden; position: relative; } .ripple .rippleContainer { display: inline-block; height: 0px !important; width: 0px !important; padding: 0px 0px 0px 0px; border-radius: 50%; position: absolute; top: 0px; left: 0px; transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); background-color: transparent; } .ripple * {pointer-events: none;}",document.head.appendChild(css),o.registerRipples()});var o={registerRipples:function(){for(rippleButtons=document.getElementsByClassName("ripple"),i=0;i<rippleButtons.length;i++)rippleButtons[i].addEventListener("touchstart",function(e){t(e)},!1),rippleButtons[i].addEventListener("touchmove",function(t){try{scroll=a(t.target),overEl=document.elementFromPoint(t.touches[0].pageX-scroll.left,t.touches[0].pageY-scroll.top).className.indexOf("ripple")>=0}catch(e){overEl=!1}overEl||n(t)},!1),rippleButtons[i].addEventListener("touchend",function(t){e(t)},!1),rippleButtons[i].addEventListener("mousedown",function(e){t(e)},!1),rippleButtons[i].addEventListener("mouseup",function(t){e(t)},!1),rippleButtons[i].addEventListener("mouseleave",function(t){n(t)},!1),rippleButtons[i].addEventListener("transitionend",function(t){("2"==t.target.getAttribute("animating")||"3"==t.target.getAttribute("animating"))&&(t.target.style.transition="none",t.target.style.padding="0px",t.target.style.boxShadow="none",t.target.setAttribute("animating","0"))},!1),r(rippleButtons[i])==rippleButtons[i]&&(rippleButtons[i].innerHTML+='<div class="rippleContainer"></div>')}};return o}();
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