foundation-sites
Version:
The most advanced responsive front-end framework in the world.
3 lines (2 loc) • 4.52 kB
JavaScript
((e,t)=>{"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery"),require("./foundation.core")):"function"==typeof define&&define.amd?define(["jquery","./foundation.core"],t):"object"==typeof exports?exports.__FOUNDATION_EXTERNAL__=t(require("jquery"),require("./foundation.core")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.util.touch"]=t(e.jQuery,e.__FOUNDATION_EXTERNAL__["foundation.core"]))})(self,function(t,n){return i={"./js/foundation.util.touch.js":function(e,t,n){n.r(t),n.d(t,{Touch:function(){return f}});var t=n("jquery"),i=n.n(t);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(e=>(e=((e,t)=>{if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=r(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==r(e)?e:e+""))(o.key),o)}}var o,c,s,a,f={},p=!1,l=!1;function d(e){this.removeEventListener("touchmove",h),this.removeEventListener("touchend",d),l||(e=i().Event("tap",a||e),i()(this).trigger(e)),a=null,l=p=!1}function h(e){var t,n;!0===i().spotSwipe.preventDefault&&e.preventDefault(),p&&(t=e.touches[0].pageX,t=o-t,l=!0,s=(new Date).getTime()-c,n=Math.abs(t)>=i().spotSwipe.moveThreshold&&s<=i().spotSwipe.timeThreshold?0<t?"left":"right":n)&&(e.preventDefault(),d.apply(this,arguments),i()(this).trigger(i().Event("swipe",Object.assign({},e)),n).trigger(i().Event("swipe".concat(n),Object.assign({},e))))}function v(e){1===e.touches.length&&(o=e.touches[0].pageX,a=e,l=!(p=!0),c=(new Date).getTime(),this.addEventListener("touchmove",h,{passive:!0===i().spotSwipe.preventDefault}),this.addEventListener("touchend",d,!1))}function y(){this.addEventListener&&this.addEventListener("touchstart",v,{passive:!0})}var m=(()=>{function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.version="1.0.0",this.enabled="ontouchstart"in document.documentElement,this.preventDefault=!1,this.moveThreshold=75,this.timeThreshold=200,this._init()}return t=e,(n=[{key:"_init",value:function(){i().event.special.swipe={setup:y},i().event.special.tap={setup:y},i().each(["left","up","down","right"],function(){i().event.special["swipe".concat(this)]={setup:function(){i()(this).on("swipe",i().noop)}}})}}])&&u(t.prototype,n),o&&u(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,o})();f.setupSpotSwipe=function(){i().spotSwipe=new m(i())},f.setupTouchHandler=function(){i().fn.addTouch=function(){this.each(function(e,t){i()(t).bind("touchstart touchmove touchend touchcancel",function(e){n(e)})});var n=function(e){var t,n=e.changedTouches[0],e={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"}[e.type];"MouseEvent"in window&&"function"==typeof window.MouseEvent?t=new window.MouseEvent(e,{bubbles:!0,cancelable:!0,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY}):(t=document.createEvent("MouseEvent")).initMouseEvent(e,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),n.target.dispatchEvent(t)}}},f.init=function(){void 0===i().spotSwipe&&(f.setupSpotSwipe(i()),f.setupTouchHandler(i()))}},"./foundation.core":function(e){e.exports=n},jquery:function(e){e.exports=t}},r={},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},(o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(s),o.d(s,{Foundation:function(){return c.Foundation},Touch:function(){return u.Touch}}),e=o("jquery"),e=o.n(e),u=o("./js/foundation.util.touch.js"),c=o("./foundation.core"),u.Touch.init(e()),window.Foundation.Touch=u.Touch,s;function o(e){var t=r[e];return void 0!==t||(t=r[e]={exports:{}},i[e](t,t.exports,o)),t.exports}var i,r,e,u,c,s});
//# sourceMappingURL=foundation.util.touch.min.js.map