biofriction-wp-theme/node_modules/foundation-sites/dist/js/plugins/foundation.util.touch.min.js

3 lines
4.4 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./foundation.core"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","jquery"],t):"object"==typeof exports?exports["foundation.util.touch"]=t(require("./foundation.core"),require("jquery")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.util.touch"]=t(e.__FOUNDATION_EXTERNAL__["foundation.core"],e.jQuery))}(window,function(n,o){return function(n){var o={};function i(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}return i.m=n,i.c=o,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=28)}({"./foundation.core":function(e,t){e.exports=n},"./js/entries/plugins/foundation.util.touch.js":function(e,t,n){"use strict";n.r(t);var o=n("jquery"),i=n.n(o),u=n("./js/foundation.util.touch.js");n.d(t,"Touch",function(){return u.Touch});var r=n("./foundation.core");n.d(t,"Foundation",function(){return r.Foundation}),u.Touch.init(i.a),window.Foundation.Touch=u.Touch},"./js/foundation.util.touch.js":function(e,t,n){"use strict";n.r(t),n.d(t,"Touch",function(){return f});var o=n("jquery"),i=n.n(o);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,o.key,o)}}var r,c,s,a,f={},p=!1,d=!1;function l(e){if(this.removeEventListener("touchmove",h),this.removeEventListener("touchend",l),!d){var t=i.a.Event("tap",a||e);i()(this).trigger(t)}a=null,d=p=!1}function h(e){if(i.a.spotSwipe.preventDefault&&e.preventDefault(),p){var t,n=e.touches[0].pageX,o=(e.touches[0].pageY,r-n);d=!0,s=(new Date).getTime()-c,Math.abs(o)>=i.a.spotSwipe.moveThreshold&&s<=i.a.spotSwipe.timeThreshold&&(t=0<o?"left":"right"),t&&(e.preventDefault(),l.apply(this,arguments),i()(this).trigger(i.a.Event("swipe",e),t).trigger(i.a.Event("swipe".concat(t),e)))}}function v(e){1==e.touches.length&&(r=e.touches[0].pageX,e.touches[0].pageY,a=e,d=!(p=!0),c=(new Date).getTime(),this.addEventListener("touchmove",h,!1),this.addEventListener("touchend",l,!1))}function w(){this.addEventListener&&this.addEventListener("touchstart",v,!1)}var m=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.version="1.0.0",this.enabled="ontouchstart"in document.documentElement,this.preventDefault=!1,this.moveThreshold=75,this.timeThreshold=200,this.$=e,this._init()}var e,n,o;return e=t,(n=[{key:"_init",value:function(){var e=this.$;e.event.special.swipe={setup:w},e.event.special.tap={setup:w},e.each(["left","up","down","right"],function(){e.event.special["swipe".concat(this)]={setup:function(){e(this).on("swipe",e.noop)}}})}}])&&u(e.prototype,n),o&&u(e,o),t}();f.setupSpotSwipe=function(e){e.spotSwipe=new m(e)},f.setupTouchHandler=function(o){o.fn.addTouch=function(){this.each(function(e,t){o(t).bind("touchstart touchmove touchend touchcancel",function(e){n(e)})});var n=function(e){var t,n=e.changedTouches[0],o={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"}[e.type];"MouseEvent"in window&&"function"==typeof window.MouseEvent?t=new window.MouseEvent(o,{bubbles:!0,cancelable:!0,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY}):(t=document.createEvent("MouseEvent")).initMouseEvent(o,!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(e){void 0===e.spotSwipe&&(f.setupSpotSwipe(e),f.setupTouchHandler(e))}},28:function(e,t,n){e.exports=n("./js/entries/plugins/foundation.util.touch.js")},jquery:function(e,t){e.exports=o}})});
//# sourceMappingURL=foundation.util.touch.min.js.map