Socket
Socket
Sign inDemoInstall

shorter-js

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shorter-js - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

48

dist/shorter-js.esm.js
/*!
* shorter-js v0.0.7 (https://thednp.github.io/shorter-js/)
* shorter-js v0.0.8 (https://thednp.github.io/shorter-js/)
* Copyright 2019-2020 © dnp_theme

@@ -22,21 +22,2 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE)

function on (element, event, handler, options) {
options = options || false;
element.addEventListener(event, handler, options);
}
function off (element, event, handler, options) {
options = options || false;
element.removeEventListener(event, handler, options);
}
function one (element, event, handler, options) {
on(element, event, function handlerWrapper(e){
if (e.target === element) {
handler(e);
off(element, event, handlerWrapper, options);
}
}, options);
}
var supportPassive = (function () {

@@ -50,3 +31,5 @@ var result = false;

});
one(document, 'DOMContentLoaded', function (){}, opts);
document.addEventListener('DOMContentLoaded', function wrap(){
document.removeEventListener('DOMContentLoaded', wrap, opts);
}, opts);
} catch (e) {}

@@ -58,3 +41,3 @@ return result;

var supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints)||false;
var supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints) || false;

@@ -75,2 +58,21 @@ var supportTransition = 'webkitTransition' in document.body.style || 'transition' in document.body.style;

function on (element, event, handler, options) {
options = options || false;
element.addEventListener(event, handler, options);
}
function off (element, event, handler, options) {
options = options || false;
element.removeEventListener(event, handler, options);
}
function one (element, event, handler, options) {
on(element, event, function handlerWrapper(e){
if (e.target === element) {
handler(e);
off(element, event, handlerWrapper, options);
}
}, options);
}
function getElementTransitionDuration (element) {

@@ -115,3 +117,3 @@ var duration = supportTransition ? window.getComputedStyle(element)[transitionDuration] : 0;

catch(e){
console.error((origin + ": " + e));
console.error((origin + " " + e));
}

@@ -118,0 +120,0 @@ }

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

// shorter-js v0.0.7 | dnp_theme © 2020 | MIT-License
var t={down:"mousedown",up:"mouseup"},n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],e={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},o={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},i="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",u="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",r=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),c="webkitPerspective"in document.body.style||"perspective"in document.body.style;function s(t,n,e,o){o=o||!1,t.addEventListener(n,e,o)}function a(t,n,e,o){o=o||!1,t.removeEventListener(n,e,o)}function d(t,n,e,o){s(t,n,(function i(u){u.target===t&&(e(u),a(t,n,i,o))}),o)}var m=function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});d(document,"DOMContentLoaded",(function(){}),n)}catch(t){}return t}(),l="webkitTransform"in document.body.style||"transform"in document.body.style,v="ontouchstart"in window||navigator.msMaxTouchPoints||!1,f="webkitTransition"in document.body.style||"transition"in document.body.style;function y(t,n){t.classList.add(n)}function w(t,n){t.classList.remove(n)}function b(t,n){return t.classList.contains(n)}function h(t){var n=f?window.getComputedStyle(t)[i]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n}function g(t,n){var e=0;h(t)?d(t,u,(function(t){!e&&n(t),e=1})):setTimeout((function(){!e&&n(),e=1}),17)}function p(t){var n=t.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight;return n.top<=e&&n.bottom>=0}function E(t){var n=t.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)}var T=!!m&&{passive:!0};function k(t,n){var e=n&&n instanceof Element?n:document;return t instanceof Element?t:e.querySelector(t)}function L(t,n){try{t()}catch(t){console.error(n+": "+t)}}export{y as addClass,g as emulateTransitionEnd,h as getElementTransitionDuration,b as hasClass,p as isElementInScrollRange,E as isElementInViewport,r as isMobile,t as mouseClickEvents,n as mouseHoverEvents,o as mouseSwipeEvents,a as off,s as on,d as one,T as passiveHandler,k as queryElement,w as removeClass,c as support3DTransform,m as supportPassive,v as supportTouch,l as supportTransform,f as supportTransition,e as touchEvents,i as transitionDuration,u as transitionEndEvent,L as tryWrapper};
// shorter-js v0.0.8 | dnp_theme © 2020 | MIT-License
var t={down:"mousedown",up:"mouseup"},n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],e={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},o={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},i="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",u="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",r=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),c="webkitPerspective"in document.body.style||"perspective"in document.body.style,s=function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,n)}),n)}catch(t){}return t}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,a="ontouchstart"in window||navigator.msMaxTouchPoints||!1,m="webkitTransition"in document.body.style||"transition"in document.body.style;function l(t,n){t.classList.add(n)}function v(t,n){t.classList.remove(n)}function f(t,n){return t.classList.contains(n)}function y(t,n,e,o){o=o||!1,t.addEventListener(n,e,o)}function w(t,n,e,o){o=o||!1,t.removeEventListener(n,e,o)}function b(t,n,e,o){y(t,n,(function i(u){u.target===t&&(e(u),w(t,n,i,o))}),o)}function h(t){var n=m?window.getComputedStyle(t)[i]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n}function g(t,n){var e=0;h(t)?b(t,u,(function(t){!e&&n(t),e=1})):setTimeout((function(){!e&&n(),e=1}),17)}function p(t){var n=t.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight;return n.top<=e&&n.bottom>=0}function E(t){var n=t.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)}var L=!!s&&{passive:!0};function T(t,n){var e=n&&n instanceof Element?n:document;return t instanceof Element?t:e.querySelector(t)}function k(t,n){try{t()}catch(t){console.error(n+" "+t)}}export{l as addClass,g as emulateTransitionEnd,h as getElementTransitionDuration,f as hasClass,p as isElementInScrollRange,E as isElementInViewport,r as isMobile,t as mouseClickEvents,n as mouseHoverEvents,o as mouseSwipeEvents,w as off,y as on,b as one,L as passiveHandler,T as queryElement,v as removeClass,c as support3DTransform,s as supportPassive,a as supportTouch,d as supportTransform,m as supportTransition,e as touchEvents,i as transitionDuration,u as transitionEndEvent,k as tryWrapper};
/*!
* shorter-js v0.0.7 (https://thednp.github.io/shorter-js/)
* shorter-js v0.0.8 (https://thednp.github.io/shorter-js/)
* Copyright 2019-2020 © dnp_theme

@@ -28,21 +28,2 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE)

function on (element, event, handler, options) {
options = options || false;
element.addEventListener(event, handler, options);
}
function off (element, event, handler, options) {
options = options || false;
element.removeEventListener(event, handler, options);
}
function one (element, event, handler, options) {
on(element, event, function handlerWrapper(e){
if (e.target === element) {
handler(e);
off(element, event, handlerWrapper, options);
}
}, options);
}
var supportPassive = (function () {

@@ -56,3 +37,5 @@ var result = false;

});
one(document, 'DOMContentLoaded', function (){}, opts);
document.addEventListener('DOMContentLoaded', function wrap(){
document.removeEventListener('DOMContentLoaded', wrap, opts);
}, opts);
} catch (e) {}

@@ -64,3 +47,3 @@ return result;

var supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints)||false;
var supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints) || false;

@@ -81,2 +64,21 @@ var supportTransition = 'webkitTransition' in document.body.style || 'transition' in document.body.style;

function on (element, event, handler, options) {
options = options || false;
element.addEventListener(event, handler, options);
}
function off (element, event, handler, options) {
options = options || false;
element.removeEventListener(event, handler, options);
}
function one (element, event, handler, options) {
on(element, event, function handlerWrapper(e){
if (e.target === element) {
handler(e);
off(element, event, handlerWrapper, options);
}
}, options);
}
function getElementTransitionDuration (element) {

@@ -121,3 +123,3 @@ var duration = supportTransition ? window.getComputedStyle(element)[transitionDuration] : 0;

catch(e){
console.error((origin + ": " + e));
console.error((origin + " " + e));
}

@@ -124,0 +126,0 @@ }

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

// shorter-js v0.0.7 | 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=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),s="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 u(e,t,n,o){o=o||!1,e.removeEventListener(t,n,o)}function c(e,t,n,o){r(e,t,(function i(s){s.target===e&&(n(s),u(e,t,i,o))}),o)}var a=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});c(document,"DOMContentLoaded",(function(){}),t)}catch(e){}return e}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,m="ontouchstart"in window||navigator.msMaxTouchPoints||!1,l="webkitTransition"in document.body.style||"transition"in document.body.style;function f(e){var t=l?window.getComputedStyle(e)[n]:0;return t="number"!=typeof(t=parseFloat(t))||isNaN(t)?0:1e3*t}var v=!!a&&{passive:!0};e.addClass=function(e,t){e.classList.add(t)},e.emulateTransitionEnd=function(e,t){var n=0;f(e)?c(e,o,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},e.getElementTransitionDuration=f,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.isMobile=i,e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=t,e.mouseSwipeEvents={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},e.off=u,e.on=r,e.one=c,e.passiveHandler=v,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=s,e.supportPassive=a,e.supportTouch=m,e.supportTransform=d,e.supportTransition=l,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})}));
// shorter-js v0.0.8 | 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=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),s="webkitPerspective"in document.body.style||"perspective"in document.body.style,r=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,t)}),t)}catch(e){}return e}(),u="webkitTransform"in document.body.style||"transform"in document.body.style,c="ontouchstart"in window||navigator.msMaxTouchPoints||!1,a="webkitTransition"in document.body.style||"transition"in document.body.style;function d(e,t,n,o){o=o||!1,e.addEventListener(t,n,o)}function m(e,t,n,o){o=o||!1,e.removeEventListener(t,n,o)}function l(e,t,n,o){d(e,t,(function i(s){s.target===e&&(n(s),m(e,t,i,o))}),o)}function f(e){var t=a?window.getComputedStyle(e)[n]:0;return t="number"!=typeof(t=parseFloat(t))||isNaN(t)?0:1e3*t}var v=!!r&&{passive:!0};e.addClass=function(e,t){e.classList.add(t)},e.emulateTransitionEnd=function(e,t){var n=0;f(e)?l(e,o,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},e.getElementTransitionDuration=f,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.isMobile=i,e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=t,e.mouseSwipeEvents={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseout"},e.off=m,e.on=d,e.one=l,e.passiveHandler=v,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=s,e.supportPassive=r,e.supportTouch=c,e.supportTransform=u,e.supportTransition=a,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.7",
"version": "0.0.8",
"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",

@@ -104,3 +104,3 @@ # shorter-js

# strings
* ***mouseSwipeEvents*** - preserves the pointer events from mouse actions: start: `mousedown`, end: `mouseup`, move: `mousemove`, cancel: `mouseup`
* ***mouseSwipeEvents*** - preserves the pointer events from mouse actions: start: `mousedown`, end: `mouseup`, move: `mousemove`, cancel: `mouseout`
* ***mouseClickEvents*** - preserves the pointer events from mouse actions: down: `mousedown`, up: `mouseup`

@@ -107,0 +107,0 @@ * ***mouseHoverEvents*** - preserve browser specific mouse hover events: `mouseenter` and `mouseleave` OR `mouseover` and `mouseout`

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

import {one} from '../event/one.js'
// import {one} from '../event/one.js'

@@ -13,3 +13,6 @@ // determine support for passive events

});
one(document, 'DOMContentLoaded', ()=>{}, opts);
// one(document, 'DOMContentLoaded', ()=>{}, opts);
document.addEventListener('DOMContentLoaded', function wrap(){
document.removeEventListener('DOMContentLoaded', wrap, opts)
}, opts);
} catch (e) {}

@@ -16,0 +19,0 @@

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

export const supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints)||false
export const supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints) || false
export function tryWrapper (fn,origin){
try{ fn() }
catch(e){
console.error(`${origin}: ${e}`)
console.error(`${origin} ${e}`)
}
}
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