From 8e0310874905c91da05e8fd37e4a4a5fdafd4ccd Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 18 Oct 2017 20:55:52 +0200 Subject: [PATCH] Updated for usage with browsers not having 'module' --- jquery.tap.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/jquery.tap.js b/jquery.tap.js index fe25728..a571676 100644 --- a/jquery.tap.js +++ b/jquery.tap.js @@ -36,8 +36,8 @@ if (e.originalEvent.touches && e.originalEvent.touches[0]) { touch = e.originalEvent.touches[0]; - startPoint = { - x: touch.screenX, + startPoint = { + x: touch.screenX, y: touch.screenY, px: touch.pageX, py: touch.pageY, @@ -72,7 +72,7 @@ } touch = e.originalEvent.touches[0]; - + moveDistance = Math.sqrt(Math.pow(touch.screenX - startPoint.x, 2) + Math.pow(touch.screenY - startPoint.y, 2)); @@ -94,10 +94,13 @@ return this; } }; -if (module && module.exports) { - module.exports = function(jq) { - return jqt(jq || window.jQuery || window.$) - }; +if (typeof module !== "undefined") { + if (typeof module.exports !== "undefined") { + module.exports = function(jq) { + return jqt(jq || window.jQuery || window.$) + }; + } + } else { jqt(window.jQuery || window.$) }