shorter-js
Advanced tools
Comparing version 0.0.4 to 0.0.5
/*! | ||
* shorter-js v0.0.4 (https://thednp.github.io/shorter-js/) | ||
* shorter-js v0.0.5 (https://thednp.github.io/shorter-js/) | ||
* Copyright 2019-2020 © dnp_theme | ||
@@ -108,2 +108,9 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
function tryWrapper (fn,origin){ | ||
try{ fn(); } | ||
catch(e){ | ||
console.error((origin + ": " + e)); | ||
} | ||
} | ||
exports.addClass = addClass; | ||
@@ -130,2 +137,3 @@ exports.emulateTransitionEnd = emulateTransitionEnd; | ||
exports.transitionEndEvent = transitionEndEvent; | ||
exports.tryWrapper = tryWrapper; | ||
@@ -132,0 +140,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.0.4 | dnp_theme © 2020 | MIT-License | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).SHORTER={})}(this,(function(e){"use strict";var n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",o="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",i="webkitPerspective"in document.body.style||"perspective"in document.body.style;function s(e,n,t,o){o=o||!1,e.addEventListener(n,t,o)}function r(e,n,t,o){o=o||!1,e.removeEventListener(n,t,o)}function u(e,n,t,o){s(e,n,(function i(s){s.target===e&&(t(s),r(e,n,i,o))}),o)}var c=function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){e=!0}});u(document,"DOMContentLoaded",(function(){}),n)}catch(e){}return e}(),a="webkitTransform"in document.body.style||"transform"in document.body.style,d="webkitTransition"in document.body.style||"transition"in document.body.style;function m(e){var n=d?window.getComputedStyle(e)[t]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n}var l=!!c&&{passive:!0};e.addClass=function(e,n){e.classList.add(n)},e.emulateTransitionEnd=function(e,n){var t=0;m(e)?u(e,o,(function(e){!t&&n(e),t=1})):setTimeout((function(){!t&&n(),t=1}),17)},e.getElementTransitionDuration=m,e.hasClass=function(e,n){return e.classList.contains(n)},e.isElementInScrollRange=function(e){var n=e.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;return n.top<=t&&n.bottom>=0},e.isElementInViewport=function(e){var n=e.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)},e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=n,e.off=r,e.on=s,e.one=u,e.passiveHandler=l,e.queryElement=function(e,n){var t=n&&n instanceof Element?n:document;return e instanceof Element?e:t.querySelector(e)},e.removeClass=function(e,n){e.classList.remove(n)},e.support3DTransform=i,e.supportPassive=c,e.supportTransform=a,e.supportTransition=d,e.touchEvents={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},e.transitionDuration=t,e.transitionEndEvent=o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
// shorter-js v0.0.5 | dnp_theme © 2020 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SHORTER={})}(this,(function(e){"use strict";var t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",o="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",i="webkitPerspective"in document.body.style||"perspective"in document.body.style;function r(e,t,n,o){o=o||!1,e.addEventListener(t,n,o)}function s(e,t,n,o){o=o||!1,e.removeEventListener(t,n,o)}function u(e,t,n,o){r(e,t,(function i(r){r.target===e&&(n(r),s(e,t,i,o))}),o)}var c=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});u(document,"DOMContentLoaded",(function(){}),t)}catch(e){}return e}(),a="webkitTransform"in document.body.style||"transform"in document.body.style,d="webkitTransition"in document.body.style||"transition"in document.body.style;function m(e){var t=d?window.getComputedStyle(e)[n]:0;return t="number"!=typeof(t=parseFloat(t))||isNaN(t)?0:1e3*t}var l=!!c&&{passive:!0};e.addClass=function(e,t){e.classList.add(t)},e.emulateTransitionEnd=function(e,t){var n=0;m(e)?u(e,o,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},e.getElementTransitionDuration=m,e.hasClass=function(e,t){return e.classList.contains(t)},e.isElementInScrollRange=function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},e.isElementInViewport=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=t,e.off=s,e.on=r,e.one=u,e.passiveHandler=l,e.queryElement=function(e,t){var n=t&&t instanceof Element?t:document;return e instanceof Element?e:n.querySelector(e)},e.removeClass=function(e,t){e.classList.remove(t)},e.support3DTransform=i,e.supportPassive=c,e.supportTransform=a,e.supportTransition=d,e.touchEvents={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},e.transitionDuration=n,e.transitionEndEvent=o,e.tryWrapper=function(e,t){try{e()}catch(e){console.error(t+": "+e)}},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A small ES6/ES7 library with various JavaScript tools useful for creating light libraries.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shorter-js.js", |
@@ -82,2 +82,3 @@ # shorter-js | ||
* ***queryElement*** - a simple utility to check if a certain item is an *Element* or a selector string, and if a selector string find the FIRST *Element* and return it | ||
* ***tryWrapper*** - a simple `try()` and `catch()` wrapper for functions | ||
```js | ||
@@ -84,0 +85,0 @@ // EXAMPLES |
@@ -30,2 +30,3 @@ // strings FIRST | ||
export {getElementTransitionDuration} from './misc/getElementTransitionDuration.js' | ||
export {queryElement} from './misc/queryElement.js' | ||
export {queryElement} from './misc/queryElement.js' | ||
export {tryWrapper} from './misc/tryWrapper.js' |
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
22083
29
272
130