shorter-js
Advanced tools
Comparing version 0.1.2 to 0.1.3
/*! | ||
* shorter-js v0.1.2 (https://thednp.github.io/shorter-js/) | ||
* shorter-js v0.1.3 (https://thednp.github.io/shorter-js/) | ||
* Copyright 2019-2020 © dnp_theme | ||
@@ -20,3 +20,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
var transitionDuration$1 = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration'; | ||
var transitionDuration = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration'; | ||
@@ -101,3 +101,3 @@ var transitionDelay = 'webkitTransition' in document.body.style ? 'webkitTransitionDelay' : 'transitionDelay'; | ||
function getElementTransitionDuration(element) { | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration$1]) : 0; | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration]) : 0; | ||
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0; | ||
@@ -141,3 +141,3 @@ return duration; | ||
function getElementTransitionDelay(element) { | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration]) : 0; | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDelay]) : 0; | ||
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0; | ||
@@ -166,3 +166,3 @@ return duration; | ||
animationDelay: animationDelay, | ||
transitionDuration: transitionDuration$1, | ||
transitionDuration: transitionDuration, | ||
transitionDelay: transitionDelay, | ||
@@ -169,0 +169,0 @@ animationEndEvent: animationEndEvent, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.1.2 | dnp_theme © 2020 | MIT-License | ||
var n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimationDuration"in document.body.style?"webkitAnimationDuration":"animationDuration",e="webkitAnimationDelay"in document.body.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in document.body.style?"webkitAnimationEnd":"animationend",i="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.body.style?"webkitTransitionDelay":"transitionDelay",r="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",s=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),u="webkitPerspective"in document.body.style||"perspective"in document.body.style,m=function(){var n=!1;try{var t=Object.defineProperty({},"passive",{get:function(){n=!0}});document.addEventListener("DOMContentLoaded",(function n(){document.removeEventListener("DOMContentLoaded",n,t)}),t)}catch(n){}return n}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,c="ontouchstart"in window||navigator.msMaxTouchPoints||!1,l="webkitAnimation"in document.body.style||"animation"in document.body.style,y="webkitTransition"in document.body.style||"transition"in document.body.style;function v(n,t,e,o){o=o||!1,n.addEventListener(t,e,o)}function p(n,t,e,o){o=o||!1,n.removeEventListener(t,e,o)}function f(n){var e=l?parseFloat(getComputedStyle(n)[t]):0;return e="number"!=typeof e||isNaN(e)?0:1e3*e}function b(n){var t=y?parseFloat(getComputedStyle(n)[i]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t}var E={mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:n,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},animationDuration:t,animationDelay:e,transitionDuration:i,transitionDelay:a,animationEndEvent:o,transitionEndEvent:r,isMobile:s,support3DTransform:u,supportPassive:m,supportTransform:d,supportTouch:c,supportAnimation:l,supportTransition:y,addClass:function(n,t){n.classList.add(t)},removeClass:function(n,t){n.classList.remove(t)},hasClass:function(n,t){return n.classList.contains(t)},on:v,off:p,one:function(n,t,e,o){v(n,t,(function i(a){a.target===n&&(e(a),p(n,t,i,o))}),o)},emulateAnimationEnd:function(n,t){var e=0;f(n)?n.addEventListener(o,(function i(a){!e&&t(a),e=1,n.removeEventListener(o,i)})):setTimeout((function(){!e&&t(),e=1}),17)},emulateTransitionEnd:function(n,t){var e=0;b(n)?n.addEventListener(r,(function o(i){!e&&t(i),e=1,n.removeEventListener(r,o)})):setTimeout((function(){!e&&t(),e=1}),17)},isElementInScrollRange:function(n){var t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight;return t.top<=e&&t.bottom>=0},isElementInViewport:function(n){var t=n.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!m&&{passive:!0},getElementAnimationDuration:f,getElementAnimationDelay:function(n){var t=l?parseFloat(getComputedStyle(n)[e]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},getElementTransitionDuration:b,getElementTransitionDelay:function(n){var t=y?parseFloat(getComputedStyle(n)[transitionDuration]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},queryElement:function(n,t){var e=t&&t instanceof Element?t:document;return n instanceof Element?n:e.querySelector(n)},tryWrapper:function(n,t){try{n()}catch(n){console.error(t+" "+n)}}};export default E; | ||
// shorter-js v0.1.3 | dnp_theme © 2020 | MIT-License | ||
var n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimationDuration"in document.body.style?"webkitAnimationDuration":"animationDuration",e="webkitAnimationDelay"in document.body.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in document.body.style?"webkitAnimationEnd":"animationend",i="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.body.style?"webkitTransitionDelay":"transitionDelay",r="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",s=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),u="webkitPerspective"in document.body.style||"perspective"in document.body.style,m=function(){var n=!1;try{var t=Object.defineProperty({},"passive",{get:function(){n=!0}});document.addEventListener("DOMContentLoaded",(function n(){document.removeEventListener("DOMContentLoaded",n,t)}),t)}catch(n){}return n}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,c="ontouchstart"in window||navigator.msMaxTouchPoints||!1,l="webkitAnimation"in document.body.style||"animation"in document.body.style,y="webkitTransition"in document.body.style||"transition"in document.body.style;function v(n,t,e,o){o=o||!1,n.addEventListener(t,e,o)}function p(n,t,e,o){o=o||!1,n.removeEventListener(t,e,o)}function f(n){var e=l?parseFloat(getComputedStyle(n)[t]):0;return e="number"!=typeof e||isNaN(e)?0:1e3*e}function b(n){var t=y?parseFloat(getComputedStyle(n)[i]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t}var E={mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:n,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},animationDuration:t,animationDelay:e,transitionDuration:i,transitionDelay:a,animationEndEvent:o,transitionEndEvent:r,isMobile:s,support3DTransform:u,supportPassive:m,supportTransform:d,supportTouch:c,supportAnimation:l,supportTransition:y,addClass:function(n,t){n.classList.add(t)},removeClass:function(n,t){n.classList.remove(t)},hasClass:function(n,t){return n.classList.contains(t)},on:v,off:p,one:function(n,t,e,o){v(n,t,(function i(a){a.target===n&&(e(a),p(n,t,i,o))}),o)},emulateAnimationEnd:function(n,t){var e=0;f(n)?n.addEventListener(o,(function i(a){!e&&t(a),e=1,n.removeEventListener(o,i)})):setTimeout((function(){!e&&t(),e=1}),17)},emulateTransitionEnd:function(n,t){var e=0;b(n)?n.addEventListener(r,(function o(i){!e&&t(i),e=1,n.removeEventListener(r,o)})):setTimeout((function(){!e&&t(),e=1}),17)},isElementInScrollRange:function(n){var t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight;return t.top<=e&&t.bottom>=0},isElementInViewport:function(n){var t=n.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!m&&{passive:!0},getElementAnimationDuration:f,getElementAnimationDelay:function(n){var t=l?parseFloat(getComputedStyle(n)[e]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},getElementTransitionDuration:b,getElementTransitionDelay:function(n){var t=y?parseFloat(getComputedStyle(n)[a]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},queryElement:function(n,t){var e=t&&t instanceof Element?t:document;return n instanceof Element?n:e.querySelector(n)},tryWrapper:function(n,t){try{n()}catch(n){console.error(t+" "+n)}}};export default E; |
/*! | ||
* shorter-js v0.1.2 (https://thednp.github.io/shorter-js/) | ||
* shorter-js v0.1.3 (https://thednp.github.io/shorter-js/) | ||
* Copyright 2019-2020 © dnp_theme | ||
@@ -26,3 +26,3 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
var transitionDuration$1 = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration'; | ||
var transitionDuration = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration'; | ||
@@ -107,3 +107,3 @@ var transitionDelay = 'webkitTransition' in document.body.style ? 'webkitTransitionDelay' : 'transitionDelay'; | ||
function getElementTransitionDuration(element) { | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration$1]) : 0; | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration]) : 0; | ||
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0; | ||
@@ -147,3 +147,3 @@ return duration; | ||
function getElementTransitionDelay(element) { | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration]) : 0; | ||
var duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDelay]) : 0; | ||
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0; | ||
@@ -172,3 +172,3 @@ return duration; | ||
animationDelay: animationDelay, | ||
transitionDuration: transitionDuration$1, | ||
transitionDuration: transitionDuration, | ||
transitionDelay: transitionDelay, | ||
@@ -175,0 +175,0 @@ animationEndEvent: animationEndEvent, |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.1.2 | dnp_theme © 2020 | MIT-License | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self).SHORTER=t()}(this,(function(){"use strict";var n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimationDuration"in document.body.style?"webkitAnimationDuration":"animationDuration",e="webkitAnimationDelay"in document.body.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in document.body.style?"webkitAnimationEnd":"animationend",i="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.body.style?"webkitTransitionDelay":"transitionDelay",r="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",s=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),u="webkitPerspective"in document.body.style||"perspective"in document.body.style,m=function(){var n=!1;try{var t=Object.defineProperty({},"passive",{get:function(){n=!0}});document.addEventListener("DOMContentLoaded",(function n(){document.removeEventListener("DOMContentLoaded",n,t)}),t)}catch(n){}return n}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,c="ontouchstart"in window||navigator.msMaxTouchPoints||!1,l="webkitAnimation"in document.body.style||"animation"in document.body.style,y="webkitTransition"in document.body.style||"transition"in document.body.style;function f(n,t,e,o){o=o||!1,n.addEventListener(t,e,o)}function v(n,t,e,o){o=o||!1,n.removeEventListener(t,e,o)}function p(n){var e=l?parseFloat(getComputedStyle(n)[t]):0;return e="number"!=typeof e||isNaN(e)?0:1e3*e}function b(n){var t=y?parseFloat(getComputedStyle(n)[i]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t}return{mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:n,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},animationDuration:t,animationDelay:e,transitionDuration:i,transitionDelay:a,animationEndEvent:o,transitionEndEvent:r,isMobile:s,support3DTransform:u,supportPassive:m,supportTransform:d,supportTouch:c,supportAnimation:l,supportTransition:y,addClass:function(n,t){n.classList.add(t)},removeClass:function(n,t){n.classList.remove(t)},hasClass:function(n,t){return n.classList.contains(t)},on:f,off:v,one:function(n,t,e,o){f(n,t,(function i(a){a.target===n&&(e(a),v(n,t,i,o))}),o)},emulateAnimationEnd:function(n,t){var e=0;p(n)?n.addEventListener(o,(function i(a){!e&&t(a),e=1,n.removeEventListener(o,i)})):setTimeout((function(){!e&&t(),e=1}),17)},emulateTransitionEnd:function(n,t){var e=0;b(n)?n.addEventListener(r,(function o(i){!e&&t(i),e=1,n.removeEventListener(r,o)})):setTimeout((function(){!e&&t(),e=1}),17)},isElementInScrollRange:function(n){var t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight;return t.top<=e&&t.bottom>=0},isElementInViewport:function(n){var t=n.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!m&&{passive:!0},getElementAnimationDuration:p,getElementAnimationDelay:function(n){var t=l?parseFloat(getComputedStyle(n)[e]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},getElementTransitionDuration:b,getElementTransitionDelay:function(n){var t=y?parseFloat(getComputedStyle(n)[transitionDuration]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},queryElement:function(n,t){var e=t&&t instanceof Element?t:document;return n instanceof Element?n:e.querySelector(n)},tryWrapper:function(n,t){try{n()}catch(n){console.error(t+" "+n)}}}})); | ||
// shorter-js v0.1.3 | dnp_theme © 2020 | MIT-License | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self).SHORTER=t()}(this,(function(){"use strict";var n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitAnimationDuration"in document.body.style?"webkitAnimationDuration":"animationDuration",e="webkitAnimationDelay"in document.body.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in document.body.style?"webkitAnimationEnd":"animationend",i="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",a="webkitTransition"in document.body.style?"webkitTransitionDelay":"transitionDelay",r="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",s=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),u="webkitPerspective"in document.body.style||"perspective"in document.body.style,m=function(){var n=!1;try{var t=Object.defineProperty({},"passive",{get:function(){n=!0}});document.addEventListener("DOMContentLoaded",(function n(){document.removeEventListener("DOMContentLoaded",n,t)}),t)}catch(n){}return n}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,c="ontouchstart"in window||navigator.msMaxTouchPoints||!1,l="webkitAnimation"in document.body.style||"animation"in document.body.style,y="webkitTransition"in document.body.style||"transition"in document.body.style;function f(n,t,e,o){o=o||!1,n.addEventListener(t,e,o)}function v(n,t,e,o){o=o||!1,n.removeEventListener(t,e,o)}function p(n){var e=l?parseFloat(getComputedStyle(n)[t]):0;return e="number"!=typeof e||isNaN(e)?0:1e3*e}function b(n){var t=y?parseFloat(getComputedStyle(n)[i]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t}return{mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseHoverEvents:n,touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},animationDuration:t,animationDelay:e,transitionDuration:i,transitionDelay:a,animationEndEvent:o,transitionEndEvent:r,isMobile:s,support3DTransform:u,supportPassive:m,supportTransform:d,supportTouch:c,supportAnimation:l,supportTransition:y,addClass:function(n,t){n.classList.add(t)},removeClass:function(n,t){n.classList.remove(t)},hasClass:function(n,t){return n.classList.contains(t)},on:f,off:v,one:function(n,t,e,o){f(n,t,(function i(a){a.target===n&&(e(a),v(n,t,i,o))}),o)},emulateAnimationEnd:function(n,t){var e=0;p(n)?n.addEventListener(o,(function i(a){!e&&t(a),e=1,n.removeEventListener(o,i)})):setTimeout((function(){!e&&t(),e=1}),17)},emulateTransitionEnd:function(n,t){var e=0;b(n)?n.addEventListener(r,(function o(i){!e&&t(i),e=1,n.removeEventListener(r,o)})):setTimeout((function(){!e&&t(),e=1}),17)},isElementInScrollRange:function(n){var t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight;return t.top<=e&&t.bottom>=0},isElementInViewport:function(n){var t=n.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},passiveHandler:!!m&&{passive:!0},getElementAnimationDuration:p,getElementAnimationDelay:function(n){var t=l?parseFloat(getComputedStyle(n)[e]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},getElementTransitionDuration:b,getElementTransitionDelay:function(n){var t=y?parseFloat(getComputedStyle(n)[a]):0;return t="number"!=typeof t||isNaN(t)?0:1e3*t},queryElement:function(n,t){var e=t&&t instanceof Element?t:document;return n instanceof Element?n:e.querySelector(n)},tryWrapper:function(n,t){try{n()}catch(n){console.error(t+" "+n)}}}})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A small ES6/ES7 library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.min.js", |
@@ -5,5 +5,5 @@ import supportTransition from '../boolean/supportTransition.js'; | ||
export default function(element) { | ||
let duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDuration]) : 0; | ||
let duration = supportTransition ? parseFloat(getComputedStyle(element)[transitionDelay]) : 0; | ||
duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0; | ||
return duration; | ||
} |
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
40937