├── .DS_Store ├── bower.json ├── src ├── 1.0.0 │ ├── bower.json │ └── jquery.mobile-events.min.js ├── 1.0.1 │ ├── bower.json │ └── jquery.mobile-events.min.js ├── 1.0.2 │ ├── bower.json │ └── jquery.mobile-events.min.js ├── 1.0.3 │ ├── bower.json │ └── jquery.mobile-events.min.js ├── 1.0.4 │ ├── bower.json │ └── jquery.mobile-events.min.js ├── 1.0.5 │ └── jquery.mobile-events.min.js ├── 1.0.6 │ └── jquery.mobile-events.min.js ├── 1.0.7 │ └── jquery.mobile-events.min.js ├── 1.0.8 │ └── jquery.mobile-events.min.js ├── 1.0.9 │ └── jquery.mobile-events.min.js ├── 2.0.2 │ └── jquery.mobile-events.min.js ├── jquery.mobile-events.min.js ├── 2.0.3 │ └── jquery.mobile-events.min.js ├── 2.0.0 │ └── jquery.mobile-events.min.js └── 2.0.1 │ └── jquery.mobile-events.min.js ├── package.json └── LICENSE /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benmajor/jQuery-Touch-Events/HEAD/.DS_Store -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-touch-events", 3 | "version": "2.0.3", 4 | "main": "src/jquery.mobile-events.js", 5 | "ignore": [ 6 | "bower.json" 7 | ], 8 | "dependencies": { 9 | "jquery": ">=1.7.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/1.0.0/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-touch-events", 3 | "version": "1.0.0", 4 | "main": "src/jquery.mobile-events.js", 5 | "ignore": [ 6 | "bower.json" 7 | ], 8 | "dependencies": { 9 | "jquery": ">=1.7.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/1.0.1/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-touch-events", 3 | "version": "1.0.1", 4 | "main": "src/jquery.mobile-events.js", 5 | "ignore": [ 6 | "bower.json" 7 | ], 8 | "dependencies": { 9 | "jquery": ">=1.7.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/1.0.2/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-touch-events", 3 | "version": "1.0.2", 4 | "main": "src/jquery.mobile-events.js", 5 | "ignore": [ 6 | "bower.json" 7 | ], 8 | "dependencies": { 9 | "jquery": ">=1.7.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/1.0.3/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-touch-events", 3 | "version": "1.0.3", 4 | "main": "src/jquery.mobile-events.js", 5 | "ignore": [ 6 | "bower.json" 7 | ], 8 | "dependencies": { 9 | "jquery": ">=1.7.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/1.0.4/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-touch-events", 3 | "version": "1.0.4", 4 | "main": "src/jquery.mobile-events.js", 5 | "ignore": [ 6 | "bower.json" 7 | ], 8 | "dependencies": { 9 | "jquery": ">=1.7.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@benmajor/jquery-touch-events", 3 | "version": "2.0.3", 4 | "description": "Polyfill to remove click delays and unify pointer device events.", 5 | "main": "src/jquery.mobile-events.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/benmajor/jQuery-Touch-Events.git" 12 | }, 13 | "keywords": [ 14 | "jquery", 15 | "touch-events", 16 | "touch-device" 17 | ], 18 | "author": "Ben Major", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/benmajor/jQuery-Touch-Events/issues" 22 | }, 23 | "homepage": "https://github.com/benmajor/jQuery-Touch-Events#readme" 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Ben Major 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/1.0.5/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(e){function t(){var e=s();e!==r&&(r=e,u.trigger("orientationchange"))}function a(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.attrFn=e.attrFn||{};var o=navigator.userAgent.toLowerCase(),n=o.indexOf("chrome")>-1&&(o.indexOf("windows")>-1||o.indexOf("macintosh")>-1||o.indexOf("linux")>-1)&&o.indexOf("mobile")<0&&o.indexOf("android")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in window&&!n,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in window&&!n?"touchstart":"mousedown",endevent:"ontouchstart"in window&&!n?"touchend":"mouseup",moveevent:"ontouchstart"in window&&!n?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!n?"tap":"click",scrollevent:"ontouchstart"in window&&!n?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(i.startevent,function n(e){if(o.data("callee",n),e.which&&1!==e.which)return!1;var c=e.originalEvent,s={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?c.changedTouches[0].pageX-o.offset().left:e.pageX-o.offset().left),y:Math.round(i.touch_capable?c.changedTouches[0].pageY-o.offset().top:e.pageY-o.offset().top)},time:Date.now(),target:e.target};return a(t,"tapstart",e,s),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(i.moveevent,function n(e){o.data("callee",n);var c=e.originalEvent,s={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?c.changedTouches[0].pageX-o.offset().left:e.pageX-o.offset().left),y:Math.round(i.touch_capable?c.changedTouches[0].pageY-o.offset().top:e.pageY-o.offset().top)},time:Date.now(),target:e.target};return a(t,"tapmove",e,s),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(i.endevent,function n(e){o.data("callee",n);var c=e.originalEvent,s={position:{x:i.touch_capable?c.changedTouches[0].screenX:e.screenX,y:i.touch_capable?c.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?c.changedTouches[0].pageX-o.offset().left:e.pageX-o.offset().left),y:Math.round(i.touch_capable?c.changedTouches[0].pageY-o.offset().top:e.pageY-o.offset().top)},time:Date.now(),target:e.target};return a(t,"tapend",e,s),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),c={x:0,y:0},s=0,r=0;n.on(i.startevent,function p(e){if(e.which&&1!==e.which)return!1;n.data("tapheld",!1),t=e.target;var h=e.originalEvent,u=Date.now(),l={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},f={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};return c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,s=c.x,r=c.y,i.hold_timer=window.setTimeout(function(){var g=c.x-s,d=c.y-r;if(e.target==t&&(c.x==s&&c.y==r||g>=-i.tap_pixel_range&&g<=i.tap_pixel_range&&d>=-i.tap_pixel_range&&d<=i.tap_pixel_range)){n.data("tapheld",!0);var v=Date.now(),w={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},_={x:Math.round(i.touch_capable?h.changedTouches[0].pageX-n.offset().left:e.pageX-n.offset().left),y:Math.round(i.touch_capable?h.changedTouches[0].pageY-n.offset().top:e.pageY-n.offset().top)},T=v-u,x={startTime:u,endTime:v,startPosition:l,startOffset:f,endPosition:w,endOffset:_,duration:T,target:e.target};n.data("callee1",p),a(o,"taphold",e,x)}},i.taphold_threshold),!0}).on(i.endevent,function h(){n.data("callee2",h),n.data("tapheld",!1),window.clearTimeout(i.hold_timer)}).on(i.moveevent,function u(e){n.data("callee3",u),s=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,r=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2).off(i.moveevent,e(this).data.callee3)}},e.event.special.doubletap={setup:function(){var t,o,n,c,s=this,r=e(s),p=null,h=!1;r.on(i.startevent,function u(e){return e.which&&1!==e.which?!1:(r.data("doubletapped",!1),t=e.target,r.data("callee1",u),n=e.originalEvent,p||(p={position:{x:i.touch_capable?n.touches[0].screenX:e.screenX,y:i.touch_capable?n.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?n.changedTouches[0].pageX-r.offset().left:e.pageX-r.offset().left),y:Math.round(i.touch_capable?n.changedTouches[0].pageY-r.offset().top:e.pageY-r.offset().top)},time:Date.now(),target:e.target}),!0)}).on(i.endevent,function l(e){var u=Date.now(),f=r.data("lastTouch")||u+1,g=u-f;if(window.clearTimeout(o),r.data("callee2",l),g100){r.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var d={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?n.changedTouches[0].pageX-r.offset().left:e.pageX-r.offset().left),y:Math.round(i.touch_capable?n.changedTouches[0].pageY-r.offset().top:e.pageY-r.offset().top)},time:Date.now(),target:e.target},v={firstTap:p,secondTap:d,interval:d.time-p.time};h||(a(s,"doubletap",e,v),p=null),h=!0,c=window.setTimeout(function(){h=!1},i.doubletap_int)}else r.data("lastTouch",u),o=window.setTimeout(function(){p=null,window.clearTimeout(o)},i.doubletap_int,[e]);r.data("lastTouch",u)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,c=null,s={x:0,y:0};o.on(i.startevent,function r(e){return e.which&&1!==e.which?!1:(c=Date.now(),n=e.target,o.data("callee1",r),s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function p(e){if(o.data("callee2",p),e.target==n){var r=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,h=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY;i.tap_timer=window.setTimeout(function(){if(!o.data("doubletapped")&&!o.data("tapheld")&&s.x==r&&s.y==h){var n=e.originalEvent,p={position:{x:i.touch_capable?n.changedTouches[0].screenX:e.screenX,y:i.touch_capable?n.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?n.changedTouches[0].pageX-o.offset().left:e.pageX-o.offset().left),y:Math.round(i.touch_capable?n.changedTouches[0].pageY-o.offset().top:e.pageY-o.offset().top)},time:Date.now(),target:e.target};p.time-c=-i.tap_pixel_range&&f<=i.tap_pixel_range&&g>=-i.tap_pixel_range&&g<=i.tap_pixel_range)){for(var d=e.originalEvent,v=[],w=0;wu.y&&h.y-u.y>g&&(o="swipeup"),h.xf&&(o="swiperight"),h.yg&&(o="swipedown"),h.x>u.x&&h.x-u.x>f&&(o="swipeleft"),void 0!=o&&r){h.x=0,h.y=0,u.x=0,u.y=0,r=!1;var d=t.originalEvent,v={position:{x:i.touch_capable?d.touches[0].screenX:t.screenX,y:i.touch_capable?d.touches[0].screenY:t.screenY},offset:{x:Math.round(i.touch_capable?d.changedTouches[0].pageX-s.offset().left:t.pageX-s.offset().left),y:Math.round(i.touch_capable?d.changedTouches[0].pageY-s.offset().top:t.pageY-s.offset().top)},time:Date.now(),target:t.target},w=Math.abs(n.position.x-v.position.x),_=Math.abs(n.position.y-v.position.y),T={startEvnt:n,endEvnt:v,direction:o.replace("swipe",""),xAmount:w,yAmount:_,duration:v.time-n.time};p=!0,s.trigger("swipe",T).trigger(o,T)}}function o(t){s=e(t.currentTarget);var a="";if(s.data("callee3",o),p){var c=s.data("xthreshold"),h=s.data("ythreshold"),u="undefined"!=typeof c&&c!==!1&&parseInt(c)?parseInt(c):i.swipe_h_threshold,l="undefined"!=typeof h&&h!==!1&&parseInt(h)?parseInt(h):i.swipe_v_threshold,f=t.originalEvent,g={position:{x:i.touch_capable?f.changedTouches[0].screenX:t.screenX,y:i.touch_capable?f.changedTouches[0].screenY:t.screenY},offset:{x:Math.round(i.touch_capable?f.changedTouches[0].pageX-s.offset().left:t.pageX-s.offset().left),y:Math.round(i.touch_capable?f.changedTouches[0].pageY-s.offset().top:t.pageY-s.offset().top)},time:Date.now(),target:t.target};n.position.y>g.position.y&&n.position.y-g.position.y>l&&(a="swipeup"),n.position.xu&&(a="swiperight"),n.position.yl&&(a="swipedown"),n.position.x>g.position.x&&n.position.x-g.position.x>u&&(a="swipeleft");var d=Math.abs(n.position.x-g.position.x),v=Math.abs(n.position.y-g.position.y),w={startEvnt:n,endEvnt:g,direction:a.replace("swipe",""),xAmount:d,yAmount:v,duration:g.time-n.time};s.trigger("swipeend",w)}r=!1,p=!1}var n,c=this,s=e(c),r=!1,p=!1,h={x:0,y:0},u={x:0,y:0};s.on(i.startevent,t),s.on(i.moveevent,a),s.on(i.endevent,o)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){o=t,a(c,o?"scrollstart":"scrollend",e)}var o,n,c=this,s=e(c);s.on(i.scrollevent,function r(e){s.data("callee",r),o||t(e,!0),clearTimeout(n),n=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var c,s,r,p,h,u=e(window),l={0:!0,180:!0};if(i.orientation_support){var f=window.innerWidth||u.width(),g=window.innerHeight||u.height(),d=50;p=f>g&&f-g>d,h=l[window.orientation],(p&&h||!p&&!h)&&(l={"-90":!0,90:!0})}e.event.special.orientationchange=c={setup:function(){return i.orientation_support?!1:(r=s(),u.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(u.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=s(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=s=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?l[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",x)},teardown:function(){e(this).off("resize",x)}};var v,w,_,T=250,x=function(){w=Date.now(),_=w-y,_>=T?(y=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,T-_))},y=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.4/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(e){function t(){var e=s();e!==r&&(r=e,u.trigger("orientationchange"))}function a(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.attrFn=e.attrFn||{};var o=navigator.userAgent.toLowerCase(),n=o.indexOf("chrome")>-1&&(o.indexOf("windows")>-1||o.indexOf("macintosh")>-1||o.indexOf("linux")>-1)&&o.indexOf("mobile")<0&&o.indexOf("android")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in window&&!n,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in window&&!n?"touchstart":"mousedown",endevent:"ontouchstart"in window&&!n?"touchend":"mouseup",moveevent:"ontouchstart"in window&&!n?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!n?"tap":"click",scrollevent:"ontouchstart"in window&&!n?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(i.startevent,function n(e){if(o.data("callee",n),e.which&&1!==e.which)return!1;var c=e.originalEvent,s={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?c.changedTouches[0].pageX-o.position().left:e.pageX-o.position().left),y:Math.round(i.touch_capable?c.changedTouches[0].pageY-o.position().top:e.pageY-o.position().top)},time:Date.now(),target:e.target};return a(t,"tapstart",e,s),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(i.moveevent,function n(e){o.data("callee",n);var c=e.originalEvent,s={position:{x:i.touch_capable?c.touches[0].screenX:e.screenX,y:i.touch_capable?c.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?c.changedTouches[0].pageX-o.position().left:e.pageX-o.position().left),y:Math.round(i.touch_capable?c.changedTouches[0].pageY-o.position().top:e.pageY-o.position().top)},time:Date.now(),target:e.target};return a(t,"tapmove",e,s),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(i.endevent,function n(e){o.data("callee",n);var c=e.originalEvent,s={position:{x:i.touch_capable?c.changedTouches[0].screenX:e.screenX,y:i.touch_capable?c.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?c.changedTouches[0].pageX-o.position().left:e.pageX-o.position().left),y:Math.round(i.touch_capable?c.changedTouches[0].pageY-o.position().top:e.pageY-o.position().top)},time:Date.now(),target:e.target};return a(t,"tapend",e,s),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),c={x:0,y:0},s=0,r=0;n.on(i.startevent,function p(e){if(e.which&&1!==e.which)return!1;n.data("tapheld",!1),t=e.target;var h=e.originalEvent,u=Date.now(),l={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},g={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};return c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,s=c.x,r=c.y,i.hold_timer=window.setTimeout(function(){var d=c.x-s,f=c.y-r;if(e.target==t&&(c.x==s&&c.y==r||d>=-i.tap_pixel_range&&d<=i.tap_pixel_range&&f>=-i.tap_pixel_range&&f<=i.tap_pixel_range)){n.data("tapheld",!0);var v=Date.now(),w={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},_={x:Math.round(i.touch_capable?h.changedTouches[0].pageX-n.position().left:e.pageX-n.position().left),y:Math.round(i.touch_capable?h.changedTouches[0].pageY-n.position().top:e.pageY-n.position().top)},T=v-u,x={startTime:u,endTime:v,startPosition:l,startOffset:g,endPosition:w,endOffset:_,duration:T,target:e.target};n.data("callee1",p),a(o,"taphold",e,x)}},i.taphold_threshold),!0}).on(i.endevent,function h(){n.data("callee2",h),n.data("tapheld",!1),window.clearTimeout(i.hold_timer)}).on(i.moveevent,function u(e){n.data("callee3",u),s=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,r=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2).off(i.moveevent,e(this).data.callee3)}},e.event.special.doubletap={setup:function(){var t,o,n,c,s=this,r=e(s),p=null,h=!1;r.on(i.startevent,function u(e){return e.which&&1!==e.which?!1:(r.data("doubletapped",!1),t=e.target,r.data("callee1",u),n=e.originalEvent,p||(p={position:{x:i.touch_capable?n.touches[0].screenX:e.screenX,y:i.touch_capable?n.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?n.changedTouches[0].pageX-r.position().left:e.pageX-r.position().left),y:Math.round(i.touch_capable?n.changedTouches[0].pageY-r.position().top:e.pageY-r.position().top)},time:Date.now(),target:e.target}),!0)}).on(i.endevent,function l(e){var u=Date.now(),g=r.data("lastTouch")||u+1,d=u-g;if(window.clearTimeout(o),r.data("callee2",l),d100){r.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var f={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?n.changedTouches[0].pageX-r.position().left:e.pageX-r.position().left),y:Math.round(i.touch_capable?n.changedTouches[0].pageY-r.position().top:e.pageY-r.position().top)},time:Date.now(),target:e.target},v={firstTap:p,secondTap:f,interval:f.time-p.time};h||(a(s,"doubletap",e,v),p=null),h=!0,c=window.setTimeout(function(){h=!1},i.doubletap_int)}else r.data("lastTouch",u),o=window.setTimeout(function(){p=null,window.clearTimeout(o)},i.doubletap_int,[e]);r.data("lastTouch",u)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,c=null,s={x:0,y:0};o.on(i.startevent,function r(e){return e.which&&1!==e.which?!1:(c=Date.now(),n=e.target,o.data("callee1",r),s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function p(e){if(o.data("callee2",p),e.target==n){var r=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,h=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY;i.tap_timer=window.setTimeout(function(){if(!o.data("doubletapped")&&!o.data("tapheld")&&s.x==r&&s.y==h){var n=e.originalEvent,p={position:{x:i.touch_capable?n.changedTouches[0].screenX:e.screenX,y:i.touch_capable?n.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?n.changedTouches[0].pageX-o.position().left:e.pageX-o.position().left),y:Math.round(i.touch_capable?n.changedTouches[0].pageY-o.position().top:e.pageY-o.position().top)},time:Date.now(),target:e.target};p.time-c=-i.tap_pixel_range&&g<=i.tap_pixel_range&&d>=-i.tap_pixel_range&&d<=i.tap_pixel_range)){for(var f=e.originalEvent,v=[],w=0;wu.y&&h.y-u.y>d&&(o="swipeup"),h.xg&&(o="swiperight"),h.yd&&(o="swipedown"),h.x>u.x&&h.x-u.x>g&&(o="swipeleft"),void 0!=o&&r){h.x=0,h.y=0,u.x=0,u.y=0,r=!1;var f=t.originalEvent,v={position:{x:i.touch_capable?f.touches[0].screenX:t.screenX,y:i.touch_capable?f.touches[0].screenY:t.screenY},offset:{x:Math.round(i.touch_capable?f.changedTouches[0].pageX-s.position().left:t.pageX-s.position().left),y:Math.round(i.touch_capable?f.changedTouches[0].pageY-s.position().top:t.pageY-s.position().top)},time:Date.now(),target:t.target},w=Math.abs(n.position.x-v.position.x),_=Math.abs(n.position.y-v.position.y),T={startEvnt:n,endEvnt:v,direction:o.replace("swipe",""),xAmount:w,yAmount:_,duration:v.time-n.time};p=!0,s.trigger("swipe",T).trigger(o,T)}}function o(t){s=e(t.currentTarget);var a="";if(s.data("callee3",o),p){var c=s.data("xthreshold"),h=s.data("ythreshold"),u="undefined"!=typeof c&&c!==!1&&parseInt(c)?parseInt(c):i.swipe_h_threshold,l="undefined"!=typeof h&&h!==!1&&parseInt(h)?parseInt(h):i.swipe_v_threshold,g=t.originalEvent,d={position:{x:i.touch_capable?g.changedTouches[0].screenX:t.screenX,y:i.touch_capable?g.changedTouches[0].screenY:t.screenY},offset:{x:Math.round(i.touch_capable?g.changedTouches[0].pageX-s.position().left:t.pageX-s.position().left),y:Math.round(i.touch_capable?g.changedTouches[0].pageY-s.position().top:t.pageY-s.position().top)},time:Date.now(),target:t.target};n.position.y>d.position.y&&n.position.y-d.position.y>l&&(a="swipeup"),n.position.xu&&(a="swiperight"),n.position.yl&&(a="swipedown"),n.position.x>d.position.x&&n.position.x-d.position.x>u&&(a="swipeleft");var f=Math.abs(n.position.x-d.position.x),v=Math.abs(n.position.y-d.position.y),w={startEvnt:n,endEvnt:d,direction:a.replace("swipe",""),xAmount:f,yAmount:v,duration:d.time-n.time};s.trigger("swipeend",w)}r=!1,p=!1}var n,c=this,s=e(c),r=!1,p=!1,h={x:0,y:0},u={x:0,y:0};s.on(i.startevent,t),s.on(i.moveevent,a),s.on(i.endevent,o)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){o=t,a(c,o?"scrollstart":"scrollend",e)}var o,n,c=this,s=e(c);s.on(i.scrollevent,function r(e){s.data("callee",r),o||t(e,!0),clearTimeout(n),n=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var c,s,r,p,h,u=e(window),l={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||u.width(),d=window.innerHeight||u.height(),f=50;p=g>d&&g-d>f,h=l[window.orientation],(p&&h||!p&&!h)&&(l={"-90":!0,90:!0})}e.event.special.orientationchange=c={setup:function(){return i.orientation_support?!1:(r=s(),u.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(u.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=s(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=s=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?l[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",x)},teardown:function(){e(this).off("resize",x)}};var v,w,_,T=250,x=function(){w=Date.now(),_=w-y,_>=T?(y=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,T-_))},y=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.2/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(e){function t(){var e=c();e!==r&&(r=e,u.trigger("orientationchange"))}function a(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.attrFn=e.attrFn||{};var o=navigator.userAgent.toLowerCase(),n=o.indexOf("chrome")>-1&&(o.indexOf("windows")>-1||o.indexOf("macintosh")>-1||o.indexOf("linux")>-1)&&o.indexOf("mobile")<0&&o.indexOf("android")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:window.navigator.msPointerEnabled?!1:"ontouchstart"in window&&!n,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:window.navigator.msPointerEnabled?"MSPointerDown":"ontouchstart"in window&&!n?"touchstart":"mousedown",endevent:window.navigator.msPointerEnabled?"MSPointerUp":"ontouchstart"in window&&!n?"touchend":"mouseup",moveevent:window.navigator.msPointerEnabled?"MSPointerMove":"ontouchstart"in window&&!n?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!n?"tap":"click",scrollevent:"ontouchstart"in window&&!n?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(i.startevent,function n(e){if(o.data("callee",n),e.which&&1!==e.which)return!1;var s=e.originalEvent,c={position:{x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapstart",e,c),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(i.moveevent,function n(e){o.data("callee",n);var s=e.originalEvent,c={position:{x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapmove",e,c),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(i.endevent,function n(e){o.data("callee",n);var s=e.originalEvent,c={position:{x:i.touch_capable?s.changedTouches[0].screenX:e.screenX,y:i.touch_capable?s.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?s.changedTouches[0].pageX-s.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.changedTouches[0].pageY-s.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapend",e,c),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),s={x:0,y:0},c=0,r=0;n.on(i.startevent,function h(e){if(e.which&&1!==e.which)return!1;n.data("tapheld",!1),t=e.target;var p=e.originalEvent,u=Date.now(),l={x:i.touch_capable?p.touches[0].screenX:e.screenX,y:i.touch_capable?p.touches[0].screenY:e.screenY},g={x:i.touch_capable?p.touches[0].pageX-p.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?p.touches[0].pageY-p.touches[0].target.offsetTop:e.offsetY};return s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,c=s.x,r=s.y,i.hold_timer=window.setTimeout(function(){var f=s.x-c,d=s.y-r;if(e.target==t&&(s.x==c&&s.y==r||f>=-i.tap_pixel_range&&f<=i.tap_pixel_range&&d>=-i.tap_pixel_range&&d<=i.tap_pixel_range)){n.data("tapheld",!0);var v=Date.now(),w={x:i.touch_capable?p.touches[0].screenX:e.screenX,y:i.touch_capable?p.touches[0].screenY:e.screenY},T={x:i.touch_capable?p.touches[0].pageX-p.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?p.touches[0].pageY-p.touches[0].target.offsetTop:e.offsetY},_=v-u,x={startTime:u,endTime:v,startPosition:l,startOffset:g,endPosition:w,endOffset:T,duration:_,target:e.target};n.data("callee1",h),a(o,"taphold",e,x)}},i.taphold_threshold),!0}).on(i.endevent,function p(){n.data("callee2",p),n.data("tapheld",!1),window.clearTimeout(i.hold_timer)}).on(i.moveevent,function u(e){n.data("callee3",u),c=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,r=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2).off(i.moveevent,e(this).data.callee3)}},e.event.special.doubletap={setup:function(){var t,o,n,s,c=this,r=e(c),h=null,p=!1;r.on(i.startevent,function u(e){return e.which&&1!==e.which?!1:(r.data("doubletapped",!1),t=e.target,r.data("callee1",u),n=e.originalEvent,h||(h={position:{x:i.touch_capable?n.touches[0].screenX:e.screenX,y:i.touch_capable?n.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?n.touches[0].pageX-n.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?n.touches[0].pageY-n.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target}),!0)}).on(i.endevent,function l(e){var n=Date.now(),u=r.data("lastTouch")||n+1,g=n-u;if(window.clearTimeout(o),r.data("callee2",l),g100){r.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var f={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?e.originalEvent.changedTouches[0].pageX-e.originalEvent.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?e.originalEvent.changedTouches[0].pageY-e.originalEvent.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target},d={firstTap:h,secondTap:f,interval:f.time-h.time};p||(a(c,"doubletap",e,d),h=null),p=!0,s=window.setTimeout(function(){p=!1},i.doubletap_int)}else r.data("lastTouch",n),o=window.setTimeout(function(){h=null,window.clearTimeout(o)},i.doubletap_int,[e]);r.data("lastTouch",n)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,s=null,c={x:0,y:0};o.on(i.startevent,function r(e){return e.which&&1!==e.which?!1:(s=Date.now(),n=e.target,o.data("callee1",r),c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function h(e){if(o.data("callee2",h),e.target==n){var r=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,p=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY;i.tap_timer=window.setTimeout(function(){if(!o.data("doubletapped")&&!o.data("tapheld")&&c.x==r&&c.y==p){var n=e.originalEvent,h={position:{x:i.touch_capable?n.changedTouches[0].screenX:e.screenX,y:i.touch_capable?n.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?n.changedTouches[0].pageX-n.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?n.changedTouches[0].pageY-n.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};h.time-s=-i.tap_pixel_range&&f<=i.tap_pixel_range&&d>=-i.tap_pixel_range&&d<=i.tap_pixel_range)){for(var v=e.originalEvent,w=[],T=0;Tu.y&&p.y-u.y>f&&(o="swipeup"),p.xg&&(o="swiperight"),p.yf&&(o="swipedown"),p.x>u.x&&p.x-u.x>g&&(o="swipeleft"),void 0!=o&&r){p.x=0,p.y=0,u.x=0,u.y=0,r=!1;var d=t.originalEvent,v={position:{x:i.touch_capable?d.touches[0].screenX:t.screenX,y:i.touch_capable?d.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?d.touches[0].pageX-d.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?d.touches[0].pageY-d.touches[0].target.offsetTop:t.offsetY},time:Date.now(),target:t.target},w=Math.abs(n.position.x-v.position.x),T=Math.abs(n.position.y-v.position.y),_={startEvnt:n,endEvnt:v,direction:o.replace("swipe",""),xAmount:w,yAmount:T,duration:v.time-n.time};h=!0,c.trigger("swipe",_).trigger(o,_)}}function o(t){c=e(t.currentTarget);var a="";if(c.data("callee3",o),h){var s=c.data("xthreshold"),p=c.data("ythreshold"),u="undefined"!=typeof s&&s!==!1&&parseInt(s)?parseInt(s):i.swipe_h_threshold,l="undefined"!=typeof p&&p!==!1&&parseInt(p)?parseInt(p):i.swipe_v_threshold,g=t.originalEvent,f={position:{x:i.touch_capable?g.changedTouches[0].screenX:t.screenX,y:i.touch_capable?g.changedTouches[0].screenY:t.screenY},offset:{x:i.touch_capable?g.changedTouches[0].pageX-g.changedTouches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?g.changedTouches[0].pageY-g.changedTouches[0].target.offsetTop:t.offsetY},time:Date.now(),target:t.target};n.position.y>f.position.y&&n.position.y-f.position.y>l&&(a="swipeup"),n.position.xu&&(a="swiperight"),n.position.yl&&(a="swipedown"),n.position.x>f.position.x&&n.position.x-f.position.x>u&&(a="swipeleft");var d=Math.abs(n.position.x-f.position.x),v=Math.abs(n.position.y-f.position.y),w={startEvnt:n,endEvnt:f,direction:a.replace("swipe",""),xAmount:d,yAmount:v,duration:f.time-n.time};c.trigger("swipeend",w)}r=!1,h=!1}var n,s=this,c=e(s),r=!1,h=!1,p={x:0,y:0},u={x:0,y:0};c.on(i.startevent,t),c.on(i.moveevent,a),c.on(i.endevent,o)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){o=t,a(s,o?"scrollstart":"scrollend",e)}var o,n,s=this,c=e(s);c.on(i.scrollevent,function r(e){c.data("callee",r),o||t(e,!0),clearTimeout(n),n=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var s,c,r,h,p,u=e(window),l={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||u.width(),f=window.innerHeight||u.height(),d=50;h=g>f&&g-f>d,p=l[window.orientation],(h&&p||!h&&!p)&&(l={"-90":!0,90:!0})}e.event.special.orientationchange=s={setup:function(){return i.orientation_support?!1:(r=c(),u.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(u.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=c(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=c=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?l[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",x)},teardown:function(){e(this).off("resize",x)}};var v,w,T,_=250,x=function(){w=Date.now(),T=w-y,T>=_?(y=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,_-T))},y=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.0/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(){var e=c();e!==r&&(r=e,l.trigger("orientationchange"))}function a(t,a,n,o){var i=n.type;n.type=a,e.event.dispatch.call(t,n,o),n.type=i}e.attrFn=e.attrFn||{};var n=navigator.userAgent.toLowerCase(),o=n.indexOf("chrome")>-1&&(n.indexOf("windows")>-1||n.indexOf("macintosh")>-1||n.indexOf("linux")>-1)&&n.indexOf("mobile")<0&&n.indexOf("android")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in window&&!o,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in window&&!o?"touchstart":"mousedown",endevent:"ontouchstart"in window&&!o?"touchend":"mouseup",moveevent:"ontouchstart"in window&&!o?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!o?"tap":"click",scrollevent:"ontouchstart"in window&&!o?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,n=e(t);n.on(i.startevent,function(e){if(n.data("callee",arguments.callee),e.which&&1!==e.which)return!1;var o=e.originalEvent,s={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapstart",e,s),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,n=e(t);n.on(i.moveevent,function(e){n.data("callee",arguments.callee);var o=e.originalEvent,s={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapmove",e,s),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,n=e(t);n.on(i.endevent,function(e){n.data("callee",arguments.callee);var o=e.originalEvent,s={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapend",e,s),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,n=this,o=e(n),s={x:0,y:0},c=0,r=0;o.on(i.startevent,function(e){if(e.which&&1!==e.which)return!1;o.data("tapheld",!1),t=e.target;var h=e.originalEvent,u=Date.now(),l={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},p={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};return s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,c=s.x,r=s.y,i.hold_timer=window.setTimeout(function(){var g=s.x-c,f=s.y-r;if(e.target==t&&(s.x==c&&s.y==r||g>=-i.tap_pixel_range&&g<=i.tap_pixel_range&&f>=-i.tap_pixel_range&&f<=i.tap_pixel_range)){o.data("tapheld",!0);var d=Date.now(),v={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},w={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};duration=d-u;var _={startTime:u,endTime:d,startPosition:l,startOffset:p,endPosition:v,endOffset:w,duration:duration,target:e.target};o.data("callee1",arguments.callee),a(n,"taphold",e,_)}},i.taphold_threshold),!0}).on(i.endevent,function(){o.data("callee2",arguments.callee),o.data("tapheld",!1),window.clearTimeout(i.hold_timer)}).on(i.moveevent,function(e){o.data("callee3",arguments.callee),c=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,r=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2).off(i.moveevent,e(this).data.callee3)}},e.event.special.doubletap={setup:function(){var t,n,o,s,c,r=this,h=e(r),u=!1;h.on(i.startevent,function(e){return e.which&&1!==e.which?!1:(h.data("doubletapped",!1),t=e.target,h.data("callee1",arguments.callee),s=e.originalEvent,o={position:{x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target},!0)}).on(i.endevent,function(e){var s=Date.now(),l=h.data("lastTouch")||s+1,p=s-l;if(window.clearTimeout(n),h.data("callee2",arguments.callee),p100){h.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var g={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?e.originalEvent.changedTouches[0].pageX-e.originalEvent.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?e.originalEvent.changedTouches[0].pageY-e.originalEvent.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target},f={firstTap:o,secondTap:g,interval:g.time-o.time};u||a(r,"doubletap",e,f),u=!0,c=window.setTimeout(function(){u=!1},i.doubletap_int)}else h.data("lastTouch",s),n=window.setTimeout(function(){window.clearTimeout(n)},i.doubletap_int,[e]);h.data("lastTouch",s)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,n=e(t),o=null,s=null,c={x:0,y:0};n.on(i.startevent,function(e){return e.which&&1!==e.which?!1:(s=Date.now(),o=e.target,n.data("callee1",arguments.callee),c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function(e){n.data("callee2",arguments.callee),e.target==o&&(end_pos_x=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,end_pos_y=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY,i.tap_timer=window.setTimeout(function(){if(!n.data("doubletapped")&&!n.data("tapheld")&&c.x==end_pos_x&&c.y==end_pos_y){var o=e.originalEvent,r={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};r.time-s=-i.tap_pixel_range&&g<=i.tap_pixel_range&&f>=-i.tap_pixel_range&&f<=i.tap_pixel_range)){for(var d=e.originalEvent,v=[],w=0;wl.y&&u.y-l.y>g&&(a="swipeup"),u.xp&&(a="swiperight"),u.yg&&(a="swipedown"),u.x>l.x&&u.x-l.x>p&&(a="swipeleft"),void 0!=a&&r){u.x=0,u.y=0,l.x=0,l.y=0,r=!1;var f=t.originalEvent;endEvnt={position:{x:i.touch_capable?f.touches[0].screenX:t.screenX,y:i.touch_capable?f.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?f.touches[0].pageX-f.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?f.touches[0].pageY-f.touches[0].target.offsetTop:t.offsetY},time:Date.now(),target:t.target};var d=Math.abs(o.position.x-endEvnt.position.x),v=Math.abs(o.position.y-endEvnt.position.y),w={startEvnt:o,endEvnt:endEvnt,direction:a.replace("swipe",""),xAmount:d,yAmount:v,duration:endEvnt.time-o.time};h=!0,c.trigger("swipe",w).trigger(a,w)}}function n(t){c=e(t.currentTarget);var a="";if(c.data("callee3",arguments.callee),h){var n=c.data("xthreshold"),s=c.data("ythreshold"),u="undefined"!=typeof n&&n!==!1&&parseInt(n)?parseInt(n):i.swipe_h_threshold,l="undefined"!=typeof s&&s!==!1&&parseInt(s)?parseInt(s):i.swipe_v_threshold,p=t.originalEvent;endEvnt={position:{x:i.touch_capable?p.changedTouches[0].screenX:t.screenX,y:i.touch_capable?p.changedTouches[0].screenY:t.screenY},offset:{x:i.touch_capable?p.changedTouches[0].pageX-p.changedTouches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?p.changedTouches[0].pageY-p.changedTouches[0].target.offsetTop:t.offsetY},time:Date.now(),target:t.target},o.position.y>endEvnt.position.y&&o.position.y-endEvnt.position.y>l&&(a="swipeup"),o.position.xu&&(a="swiperight"),o.position.yl&&(a="swipedown"),o.position.x>endEvnt.position.x&&o.position.x-endEvnt.position.x>u&&(a="swipeleft");var g=Math.abs(o.position.x-endEvnt.position.x),f=Math.abs(o.position.y-endEvnt.position.y),d={startEvnt:o,endEvnt:endEvnt,direction:a.replace("swipe",""),xAmount:g,yAmount:f,duration:endEvnt.time-o.time};c.trigger("swipeend",d)}r=!1,h=!1}var o,s=this,c=e(s),r=!1,h=!1,u={x:0,y:0},l={x:0,y:0};c.on(i.startevent,t),c.on(i.moveevent,a),c.on(i.endevent,n)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){n=t,a(s,n?"scrollstart":"scrollend",e)}var n,o,s=this,c=e(s);c.on(i.scrollevent,function(e){c.data("callee",arguments.callee),n||t(e,!0),clearTimeout(o),o=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var s,c,r,h,u,l=e(window),p={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||l.width(),f=window.innerHeight||l.height(),d=50;h=g>f&&g-f>d,u=p[window.orientation],(h&&u||!h&&!u)&&(p={"-90":!0,90:!0})}e.event.special.orientationchange=s={setup:function(){return i.orientation_support?!1:(r=c(),l.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(l.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=c(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=c=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?p[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",m)},teardown:function(){e(this).off("resize",m)}};var v,w,_,T=250,m=function(){w=Date.now(),_=w-x,_>=T?(x=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,T-_))},x=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.3/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(e){function t(){var e=s();e!==c&&(c=e,l.trigger("orientationchange"))}function a(t,a,n,o){var i=n.type;n.type=a,e.event.dispatch.call(t,n,o),n.type=i}e.attrFn=e.attrFn||{};var n=navigator.userAgent.toLowerCase(),o=n.indexOf("chrome")>-1&&(n.indexOf("windows")>-1||n.indexOf("macintosh")>-1||n.indexOf("linux")>-1)&&n.indexOf("mobile")<0&&n.indexOf("android")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:window.navigator.msPointerEnabled?!1:"ontouchstart"in window&&!o,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:window.navigator.msPointerEnabled?"MSPointerDown":"ontouchstart"in window&&!o?"touchstart":"mousedown",endevent:window.navigator.msPointerEnabled?"MSPointerUp":"ontouchstart"in window&&!o?"touchend":"mouseup",moveevent:window.navigator.msPointerEnabled?"MSPointerMove":"ontouchstart"in window&&!o?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!o?"tap":"click",scrollevent:"ontouchstart"in window&&!o?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,n=e(t);n.on(i.startevent,function o(e){if(n.data("callee",o),e.which&&1!==e.which)return!1;var r=e.originalEvent,s={position:{x:i.touch_capable?r.touches[0].screenX:e.screenX,y:i.touch_capable?r.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?r.changedTouches[0].pageX-n.position().left:e.pageX-n.position().left),y:Math.round(i.touch_capable?r.changedTouches[0].pageY-n.position().top:e.pageY-n.position().top)},time:Date.now(),target:e.target};return a(t,"tapstart",e,s),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,n=e(t);n.on(i.moveevent,function o(e){n.data("callee",o);var r=e.originalEvent,s={position:{x:i.touch_capable?r.touches[0].screenX:e.screenX,y:i.touch_capable?r.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?r.changedTouches[0].pageX-n.position().left:e.pageX-n.position().left),y:Math.round(i.touch_capable?r.changedTouches[0].pageY-n.position().top:e.pageY-n.position().top)},time:Date.now(),target:e.target};return a(t,"tapmove",e,s),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,n=e(t);n.on(i.endevent,function o(e){n.data("callee",o);var r=e.originalEvent,s={position:{x:i.touch_capable?r.changedTouches[0].screenX:e.screenX,y:i.touch_capable?r.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?r.changedTouches[0].pageX-n.position().left:e.pageX-n.position().left),y:Math.round(i.touch_capable?r.changedTouches[0].pageY-n.position().top:e.pageY-n.position().top)},time:Date.now(),target:e.target};return a(t,"tapend",e,s),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,n=this,o=e(n),r={x:0,y:0},s=0,c=0;o.on(i.startevent,function p(e){if(e.which&&1!==e.which)return!1;o.data("tapheld",!1),t=e.target;var h=e.originalEvent,l=Date.now(),u={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},g={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};return r.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,r.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,s=r.x,c=r.y,i.hold_timer=window.setTimeout(function(){var d=r.x-s,f=r.y-c;if(e.target==t&&(r.x==s&&r.y==c||d>=-i.tap_pixel_range&&d<=i.tap_pixel_range&&f>=-i.tap_pixel_range&&f<=i.tap_pixel_range)){o.data("tapheld",!0);var v=Date.now(),w={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},_={x:Math.round(i.touch_capable?h.changedTouches[0].pageX-o.position().left:e.pageX-o.position().left),y:Math.round(i.touch_capable?h.changedTouches[0].pageY-o.position().top:e.pageY-o.position().top)},T=v-l,x={startTime:l,endTime:v,startPosition:u,startOffset:g,endPosition:w,endOffset:_,duration:T,target:e.target};o.data("callee1",p),a(n,"taphold",e,x)}},i.taphold_threshold),!0}).on(i.endevent,function h(){o.data("callee2",h),o.data("tapheld",!1),window.clearTimeout(i.hold_timer)}).on(i.moveevent,function l(e){o.data("callee3",l),s=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2).off(i.moveevent,e(this).data.callee3)}},e.event.special.doubletap={setup:function(){var t,n,o,r,s=this,c=e(s),p=null,h=!1;c.on(i.startevent,function l(e){return e.which&&1!==e.which?!1:(c.data("doubletapped",!1),t=e.target,c.data("callee1",l),o=e.originalEvent,p||(p={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?o.changedTouches[0].pageX-c.position().left:e.pageX-c.position().left),y:Math.round(i.touch_capable?o.changedTouches[0].pageY-c.position().top:e.pageY-c.position().top)},time:Date.now(),target:e.target}),!0)}).on(i.endevent,function u(e){var l=Date.now(),g=c.data("lastTouch")||l+1,d=l-g;if(window.clearTimeout(n),c.data("callee2",u),d100){c.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var f={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?o.changedTouches[0].pageX-c.position().left:e.pageX-c.position().left),y:Math.round(i.touch_capable?o.changedTouches[0].pageY-c.position().top:e.pageY-c.position().top)},time:Date.now(),target:e.target},v={firstTap:p,secondTap:f,interval:f.time-p.time};h||(a(s,"doubletap",e,v),p=null),h=!0,r=window.setTimeout(function(){h=!1},i.doubletap_int)}else c.data("lastTouch",l),n=window.setTimeout(function(){p=null,window.clearTimeout(n)},i.doubletap_int,[e]);c.data("lastTouch",l)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,n=e(t),o=null,r=null,s={x:0,y:0};n.on(i.startevent,function c(e){return e.which&&1!==e.which?!1:(r=Date.now(),o=e.target,n.data("callee1",c),s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function p(e){if(n.data("callee2",p),e.target==o){var c=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,h=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY;i.tap_timer=window.setTimeout(function(){if(!n.data("doubletapped")&&!n.data("tapheld")&&s.x==c&&s.y==h){var o=e.originalEvent,p={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:Math.round(i.touch_capable?o.changedTouches[0].pageX-n.position().left:e.pageX-n.position().left),y:Math.round(i.touch_capable?o.changedTouches[0].pageY-n.position().top:e.pageY-n.position().top)},time:Date.now(),target:e.target};p.time-r=-i.tap_pixel_range&&d<=i.tap_pixel_range&&f>=-i.tap_pixel_range&&f<=i.tap_pixel_range)){for(var v=e.originalEvent,w=[],_=0;_l.y&&h.y-l.y>d&&(n="swipeup"),h.xg&&(n="swiperight"),h.yd&&(n="swipedown"),h.x>l.x&&h.x-l.x>g&&(n="swipeleft"),void 0!=n&&c){h.x=0,h.y=0,l.x=0,l.y=0,c=!1;var f=t.originalEvent,v={position:{x:i.touch_capable?f.touches[0].screenX:t.screenX,y:i.touch_capable?f.touches[0].screenY:t.screenY},offset:{x:Math.round(i.touch_capable?f.changedTouches[0].pageX-s.position().left:t.pageX-s.position().left),y:Math.round(i.touch_capable?f.changedTouches[0].pageY-s.position().top:t.pageY-s.position().top)},time:Date.now(),target:t.target},w=Math.abs(o.position.x-v.position.x),_=Math.abs(o.position.y-v.position.y),T={startEvnt:o,endEvnt:v,direction:n.replace("swipe",""),xAmount:w,yAmount:_,duration:v.time-o.time};p=!0,s.trigger("swipe",T).trigger(n,T)}}function n(t){s=e(t.currentTarget);var a="";if(s.data("callee3",n),p){var r=s.data("xthreshold"),h=s.data("ythreshold"),l="undefined"!=typeof r&&r!==!1&&parseInt(r)?parseInt(r):i.swipe_h_threshold,u="undefined"!=typeof h&&h!==!1&&parseInt(h)?parseInt(h):i.swipe_v_threshold,g=t.originalEvent,d={position:{x:i.touch_capable?g.changedTouches[0].screenX:t.screenX,y:i.touch_capable?g.changedTouches[0].screenY:t.screenY},offset:{x:Math.round(i.touch_capable?g.changedTouches[0].pageX-s.position().left:t.pageX-s.position().left),y:Math.round(i.touch_capable?g.changedTouches[0].pageY-s.position().top:t.pageY-s.position().top)},time:Date.now(),target:t.target};o.position.y>d.position.y&&o.position.y-d.position.y>u&&(a="swipeup"),o.position.xl&&(a="swiperight"),o.position.yu&&(a="swipedown"),o.position.x>d.position.x&&o.position.x-d.position.x>l&&(a="swipeleft");var f=Math.abs(o.position.x-d.position.x),v=Math.abs(o.position.y-d.position.y),w={startEvnt:o,endEvnt:d,direction:a.replace("swipe",""),xAmount:f,yAmount:v,duration:d.time-o.time};s.trigger("swipeend",w)}c=!1,p=!1}var o,r=this,s=e(r),c=!1,p=!1,h={x:0,y:0},l={x:0,y:0};s.on(i.startevent,t),s.on(i.moveevent,a),s.on(i.endevent,n)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){n=t,a(r,n?"scrollstart":"scrollend",e)}var n,o,r=this,s=e(r);s.on(i.scrollevent,function c(e){s.data("callee",c),n||t(e,!0),clearTimeout(o),o=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var r,s,c,p,h,l=e(window),u={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||l.width(),d=window.innerHeight||l.height(),f=50;p=g>d&&g-d>f,h=u[window.orientation],(p&&h||!p&&!h)&&(u={"-90":!0,90:!0})}e.event.special.orientationchange=r={setup:function(){return i.orientation_support?!1:(c=s(),l.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(l.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=s(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=s=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?u[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",x)},teardown:function(){e(this).off("resize",x)}};var v,w,_,T=250,x=function(){w=Date.now(),_=w-y,_>=T?(y=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,T-_))},y=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.1/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(){var e=c();e!==r&&(r=e,l.trigger("orientationchange"))}function a(t,a,n,o){var i=n.type;n.type=a,e.event.dispatch.call(t,n,o),n.type=i}e.attrFn=e.attrFn||{};var n=navigator.userAgent.toLowerCase(),o=n.indexOf("chrome")>-1&&(n.indexOf("windows")>-1||n.indexOf("macintosh")>-1||n.indexOf("linux")>-1)&&n.indexOf("mobile")<0&&n.indexOf("android")<0,i={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:window.navigator.msPointerEnabled?!1:"ontouchstart"in window&&!o,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:window.navigator.msPointerEnabled?"MSPointerDown":"ontouchstart"in window&&!o?"touchstart":"mousedown",endevent:window.navigator.msPointerEnabled?"MSPointerUp":"ontouchstart"in window&&!o?"touchend":"mouseup",moveevent:window.navigator.msPointerEnabled?"MSPointerMove":"ontouchstart"in window&&!o?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!o?"tap":"click",scrollevent:"ontouchstart"in window&&!o?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.isTouchCapable=function(){return i.touch_capable},e.getStartEvent=function(){return i.startevent},e.getEndEvent=function(){return i.endevent},e.getMoveEvent=function(){return i.moveevent},e.getTapEvent=function(){return i.tapevent},e.getScrollEvent=function(){return i.scrollevent},e.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,n=e(t);n.on(i.startevent,function(e){if(n.data("callee",arguments.callee),e.which&&1!==e.which)return!1;var o=e.originalEvent,s={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapstart",e,s),!0})},remove:function(){e(this).off(i.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,n=e(t);n.on(i.moveevent,function(e){n.data("callee",arguments.callee);var o=e.originalEvent,s={position:{x:i.touch_capable?o.touches[0].screenX:e.screenX,y:i.touch_capable?o.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.touches[0].pageX-o.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.touches[0].pageY-o.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapmove",e,s),!0})},remove:function(){e(this).off(i.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,n=e(t);n.on(i.endevent,function(e){n.data("callee",arguments.callee);var o=e.originalEvent,s={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};return a(t,"tapend",e,s),!0})},remove:function(){e(this).off(i.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,n=this,o=e(n),s={x:0,y:0},c=0,r=0;o.on(i.startevent,function(e){if(e.which&&1!==e.which)return!1;o.data("tapheld",!1),t=e.target;var h=e.originalEvent,u=Date.now(),l={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},p={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};return s.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,s.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,c=s.x,r=s.y,i.hold_timer=window.setTimeout(function(){var g=s.x-c,d=s.y-r;if(e.target==t&&(s.x==c&&s.y==r||g>=-i.tap_pixel_range&&g<=i.tap_pixel_range&&d>=-i.tap_pixel_range&&d<=i.tap_pixel_range)){o.data("tapheld",!0);var f=Date.now(),v={x:i.touch_capable?h.touches[0].screenX:e.screenX,y:i.touch_capable?h.touches[0].screenY:e.screenY},w={x:i.touch_capable?h.touches[0].pageX-h.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?h.touches[0].pageY-h.touches[0].target.offsetTop:e.offsetY};duration=f-u;var _={startTime:u,endTime:f,startPosition:l,startOffset:p,endPosition:v,endOffset:w,duration:duration,target:e.target};o.data("callee1",arguments.callee),a(n,"taphold",e,_)}},i.taphold_threshold),!0}).on(i.endevent,function(){o.data("callee2",arguments.callee),o.data("tapheld",!1),window.clearTimeout(i.hold_timer)}).on(i.moveevent,function(e){o.data("callee3",arguments.callee),c=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,r=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2).off(i.moveevent,e(this).data.callee3)}},e.event.special.doubletap={setup:function(){var t,n,o,s,c,r=this,h=e(r),u=!1;h.on(i.startevent,function(e){return e.which&&1!==e.which?!1:(h.data("doubletapped",!1),t=e.target,h.data("callee1",arguments.callee),s=e.originalEvent,o={position:{x:i.touch_capable?s.touches[0].screenX:e.screenX,y:i.touch_capable?s.touches[0].screenY:e.screenY},offset:{x:i.touch_capable?s.touches[0].pageX-s.touches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?s.touches[0].pageY-s.touches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target},!0)}).on(i.endevent,function(e){var s=Date.now(),l=h.data("lastTouch")||s+1,p=s-l;if(window.clearTimeout(n),h.data("callee2",arguments.callee),p100){h.data("doubletapped",!0),window.clearTimeout(i.tap_timer);var g={position:{x:i.touch_capable?e.originalEvent.changedTouches[0].screenX:e.screenX,y:i.touch_capable?e.originalEvent.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?e.originalEvent.changedTouches[0].pageX-e.originalEvent.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?e.originalEvent.changedTouches[0].pageY-e.originalEvent.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target},d={firstTap:o,secondTap:g,interval:g.time-o.time};u||a(r,"doubletap",e,d),u=!0,c=window.setTimeout(function(){u=!1},i.doubletap_int)}else h.data("lastTouch",s),n=window.setTimeout(function(){window.clearTimeout(n)},i.doubletap_int,[e]);h.data("lastTouch",s)})},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,n=e(t),o=null,s=null,c={x:0,y:0};n.on(i.startevent,function(e){return e.which&&1!==e.which?!1:(s=Date.now(),o=e.target,n.data("callee1",arguments.callee),c.x=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageX:e.pageX,c.y=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0].pageY:e.pageY,!0)}).on(i.endevent,function(e){n.data("callee2",arguments.callee),e.target==o&&(end_pos_x=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.pageX,end_pos_y=e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageY:e.pageY,i.tap_timer=window.setTimeout(function(){if(!n.data("doubletapped")&&!n.data("tapheld")&&c.x==end_pos_x&&c.y==end_pos_y){var o=e.originalEvent,r={position:{x:i.touch_capable?o.changedTouches[0].screenX:e.screenX,y:i.touch_capable?o.changedTouches[0].screenY:e.screenY},offset:{x:i.touch_capable?o.changedTouches[0].pageX-o.changedTouches[0].target.offsetLeft:e.offsetX,y:i.touch_capable?o.changedTouches[0].pageY-o.changedTouches[0].target.offsetTop:e.offsetY},time:Date.now(),target:e.target};r.time-s=-i.tap_pixel_range&&g<=i.tap_pixel_range&&d>=-i.tap_pixel_range&&d<=i.tap_pixel_range)){for(var f=e.originalEvent,v=[],w=0;wl.y&&u.y-l.y>g&&(a="swipeup"),u.xp&&(a="swiperight"),u.yg&&(a="swipedown"),u.x>l.x&&u.x-l.x>p&&(a="swipeleft"),void 0!=a&&r){u.x=0,u.y=0,l.x=0,l.y=0,r=!1;var d=t.originalEvent;endEvnt={position:{x:i.touch_capable?d.touches[0].screenX:t.screenX,y:i.touch_capable?d.touches[0].screenY:t.screenY},offset:{x:i.touch_capable?d.touches[0].pageX-d.touches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?d.touches[0].pageY-d.touches[0].target.offsetTop:t.offsetY},time:Date.now(),target:t.target};var f=Math.abs(o.position.x-endEvnt.position.x),v=Math.abs(o.position.y-endEvnt.position.y),w={startEvnt:o,endEvnt:endEvnt,direction:a.replace("swipe",""),xAmount:f,yAmount:v,duration:endEvnt.time-o.time};h=!0,c.trigger("swipe",w).trigger(a,w)}}function n(t){c=e(t.currentTarget);var a="";if(c.data("callee3",arguments.callee),h){var n=c.data("xthreshold"),s=c.data("ythreshold"),u="undefined"!=typeof n&&n!==!1&&parseInt(n)?parseInt(n):i.swipe_h_threshold,l="undefined"!=typeof s&&s!==!1&&parseInt(s)?parseInt(s):i.swipe_v_threshold,p=t.originalEvent;endEvnt={position:{x:i.touch_capable?p.changedTouches[0].screenX:t.screenX,y:i.touch_capable?p.changedTouches[0].screenY:t.screenY},offset:{x:i.touch_capable?p.changedTouches[0].pageX-p.changedTouches[0].target.offsetLeft:t.offsetX,y:i.touch_capable?p.changedTouches[0].pageY-p.changedTouches[0].target.offsetTop:t.offsetY},time:Date.now(),target:t.target},o.position.y>endEvnt.position.y&&o.position.y-endEvnt.position.y>l&&(a="swipeup"),o.position.xu&&(a="swiperight"),o.position.yl&&(a="swipedown"),o.position.x>endEvnt.position.x&&o.position.x-endEvnt.position.x>u&&(a="swipeleft");var g=Math.abs(o.position.x-endEvnt.position.x),d=Math.abs(o.position.y-endEvnt.position.y),f={startEvnt:o,endEvnt:endEvnt,direction:a.replace("swipe",""),xAmount:g,yAmount:d,duration:endEvnt.time-o.time};c.trigger("swipeend",f)}r=!1,h=!1}var o,s=this,c=e(s),r=!1,h=!1,u={x:0,y:0},l={x:0,y:0};c.on(i.startevent,t),c.on(i.moveevent,a),c.on(i.endevent,n)},remove:function(){e(this).off(i.startevent,e(this).data.callee1).off(i.moveevent,e(this).data.callee2).off(i.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){function t(e,t){n=t,a(s,n?"scrollstart":"scrollend",e)}var n,o,s=this,c=e(s);c.on(i.scrollevent,function(e){c.data("callee",arguments.callee),n||t(e,!0),clearTimeout(o),o=setTimeout(function(){t(e,!1)},50)})},remove:function(){e(this).off(i.scrollevent,e(this).data.callee)}};var s,c,r,h,u,l=e(window),p={0:!0,180:!0};if(i.orientation_support){var g=window.innerWidth||l.width(),d=window.innerHeight||l.height(),f=50;h=g>d&&g-d>f,u=p[window.orientation],(h&&u||!h&&!u)&&(p={"-90":!0,90:!0})}e.event.special.orientationchange=s={setup:function(){return i.orientation_support?!1:(r=c(),l.on("throttledresize",t),!0)},teardown:function(){return i.orientation_support?!1:(l.off("throttledresize",t),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=c(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=c=function(){var e=!0,t=document.documentElement;return e=i.orientation_support?p[window.orientation]:t&&t.clientWidth/t.clientHeight<1.1,e?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",m)},teardown:function(){e(this).off("resize",m)}};var v,w,_,T=250,m=function(){w=Date.now(),_=w-x,_>=T?(x=w,e(this).trigger("throttledresize")):(v&&window.clearTimeout(v),v=window.setTimeout(t,T-_))},x=0;e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.6/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(a){function o(){var a=g();a!==h&&(h=a,e.trigger("orientationchange"))}function v(b,c,d,e){var f=d.type;d.type=c,a.event.dispatch.call(b,d,e),d.type=f}a.attrFn=a.attrFn||{};var b=navigator.userAgent.toLowerCase(),c=b.indexOf("chrome")>-1&&(b.indexOf("windows")>-1||b.indexOf("macintosh")>-1||b.indexOf("linux")>-1)&&b.indexOf("mobile")<0&&b.indexOf("android")<0,d={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in window&&!c,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in window&&!c?"touchstart":"mousedown",endevent:"ontouchstart"in window&&!c?"touchend":"mouseup",moveevent:"ontouchstart"in window&&!c?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!c?"tap":"click",scrollevent:"ontouchstart"in window&&!c?"touchmove":"scroll",hold_timer:null,tap_timer:null};a.isTouchCapable=function(){return d.touch_capable},a.getStartEvent=function(){return d.startevent},a.getEndEvent=function(){return d.endevent},a.getMoveEvent=function(){return d.moveevent},a.getTapEvent=function(){return d.tapevent},a.getScrollEvent=function(){return d.scrollevent},a.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(b,c){a.fn[c]=function(a){return a?this.on(c,a):this.trigger(c)},a.attrFn[c]=!0}),a.event.special.tapstart={setup:function(){var b=this,c=a(b);c.on(d.startevent,function a(e){if(c.data("callee",a),e.which&&1!==e.which)return!1;var f=e.originalEvent,g={position:{x:d.touch_capable?f.touches[0].screenX:e.screenX,y:d.touch_capable?f.touches[0].screenY:e.screenY},offset:{x:d.touch_capable?Math.round(f.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(e.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(f.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(e.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:e.target};return v(b,"tapstart",e,g),!0})},remove:function(){a(this).off(d.startevent,a(this).data.callee)}},a.event.special.tapmove={setup:function(){var b=this,c=a(b);c.on(d.moveevent,function a(e){c.data("callee",a);var f=e.originalEvent,g={position:{x:d.touch_capable?f.touches[0].screenX:e.screenX,y:d.touch_capable?f.touches[0].screenY:e.screenY},offset:{x:d.touch_capable?Math.round(f.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(e.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(f.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(e.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:e.target};return v(b,"tapmove",e,g),!0})},remove:function(){a(this).off(d.moveevent,a(this).data.callee)}},a.event.special.tapend={setup:function(){var b=this,c=a(b);c.on(d.endevent,function a(e){c.data("callee",a);var f=e.originalEvent,g={position:{x:d.touch_capable?f.changedTouches[0].screenX:e.screenX,y:d.touch_capable?f.changedTouches[0].screenY:e.screenY},offset:{x:d.touch_capable?Math.round(f.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(e.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(f.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(e.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:e.target};return v(b,"tapend",e,g),!0})},remove:function(){a(this).off(d.endevent,a(this).data.callee)}},a.event.special.taphold={setup:function(){var e,b=this,c=a(b),f={x:0,y:0},g=0,h=0;c.on(d.startevent,function a(i){if(i.which&&1!==i.which)return!1;c.data("tapheld",!1),e=i.target;var j=i.originalEvent,k=Date.now(),l={x:d.touch_capable?j.touches[0].screenX:i.screenX,y:d.touch_capable?j.touches[0].screenY:i.screenY},m={x:d.touch_capable?j.touches[0].pageX-j.touches[0].target.offsetLeft:i.offsetX,y:d.touch_capable?j.touches[0].pageY-j.touches[0].target.offsetTop:i.offsetY};return f.x=i.originalEvent.targetTouches?i.originalEvent.targetTouches[0].pageX:i.pageX,f.y=i.originalEvent.targetTouches?i.originalEvent.targetTouches[0].pageY:i.pageY,g=f.x,h=f.y,d.hold_timer=window.setTimeout(function(){var n=f.x-g,o=f.y-h;if(i.target==e&&(f.x==g&&f.y==h||n>=-d.tap_pixel_range&&n<=d.tap_pixel_range&&o>=-d.tap_pixel_range&&o<=d.tap_pixel_range)){c.data("tapheld",!0);var p=Date.now(),q={x:d.touch_capable?j.touches[0].screenX:i.screenX,y:d.touch_capable?j.touches[0].screenY:i.screenY},r={x:d.touch_capable?Math.round(j.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(i.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(j.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(i.pageY-(c.offset()?c.offset().top:0))},s=p-k,t={startTime:k,endTime:p,startPosition:l,startOffset:m,endPosition:q,endOffset:r,duration:s,target:i.target};c.data("callee1",a),v(b,"taphold",i,t)}},d.taphold_threshold),!0}).on(d.endevent,function a(){c.data("callee2",a),c.data("tapheld",!1),window.clearTimeout(d.hold_timer)}).on(d.moveevent,function a(b){c.data("callee3",a),g=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageX:b.pageX,h=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageY:b.pageY})},remove:function(){a(this).off(d.startevent,a(this).data.callee1).off(d.endevent,a(this).data.callee2).off(d.moveevent,a(this).data.callee3)}},a.event.special.doubletap={setup:function(){var e,f,h,i,b=this,c=a(b),g=null,j=!1;c.on(d.startevent,function a(b){return(!b.which||1===b.which)&&(c.data("doubletapped",!1),e=b.target,c.data("callee1",a),h=b.originalEvent,g||(g={position:{x:d.touch_capable?h.touches[0].screenX:b.screenX,y:d.touch_capable?h.touches[0].screenY:b.screenY},offset:{x:d.touch_capable?Math.round(h.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(b.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(h.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(b.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:b.target}),!0)}).on(d.endevent,function a(k){var l=Date.now(),m=c.data("lastTouch")||l+1,n=l-m;if(window.clearTimeout(f),c.data("callee2",a),n100){c.data("doubletapped",!0),window.clearTimeout(d.tap_timer);var o={position:{x:d.touch_capable?k.originalEvent.changedTouches[0].screenX:k.screenX,y:d.touch_capable?k.originalEvent.changedTouches[0].screenY:k.screenY},offset:{x:d.touch_capable?Math.round(h.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(k.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(h.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(k.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:k.target},p={firstTap:g,secondTap:o,interval:o.time-g.time};j||(v(b,"doubletap",k,p),g=null),j=!0,i=window.setTimeout(function(){j=!1},d.doubletap_int)}else c.data("lastTouch",l),f=window.setTimeout(function(){g=null,window.clearTimeout(f)},d.doubletap_int,[k]);c.data("lastTouch",l)})},remove:function(){a(this).off(d.startevent,a(this).data.callee1).off(d.endevent,a(this).data.callee2)}},a.event.special.singletap={setup:function(){var b=this,c=a(b),e=null,f=null,g={x:0,y:0};c.on(d.startevent,function a(b){return(!b.which||1===b.which)&&(f=Date.now(),e=b.target,c.data("callee1",a),g.x=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageX:b.pageX,g.y=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageY:b.pageY,!0)}).on(d.endevent,function a(h){if(c.data("callee2",a),h.target==e){var i=h.originalEvent.changedTouches?h.originalEvent.changedTouches[0].pageX:h.pageX,j=h.originalEvent.changedTouches?h.originalEvent.changedTouches[0].pageY:h.pageY;d.tap_timer=window.setTimeout(function(){var a=g.x-i,e=g.y-j;if(!c.data("doubletapped")&&!c.data("tapheld")&&(g.x==i&&g.y==j||a>=-d.tap_pixel_range&&a<=d.tap_pixel_range&&e>=-d.tap_pixel_range&&e<=d.tap_pixel_range)){var k=h.originalEvent,l={position:{x:d.touch_capable?k.changedTouches[0].screenX:h.screenX,y:d.touch_capable?k.changedTouches[0].screenY:h.screenY},offset:{x:d.touch_capable?Math.round(k.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(h.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(k.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(h.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:h.target};l.time-f=-d.tap_pixel_range&&m<=d.tap_pixel_range&&n>=-d.tap_pixel_range&&n<=d.tap_pixel_range)){for(var p=j.originalEvent,q=[],r=0;rh.y&&g.y-h.y>o&&(j="swipeup"),g.xn&&(j="swiperight"),g.yo&&(j="swipedown"),g.x>h.x&&g.x-h.x>n&&(j="swipeleft"),void 0!=j&&e){g.x=0,g.y=0,h.x=0,h.y=0,e=!1;var p=b.originalEvent,q={position:{x:d.touch_capable?p.touches[0].screenX:b.screenX,y:d.touch_capable?p.touches[0].screenY:b.screenY},offset:{x:d.touch_capable?Math.round(p.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(b.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(p.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(b.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:b.target},r=Math.abs(i.position.x-q.position.x),s=Math.abs(i.position.y-q.position.y),t={startEvnt:i,endEvnt:q,direction:j.replace("swipe",""),xAmount:r,yAmount:s,duration:q.time-i.time};f=!0,c.trigger("swipe",t).trigger(j,t)}}function l(b){c=a(b.currentTarget);var g="";if(c.data("callee3",l),f){var h=c.data("xthreshold"),j=c.data("ythreshold"),k="undefined"!=typeof h&&h!==!1&&parseInt(h)?parseInt(h):d.swipe_h_threshold,m="undefined"!=typeof j&&j!==!1&&parseInt(j)?parseInt(j):d.swipe_v_threshold,n=b.originalEvent,o={position:{x:d.touch_capable?n.changedTouches[0].screenX:b.screenX,y:d.touch_capable?n.changedTouches[0].screenY:b.screenY},offset:{x:d.touch_capable?Math.round(n.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(b.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(n.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(b.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:b.target};i.position.y>o.position.y&&i.position.y-o.position.y>m&&(g="swipeup"),i.position.xk&&(g="swiperight"),i.position.ym&&(g="swipedown"),i.position.x>o.position.x&&i.position.x-o.position.x>k&&(g="swipeleft");var p=Math.abs(i.position.x-o.position.x),q=Math.abs(i.position.y-o.position.y),r={startEvnt:i,endEvnt:o,direction:g.replace("swipe",""),xAmount:p,yAmount:q,duration:o.time-i.time};c.trigger("swipeend",r)}e=!1,f=!1}var i,b=this,c=a(b),e=!1,f=!1,g={x:0,y:0},h={x:0,y:0};c.on(d.startevent,j),c.on(d.moveevent,k),c.on(d.endevent,l)},remove:function(){a(this).off(d.startevent,a(this).data.callee1).off(d.moveevent,a(this).data.callee2).off(d.endevent,a(this).data.callee3)}},a.event.special.scrollstart={setup:function(){function g(a,c){e=c,v(b,e?"scrollstart":"scrollend",a)}var e,f,b=this,c=a(b);c.on(d.scrollevent,function a(b){c.data("callee",a),e||g(b,!0),clearTimeout(f),f=setTimeout(function(){g(b,!1)},50)})},remove:function(){a(this).off(d.scrollevent,a(this).data.callee)}};var f,g,h,i,j,e=a(window),k={0:!0,180:!0};if(d.orientation_support){var l=window.innerWidth||e.width(),m=window.innerHeight||e.height(),n=50;i=l>m&&l-m>n,j=k[window.orientation],(i&&j||!i&&!j)&&(k={"-90":!0,90:!0})}a.event.special.orientationchange=f={setup:function(){return!d.orientation_support&&(h=g(),e.on("throttledresize",o),!0)},teardown:function(){return!d.orientation_support&&(e.off("throttledresize",o),!0)},add:function(a){var b=a.handler;a.handler=function(a){return a.orientation=g(),b.apply(this,arguments)}}},a.event.special.orientationchange.orientation=g=function(){var a=!0,b=document.documentElement;return a=d.orientation_support?k[window.orientation]:b&&b.clientWidth/b.clientHeight<1.1,a?"portrait":"landscape"},a.event.special.throttledresize={setup:function(){a(this).on("resize",q)},teardown:function(){a(this).off("resize",q)}};var s,t,u,p=250,q=function(){t=Date.now(),u=t-r,u>=p?(r=t,a(this).trigger("throttledresize")):(s&&window.clearTimeout(s),s=window.setTimeout(o,p-u))},r=0;a.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(b,c){a.event.special[b]={setup:function(){a(this).on(c,a.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.7/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(a){function o(){var a=g();a!==h&&(h=a,e.trigger("orientationchange"))}function v(b,c,d,e){var f=d.type;d.type=c,a.event.dispatch.call(b,d,e),d.type=f}a.attrFn=a.attrFn||{};var b=navigator.userAgent.toLowerCase(),c=b.indexOf("chrome")>-1&&(b.indexOf("windows")>-1||b.indexOf("macintosh")>-1||b.indexOf("linux")>-1)&&b.indexOf("mobile")<0&&b.indexOf("android")<0,d={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:"ontouchstart"in window&&!c,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:"ontouchstart"in window&&!c?"touchstart":"mousedown",endevent:"ontouchstart"in window&&!c?"touchend":"mouseup",moveevent:"ontouchstart"in window&&!c?"touchmove":"mousemove",tapevent:"ontouchstart"in window&&!c?"tap":"click",scrollevent:"ontouchstart"in window&&!c?"touchmove":"scroll",hold_timer:null,tap_timer:null};a.isTouchCapable=function(){return d.touch_capable},a.getStartEvent=function(){return d.startevent},a.getEndEvent=function(){return d.endevent},a.getMoveEvent=function(){return d.moveevent},a.getTapEvent=function(){return d.tapevent},a.getScrollEvent=function(){return d.scrollevent},a.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(b,c){a.fn[c]=function(a){return a?this.on(c,a):this.trigger(c)},a.attrFn[c]=!0}),a.event.special.tapstart={setup:function(){var b=this,c=a(b);c.on(d.startevent,function a(e){if(c.data("callee",a),e.which&&1!==e.which)return!1;var f=e.originalEvent,g={position:{x:d.touch_capable?f.touches[0].screenX:e.screenX,y:d.touch_capable?f.touches[0].screenY:e.screenY},offset:{x:d.touch_capable?Math.round(f.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(e.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(f.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(e.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:e.target};return v(b,"tapstart",e,g),!0})},remove:function(){a(this).off(d.startevent,a(this).data.callee)}},a.event.special.tapmove={setup:function(){var b=this,c=a(b);c.on(d.moveevent,function a(e){c.data("callee",a);var f=e.originalEvent,g={position:{x:d.touch_capable?f.touches[0].screenX:e.screenX,y:d.touch_capable?f.touches[0].screenY:e.screenY},offset:{x:d.touch_capable?Math.round(f.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(e.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(f.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(e.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:e.target};return v(b,"tapmove",e,g),!0})},remove:function(){a(this).off(d.moveevent,a(this).data.callee)}},a.event.special.tapend={setup:function(){var b=this,c=a(b);c.on(d.endevent,function a(e){c.data("callee",a);var f=e.originalEvent,g={position:{x:d.touch_capable?f.changedTouches[0].screenX:e.screenX,y:d.touch_capable?f.changedTouches[0].screenY:e.screenY},offset:{x:d.touch_capable?Math.round(f.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(e.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(f.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(e.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:e.target};return v(b,"tapend",e,g),!0})},remove:function(){a(this).off(d.endevent,a(this).data.callee)}},a.event.special.taphold={setup:function(){var e,b=this,c=a(b),f={x:0,y:0},g=0,h=0;c.on(d.startevent,function a(i){if(i.which&&1!==i.which)return!1;c.data("tapheld",!1),e=i.target;var j=i.originalEvent,k=Date.now(),l={x:d.touch_capable?j.touches[0].screenX:i.screenX,y:d.touch_capable?j.touches[0].screenY:i.screenY},m={x:d.touch_capable?j.touches[0].pageX-j.touches[0].target.offsetLeft:i.offsetX,y:d.touch_capable?j.touches[0].pageY-j.touches[0].target.offsetTop:i.offsetY};f.x=i.originalEvent.targetTouches?i.originalEvent.targetTouches[0].pageX:i.pageX,f.y=i.originalEvent.targetTouches?i.originalEvent.targetTouches[0].pageY:i.pageY,g=f.x,h=f.y;var n=c.parent().data("threshold")?c.parent().data("threshold"):c.data("threshold"),o="undefined"!=typeof n&&n!==!1&&parseInt(n)?parseInt(n):d.taphold_threshold;return d.hold_timer=window.setTimeout(function(){var n=f.x-g,o=f.y-h;if(i.target==e&&(f.x==g&&f.y==h||n>=-d.tap_pixel_range&&n<=d.tap_pixel_range&&o>=-d.tap_pixel_range&&o<=d.tap_pixel_range)){c.data("tapheld",!0);var p=Date.now(),q={x:d.touch_capable?j.touches[0].screenX:i.screenX,y:d.touch_capable?j.touches[0].screenY:i.screenY},r={x:d.touch_capable?Math.round(j.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(i.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(j.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(i.pageY-(c.offset()?c.offset().top:0))},s=p-k,t={startTime:k,endTime:p,startPosition:l,startOffset:m,endPosition:q,endOffset:r,duration:s,target:i.target};c.data("callee1",a),v(b,"taphold",i,t)}},o),!0}).on(d.endevent,function a(){c.data("callee2",a),c.data("tapheld",!1),window.clearTimeout(d.hold_timer)}).on(d.moveevent,function a(b){c.data("callee3",a),g=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageX:b.pageX,h=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageY:b.pageY})},remove:function(){a(this).off(d.startevent,a(this).data.callee1).off(d.endevent,a(this).data.callee2).off(d.moveevent,a(this).data.callee3)}},a.event.special.doubletap={setup:function(){var e,f,h,i,b=this,c=a(b),g=null,j=!1;c.on(d.startevent,function a(b){return(!b.which||1===b.which)&&(c.data("doubletapped",!1),e=b.target,c.data("callee1",a),h=b.originalEvent,g||(g={position:{x:d.touch_capable?h.touches[0].screenX:b.screenX,y:d.touch_capable?h.touches[0].screenY:b.screenY},offset:{x:d.touch_capable?Math.round(h.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(b.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(h.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(b.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:b.target}),!0)}).on(d.endevent,function a(k){var l=Date.now(),m=c.data("lastTouch")||l+1,n=l-m;if(window.clearTimeout(f),c.data("callee2",a),n100){c.data("doubletapped",!0),window.clearTimeout(d.tap_timer);var o={position:{x:d.touch_capable?k.originalEvent.changedTouches[0].screenX:k.screenX,y:d.touch_capable?k.originalEvent.changedTouches[0].screenY:k.screenY},offset:{x:d.touch_capable?Math.round(h.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(k.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(h.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(k.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:k.target},p={firstTap:g,secondTap:o,interval:o.time-g.time};j||(v(b,"doubletap",k,p),g=null),j=!0,i=window.setTimeout(function(){j=!1},d.doubletap_int)}else c.data("lastTouch",l),f=window.setTimeout(function(){g=null,window.clearTimeout(f)},d.doubletap_int,[k]);c.data("lastTouch",l)})},remove:function(){a(this).off(d.startevent,a(this).data.callee1).off(d.endevent,a(this).data.callee2)}},a.event.special.singletap={setup:function(){var b=this,c=a(b),e=null,f=null,g={x:0,y:0};c.on(d.startevent,function a(b){return(!b.which||1===b.which)&&(f=Date.now(),e=b.target,c.data("callee1",a),g.x=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageX:b.pageX,g.y=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageY:b.pageY,!0)}).on(d.endevent,function a(h){if(c.data("callee2",a),h.target==e){var i=h.originalEvent.changedTouches?h.originalEvent.changedTouches[0].pageX:h.pageX,j=h.originalEvent.changedTouches?h.originalEvent.changedTouches[0].pageY:h.pageY;d.tap_timer=window.setTimeout(function(){var a=g.x-i,e=g.y-j;if(!c.data("doubletapped")&&!c.data("tapheld")&&(g.x==i&&g.y==j||a>=-d.tap_pixel_range&&a<=d.tap_pixel_range&&e>=-d.tap_pixel_range&&e<=d.tap_pixel_range)){var k=h.originalEvent,l={position:{x:d.touch_capable?k.changedTouches[0].screenX:h.screenX,y:d.touch_capable?k.changedTouches[0].screenY:h.screenY},offset:{x:d.touch_capable?Math.round(k.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(h.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(k.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(h.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:h.target};l.time-f=-d.tap_pixel_range&&m<=d.tap_pixel_range&&n>=-d.tap_pixel_range&&n<=d.tap_pixel_range)){for(var p=j.originalEvent,q=[],r=0;rh.y&&g.y-h.y>o&&(j="swipeup"),g.xn&&(j="swiperight"),g.yo&&(j="swipedown"),g.x>h.x&&g.x-h.x>n&&(j="swipeleft"),void 0!=j&&e){g.x=0,g.y=0,h.x=0,h.y=0,e=!1;var p=b.originalEvent,q={position:{x:d.touch_capable?p.touches[0].screenX:b.screenX,y:d.touch_capable?p.touches[0].screenY:b.screenY},offset:{x:d.touch_capable?Math.round(p.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(b.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(p.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(b.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:b.target},r=Math.abs(i.position.x-q.position.x),s=Math.abs(i.position.y-q.position.y),t={startEvnt:i,endEvnt:q,direction:j.replace("swipe",""),xAmount:r,yAmount:s,duration:q.time-i.time};f=!0,c.trigger("swipe",t).trigger(j,t)}}function l(b){c=a(b.currentTarget);var g="";if(c.data("callee3",l),f){var h=c.data("xthreshold"),j=c.data("ythreshold"),k="undefined"!=typeof h&&h!==!1&&parseInt(h)?parseInt(h):d.swipe_h_threshold,m="undefined"!=typeof j&&j!==!1&&parseInt(j)?parseInt(j):d.swipe_v_threshold,n=b.originalEvent,o={position:{x:d.touch_capable?n.changedTouches[0].screenX:b.screenX,y:d.touch_capable?n.changedTouches[0].screenY:b.screenY},offset:{x:d.touch_capable?Math.round(n.changedTouches[0].pageX-(c.offset()?c.offset().left:0)):Math.round(b.pageX-(c.offset()?c.offset().left:0)),y:d.touch_capable?Math.round(n.changedTouches[0].pageY-(c.offset()?c.offset().top:0)):Math.round(b.pageY-(c.offset()?c.offset().top:0))},time:Date.now(),target:b.target};i.position.y>o.position.y&&i.position.y-o.position.y>m&&(g="swipeup"),i.position.xk&&(g="swiperight"),i.position.ym&&(g="swipedown"),i.position.x>o.position.x&&i.position.x-o.position.x>k&&(g="swipeleft");var p=Math.abs(i.position.x-o.position.x),q=Math.abs(i.position.y-o.position.y),r={startEvnt:i,endEvnt:o,direction:g.replace("swipe",""),xAmount:p,yAmount:q,duration:o.time-i.time};c.trigger("swipeend",r)}e=!1,f=!1}var i,b=this,c=a(b),e=!1,f=!1,g={x:0,y:0},h={x:0,y:0};c.on(d.startevent,j),c.on(d.moveevent,k),c.on(d.endevent,l)},remove:function(){a(this).off(d.startevent,a(this).data.callee1).off(d.moveevent,a(this).data.callee2).off(d.endevent,a(this).data.callee3)}},a.event.special.scrollstart={setup:function(){function g(a,c){e=c,v(b,e?"scrollstart":"scrollend",a)}var e,f,b=this,c=a(b);c.on(d.scrollevent,function a(b){c.data("callee",a),e||g(b,!0),clearTimeout(f),f=setTimeout(function(){g(b,!1)},50)})},remove:function(){a(this).off(d.scrollevent,a(this).data.callee)}};var f,g,h,i,j,e=a(window),k={0:!0,180:!0};if(d.orientation_support){var l=window.innerWidth||e.width(),m=window.innerHeight||e.height(),n=50;i=l>m&&l-m>n,j=k[window.orientation],(i&&j||!i&&!j)&&(k={"-90":!0,90:!0})}a.event.special.orientationchange=f={setup:function(){return!d.orientation_support&&(h=g(),e.on("throttledresize",o),!0)},teardown:function(){return!d.orientation_support&&(e.off("throttledresize",o),!0)},add:function(a){var b=a.handler;a.handler=function(a){return a.orientation=g(),b.apply(this,arguments)}}},a.event.special.orientationchange.orientation=g=function(){var a=!0,b=document.documentElement;return a=d.orientation_support?k[window.orientation]:b&&b.clientWidth/b.clientHeight<1.1,a?"portrait":"landscape"},a.event.special.throttledresize={setup:function(){a(this).on("resize",q)},teardown:function(){a(this).off("resize",q)}};var s,t,u,p=250,q=function(){t=Date.now(),u=t-r,u>=p?(r=t,a(this).trigger("throttledresize")):(s&&window.clearTimeout(s),s=window.setTimeout(o,p-u))},r=0;a.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(b,c){a.event.special[b]={setup:function(){a(this).on(c,a.noop)}}})}(jQuery); 2 | -------------------------------------------------------------------------------- /src/1.0.8/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2017, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | "use strict";!function(a){function n(){var a=f();a!==g&&(g=a,d.trigger("orientationchange"))}function u(b,c,d,e){var f=d.type;d.type=c,a.event.dispatch.call(b,d,e),d.type=f}a.attrFn=a.attrFn||{};var b="ontouchstart"in window,c={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:b,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:b?"touchstart":"mousedown",endevent:b?"touchend":"mouseup",moveevent:b?"touchmove":"mousemove",tapevent:b?"tap":"click",scrollevent:b?"touchmove":"scroll",hold_timer:null,tap_timer:null};a.isTouchCapable=function(){return c.touch_capable},a.getStartEvent=function(){return c.startevent},a.getEndEvent=function(){return c.endevent},a.getMoveEvent=function(){return c.moveevent},a.getTapEvent=function(){return c.tapevent},a.getScrollEvent=function(){return c.scrollevent},a.each(["tapstart","tapend","tapmove","tap","tap2","tap3","tap4","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange"],function(b,c){a.fn[c]=function(a){return a?this.on(c,a):this.trigger(c)},a.attrFn[c]=!0}),a.event.special.tapstart={setup:function(){var b=this,d=a(b);d.on(c.startevent,function a(e){if(d.data("callee",a),e.which&&1!==e.which)return!1;var f=e.originalEvent,g={position:{x:c.touch_capable?f.touches[0].screenX:e.screenX,y:c.touch_capable?f.touches[0].screenY:e.screenY},offset:{x:c.touch_capable?Math.round(f.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(e.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(f.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(e.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:e.target};return u(b,"tapstart",e,g),!0})},remove:function(){a(this).off(c.startevent,a(this).data.callee)}},a.event.special.tapmove={setup:function(){var b=this,d=a(b);d.on(c.moveevent,function a(e){d.data("callee",a);var f=e.originalEvent,g={position:{x:c.touch_capable?f.touches[0].screenX:e.screenX,y:c.touch_capable?f.touches[0].screenY:e.screenY},offset:{x:c.touch_capable?Math.round(f.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(e.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(f.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(e.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:e.target};return u(b,"tapmove",e,g),!0})},remove:function(){a(this).off(c.moveevent,a(this).data.callee)}},a.event.special.tapend={setup:function(){var b=this,d=a(b);d.on(c.endevent,function a(e){d.data("callee",a);var f=e.originalEvent,g={position:{x:c.touch_capable?f.changedTouches[0].screenX:e.screenX,y:c.touch_capable?f.changedTouches[0].screenY:e.screenY},offset:{x:c.touch_capable?Math.round(f.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(e.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(f.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(e.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:e.target};return u(b,"tapend",e,g),!0})},remove:function(){a(this).off(c.endevent,a(this).data.callee)}},a.event.special.taphold={setup:function(){var e,b=this,d=a(b),f={x:0,y:0},g=0,h=0;d.on(c.startevent,function a(i){if(i.which&&1!==i.which)return!1;d.data("tapheld",!1),e=i.target;var j=i.originalEvent,k=Date.now(),l={x:c.touch_capable?j.touches[0].screenX:i.screenX,y:c.touch_capable?j.touches[0].screenY:i.screenY},m={x:c.touch_capable?j.touches[0].pageX-j.touches[0].target.offsetLeft:i.offsetX,y:c.touch_capable?j.touches[0].pageY-j.touches[0].target.offsetTop:i.offsetY};f.x=i.originalEvent.targetTouches?i.originalEvent.targetTouches[0].pageX:i.pageX,f.y=i.originalEvent.targetTouches?i.originalEvent.targetTouches[0].pageY:i.pageY,g=f.x,h=f.y;var n=d.parent().data("threshold")?d.parent().data("threshold"):d.data("threshold"),o="undefined"!=typeof n&&n!==!1&&parseInt(n)?parseInt(n):c.taphold_threshold;return c.hold_timer=window.setTimeout(function(){var n=f.x-g,o=f.y-h;if(i.target==e&&(f.x==g&&f.y==h||n>=-c.tap_pixel_range&&n<=c.tap_pixel_range&&o>=-c.tap_pixel_range&&o<=c.tap_pixel_range)){d.data("tapheld",!0);var p=Date.now(),q={x:c.touch_capable?j.touches[0].screenX:i.screenX,y:c.touch_capable?j.touches[0].screenY:i.screenY},r={x:c.touch_capable?Math.round(j.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(i.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(j.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(i.pageY-(d.offset()?d.offset().top:0))},s=p-k,t={startTime:k,endTime:p,startPosition:l,startOffset:m,endPosition:q,endOffset:r,duration:s,target:i.target};d.data("callee1",a),u(b,"taphold",i,t)}},o),!0}).on(c.endevent,function a(){d.data("callee2",a),d.data("tapheld",!1),window.clearTimeout(c.hold_timer)}).on(c.moveevent,function a(b){d.data("callee3",a),g=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageX:b.pageX,h=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageY:b.pageY})},remove:function(){a(this).off(c.startevent,a(this).data.callee1).off(c.endevent,a(this).data.callee2).off(c.moveevent,a(this).data.callee3)}},a.event.special.doubletap={setup:function(){var e,f,h,i,b=this,d=a(b),g=null,j=!1;d.on(c.startevent,function a(b){return(!b.which||1===b.which)&&(d.data("doubletapped",!1),e=b.target,d.data("callee1",a),h=b.originalEvent,g||(g={position:{x:c.touch_capable?h.touches[0].screenX:b.screenX,y:c.touch_capable?h.touches[0].screenY:b.screenY},offset:{x:c.touch_capable?Math.round(h.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(b.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(h.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(b.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:b.target}),!0)}).on(c.endevent,function a(k){var l=Date.now(),m=d.data("lastTouch")||l+1,n=l-m;if(window.clearTimeout(f),d.data("callee2",a),n100){d.data("doubletapped",!0),window.clearTimeout(c.tap_timer);var o={position:{x:c.touch_capable?k.originalEvent.changedTouches[0].screenX:k.screenX,y:c.touch_capable?k.originalEvent.changedTouches[0].screenY:k.screenY},offset:{x:c.touch_capable?Math.round(h.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(k.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(h.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(k.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:k.target},p={firstTap:g,secondTap:o,interval:o.time-g.time};j||(u(b,"doubletap",k,p),g=null),j=!0,i=window.setTimeout(function(){j=!1},c.doubletap_int)}else d.data("lastTouch",l),f=window.setTimeout(function(){g=null,window.clearTimeout(f)},c.doubletap_int,[k]);d.data("lastTouch",l)})},remove:function(){a(this).off(c.startevent,a(this).data.callee1).off(c.endevent,a(this).data.callee2)}},a.event.special.singletap={setup:function(){var b=this,d=a(b),e=null,f=null,g={x:0,y:0};d.on(c.startevent,function a(b){return(!b.which||1===b.which)&&(f=Date.now(),e=b.target,d.data("callee1",a),g.x=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageX:b.pageX,g.y=b.originalEvent.targetTouches?b.originalEvent.targetTouches[0].pageY:b.pageY,!0)}).on(c.endevent,function a(h){if(d.data("callee2",a),h.target==e){var i=h.originalEvent.changedTouches?h.originalEvent.changedTouches[0].pageX:h.pageX,j=h.originalEvent.changedTouches?h.originalEvent.changedTouches[0].pageY:h.pageY;c.tap_timer=window.setTimeout(function(){var a=g.x-i,e=g.y-j;if(!d.data("doubletapped")&&!d.data("tapheld")&&(g.x==i&&g.y==j||a>=-c.tap_pixel_range&&a<=c.tap_pixel_range&&e>=-c.tap_pixel_range&&e<=c.tap_pixel_range)){var k=h.originalEvent,l={position:{x:c.touch_capable?k.changedTouches[0].screenX:h.screenX,y:c.touch_capable?k.changedTouches[0].screenY:h.screenY},offset:{x:c.touch_capable?Math.round(k.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(h.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(k.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(h.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:h.target};l.time-f=-c.tap_pixel_range&&m<=c.tap_pixel_range&&n>=-c.tap_pixel_range&&n<=c.tap_pixel_range)){for(var p=j.originalEvent,q=[],r=0;rh.y&&g.y-h.y>o&&(j="swipeup"),g.xn&&(j="swiperight"),g.yo&&(j="swipedown"),g.x>h.x&&g.x-h.x>n&&(j="swipeleft"),void 0!=j&&e){g.x=0,g.y=0,h.x=0,h.y=0,e=!1;var p=b.originalEvent,q={position:{x:c.touch_capable?p.touches[0].screenX:b.screenX,y:c.touch_capable?p.touches[0].screenY:b.screenY},offset:{x:c.touch_capable?Math.round(p.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(b.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(p.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(b.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:b.target},r=Math.abs(i.position.x-q.position.x),s=Math.abs(i.position.y-q.position.y),t={startEvnt:i,endEvnt:q,direction:j.replace("swipe",""),xAmount:r,yAmount:s,duration:q.time-i.time};f=!0,d.trigger("swipe",t).trigger(j,t)}}function l(b){d=a(b.currentTarget);var g="";if(d.data("callee3",l),f){var h=d.data("xthreshold"),j=d.data("ythreshold"),k="undefined"!=typeof h&&h!==!1&&parseInt(h)?parseInt(h):c.swipe_h_threshold,m="undefined"!=typeof j&&j!==!1&&parseInt(j)?parseInt(j):c.swipe_v_threshold,n=b.originalEvent,o={position:{x:c.touch_capable?n.changedTouches[0].screenX:b.screenX,y:c.touch_capable?n.changedTouches[0].screenY:b.screenY},offset:{x:c.touch_capable?Math.round(n.changedTouches[0].pageX-(d.offset()?d.offset().left:0)):Math.round(b.pageX-(d.offset()?d.offset().left:0)),y:c.touch_capable?Math.round(n.changedTouches[0].pageY-(d.offset()?d.offset().top:0)):Math.round(b.pageY-(d.offset()?d.offset().top:0))},time:Date.now(),target:b.target};i.position.y>o.position.y&&i.position.y-o.position.y>m&&(g="swipeup"),i.position.xk&&(g="swiperight"),i.position.ym&&(g="swipedown"),i.position.x>o.position.x&&i.position.x-o.position.x>k&&(g="swipeleft");var p=Math.abs(i.position.x-o.position.x),q=Math.abs(i.position.y-o.position.y),r={startEvnt:i,endEvnt:o,direction:g.replace("swipe",""),xAmount:p,yAmount:q,duration:o.time-i.time};d.trigger("swipeend",r)}e=!1,f=!1}var i,b=this,d=a(b),e=!1,f=!1,g={x:0,y:0},h={x:0,y:0};d.on(c.startevent,j),d.on(c.moveevent,k),d.on(c.endevent,l)},remove:function(){a(this).off(c.startevent,a(this).data.callee1).off(c.moveevent,a(this).data.callee2).off(c.endevent,a(this).data.callee3)}},a.event.special.scrollstart={setup:function(){function g(a,c){e=c,u(b,e?"scrollstart":"scrollend",a)}var e,f,b=this,d=a(b);d.on(c.scrollevent,function a(b){d.data("callee",a),e||g(b,!0),clearTimeout(f),f=setTimeout(function(){g(b,!1)},50)})},remove:function(){a(this).off(c.scrollevent,a(this).data.callee)}};var e,f,g,h,i,d=a(window),j={0:!0,180:!0};if(c.orientation_support){var k=window.innerWidth||d.width(),l=window.innerHeight||d.height(),m=50;h=k>l&&k-l>m,i=j[window.orientation],(h&&i||!h&&!i)&&(j={"-90":!0,90:!0})}a.event.special.orientationchange=e={setup:function(){return!c.orientation_support&&(g=f(),d.on("throttledresize",n),!0)},teardown:function(){return!c.orientation_support&&(d.off("throttledresize",n),!0)},add:function(a){var b=a.handler;a.handler=function(a){return a.orientation=f(),b.apply(this,arguments)}}},a.event.special.orientationchange.orientation=f=function(){var a=!0,b=document.documentElement;return a=c.orientation_support?j[window.orientation]:b&&b.clientWidth/b.clientHeight<1.1,a?"portrait":"landscape"},a.event.special.throttledresize={setup:function(){a(this).on("resize",p)},teardown:function(){a(this).off("resize",p)}};var r,s,t,o=250,p=function(){s=Date.now(),t=s-q,t>=o?(q=s,a(this).trigger("throttledresize")):(r&&window.clearTimeout(r),r=window.setTimeout(n,o-t))},q=0;a.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap"},function(b,c){a.event.special[b]={setup:function(){a(this).on(c,a.noop)}}})}(jQuery); 28 | -------------------------------------------------------------------------------- /src/1.0.9/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2017, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | 28 | 'use strict';(function(a){function b(){var x=j();x!==k&&(k=x,g.trigger('orientationchange'))}function c(x,y,z,A){var B=z.type;z.type=y,a.event.dispatch.call(x,z,A),z.type=B}a.attrFn=a.attrFn||{};var d='ontouchstart'in window,f={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,touch_capable:d,orientation_support:'orientation'in window&&'onorientationchange'in window,startevent:d?'touchstart':'mousedown',endevent:d?'touchend':'mouseup',moveevent:d?'touchmove':'mousemove',tapevent:d?'tap':'click',scrollevent:d?'touchmove':'scroll',hold_timer:null,tap_timer:null};a.isTouchCapable=function(){return f.touch_capable},a.getStartEvent=function(){return f.startevent},a.getEndEvent=function(){return f.endevent},a.getMoveEvent=function(){return f.moveevent},a.getTapEvent=function(){return f.tapevent},a.getScrollEvent=function(){return f.scrollevent},a.each(['tapstart','tapend','tapmove','tap','tap2','tap3','tap4','singletap','doubletap','taphold','swipe','swipeup','swiperight','swipedown','swipeleft','swipeend','scrollstart','scrollend','orientationchange'],function(x,y){a.fn[y]=function(z){return z?this.on(y,z):this.trigger(y)},a.attrFn[y]=!0}),a.event.special.tapstart={setup:function(){var x=this,y=a(x);y.on(f.startevent,function z(A){if(y.data('callee',z),A.which&&1!==A.which)return!1;var B=A.originalEvent,C={position:{x:f.touch_capable?B.touches[0].screenX:A.screenX,y:f.touch_capable?B.touches[0].screenY:A.screenY},offset:{x:f.touch_capable?Math.round(B.changedTouches[0].pageX-(y.offset()?y.offset().left:0)):Math.round(A.pageX-(y.offset()?y.offset().left:0)),y:f.touch_capable?Math.round(B.changedTouches[0].pageY-(y.offset()?y.offset().top:0)):Math.round(A.pageY-(y.offset()?y.offset().top:0))},time:Date.now(),target:A.target};return c(x,'tapstart',A,C),!0})},remove:function(){a(this).off(f.startevent,a(this).data.callee)}},a.event.special.tapmove={setup:function(){var x=this,y=a(x);y.on(f.moveevent,function z(A){y.data('callee',z);var B=A.originalEvent,C={position:{x:f.touch_capable?B.touches[0].screenX:A.screenX,y:f.touch_capable?B.touches[0].screenY:A.screenY},offset:{x:f.touch_capable?Math.round(B.changedTouches[0].pageX-(y.offset()?y.offset().left:0)):Math.round(A.pageX-(y.offset()?y.offset().left:0)),y:f.touch_capable?Math.round(B.changedTouches[0].pageY-(y.offset()?y.offset().top:0)):Math.round(A.pageY-(y.offset()?y.offset().top:0))},time:Date.now(),target:A.target};return c(x,'tapmove',A,C),!0})},remove:function(){a(this).off(f.moveevent,a(this).data.callee)}},a.event.special.tapend={setup:function(){var x=this,y=a(x);y.on(f.endevent,function z(A){y.data('callee',z);var B=A.originalEvent,C={position:{x:f.touch_capable?B.changedTouches[0].screenX:A.screenX,y:f.touch_capable?B.changedTouches[0].screenY:A.screenY},offset:{x:f.touch_capable?Math.round(B.changedTouches[0].pageX-(y.offset()?y.offset().left:0)):Math.round(A.pageX-(y.offset()?y.offset().left:0)),y:f.touch_capable?Math.round(B.changedTouches[0].pageY-(y.offset()?y.offset().top:0)):Math.round(A.pageY-(y.offset()?y.offset().top:0))},time:Date.now(),target:A.target};return c(x,'tapend',A,C),!0})},remove:function(){a(this).off(f.endevent,a(this).data.callee)}},a.event.special.taphold={setup:function(){var z,x=this,y=a(x),A={x:0,y:0},B=0,C=0;y.on(f.startevent,function D(E){if(E.which&&1!==E.which)return!1;y.data('tapheld',!1),z=E.target;var F=E.originalEvent,G=Date.now(),H={x:f.touch_capable?F.touches[0].screenX:E.screenX,y:f.touch_capable?F.touches[0].screenY:E.screenY},I={x:f.touch_capable?F.touches[0].pageX-F.touches[0].target.offsetLeft:E.offsetX,y:f.touch_capable?F.touches[0].pageY-F.touches[0].target.offsetTop:E.offsetY};A.x=E.originalEvent.targetTouches?E.originalEvent.targetTouches[0].pageX:E.pageX,A.y=E.originalEvent.targetTouches?E.originalEvent.targetTouches[0].pageY:E.pageY,B=A.x,C=A.y;var J=y.parent().data('threshold')?y.parent().data('threshold'):y.data('threshold'),K='undefined'!=typeof J&&!1!==J&&parseInt(J)?parseInt(J):f.taphold_threshold;return f.hold_timer=window.setTimeout(function(){var L=A.x-B,M=A.y-C;if(E.target==z&&(A.x==B&&A.y==C||L>=-f.tap_pixel_range&&L<=f.tap_pixel_range&&M>=-f.tap_pixel_range&&M<=f.tap_pixel_range)){y.data('tapheld',!0);var N=Date.now(),O={x:f.touch_capable?F.touches[0].screenX:E.screenX,y:f.touch_capable?F.touches[0].screenY:E.screenY},P={x:f.touch_capable?Math.round(F.changedTouches[0].pageX-(y.offset()?y.offset().left:0)):Math.round(E.pageX-(y.offset()?y.offset().left:0)),y:f.touch_capable?Math.round(F.changedTouches[0].pageY-(y.offset()?y.offset().top:0)):Math.round(E.pageY-(y.offset()?y.offset().top:0))},R={startTime:G,endTime:N,startPosition:H,startOffset:I,endPosition:O,endOffset:P,duration:N-G,target:E.target};y.data('callee1',D),c(x,'taphold',E,R)}},K),!0}).on(f.endevent,function D(){y.data('callee2',D),y.data('tapheld',!1),window.clearTimeout(f.hold_timer)}).on(f.moveevent,function D(E){y.data('callee3',D),B=E.originalEvent.targetTouches?E.originalEvent.targetTouches[0].pageX:E.pageX,C=E.originalEvent.targetTouches?E.originalEvent.targetTouches[0].pageY:E.pageY})},remove:function(){a(this).off(f.startevent,a(this).data.callee1).off(f.endevent,a(this).data.callee2).off(f.moveevent,a(this).data.callee3)}},a.event.special.doubletap={setup:function(){var z,A,C,D,x=this,y=a(x),B=null,E=!1;y.on(f.startevent,function F(G){return G.which&&1!==G.which?!1:(y.data('doubletapped',!1),z=G.target,y.data('callee1',F),C=G.originalEvent,B||(B={position:{x:f.touch_capable?C.touches[0].screenX:G.screenX,y:f.touch_capable?C.touches[0].screenY:G.screenY},offset:{x:f.touch_capable?Math.round(C.changedTouches[0].pageX-(y.offset()?y.offset().left:0)):Math.round(G.pageX-(y.offset()?y.offset().left:0)),y:f.touch_capable?Math.round(C.changedTouches[0].pageY-(y.offset()?y.offset().top:0)):Math.round(G.pageY-(y.offset()?y.offset().top:0))},time:Date.now(),target:G.target,element:G.originalEvent.srcElement,index:a(G.target).index()}),!0)}).on(f.endevent,function F(G){var H=Date.now(),I=y.data('lastTouch')||H+1,J=H-I;if(window.clearTimeout(A),y.data('callee2',F),J=-f.tap_pixel_range&&G<=f.tap_pixel_range&&H>=-f.tap_pixel_range&&H<=f.tap_pixel_range)){var I=D.originalEvent,J={position:{x:f.touch_capable?I.changedTouches[0].screenX:D.screenX,y:f.touch_capable?I.changedTouches[0].screenY:D.screenY},offset:{x:f.touch_capable?Math.round(I.changedTouches[0].pageX-(y.offset()?y.offset().left:0)):Math.round(D.pageX-(y.offset()?y.offset().left:0)),y:f.touch_capable?Math.round(I.changedTouches[0].pageY-(y.offset()?y.offset().top:0)):Math.round(D.pageY-(y.offset()?y.offset().top:0))},time:Date.now(),target:D.target};J.time-A=-f.tap_pixel_range&&I<=f.tap_pixel_range&&J>=-f.tap_pixel_range&&J<=f.tap_pixel_range)){for(var O,L=F.originalEvent,M=[],N=0;NF.y&&E.y-F.y>M&&(I='swipeup'),E.xL&&(I='swiperight'),E.yM&&(I='swipedown'),E.x>F.x&&E.x-F.x>L&&(I='swipeleft'),void 0!=I&&C){E.x=0,E.y=0,F.x=0,F.y=0,C=!1;var N=H.originalEvent,O={position:{x:f.touch_capable?N.touches[0].screenX:H.screenX,y:f.touch_capable?N.touches[0].screenY:H.screenY},offset:{x:f.touch_capable?Math.round(N.changedTouches[0].pageX-(B.offset()?B.offset().left:0)):Math.round(H.pageX-(B.offset()?B.offset().left:0)),y:f.touch_capable?Math.round(N.changedTouches[0].pageY-(B.offset()?B.offset().top:0)):Math.round(H.pageY-(B.offset()?B.offset().top:0))},time:Date.now(),target:H.target},P=Math.abs(G.position.x-O.position.x),Q=Math.abs(G.position.y-O.position.y),R={startEvnt:G,endEvnt:O,direction:I.replace('swipe',''),xAmount:P,yAmount:Q,duration:O.time-G.time};D=!0,B.trigger('swipe',R).trigger(I,R)}}function z(H){B=a(H.currentTarget);var I='';if(B.data('callee3',z),D){var J=B.data('xthreshold'),K=B.data('ythreshold'),L='undefined'!=typeof J&&!1!==J&&parseInt(J)?parseInt(J):f.swipe_h_threshold,M='undefined'!=typeof K&&!1!==K&&parseInt(K)?parseInt(K):f.swipe_v_threshold,N=H.originalEvent,O={position:{x:f.touch_capable?N.changedTouches[0].screenX:H.screenX,y:f.touch_capable?N.changedTouches[0].screenY:H.screenY},offset:{x:f.touch_capable?Math.round(N.changedTouches[0].pageX-(B.offset()?B.offset().left:0)):Math.round(H.pageX-(B.offset()?B.offset().left:0)),y:f.touch_capable?Math.round(N.changedTouches[0].pageY-(B.offset()?B.offset().top:0)):Math.round(H.pageY-(B.offset()?B.offset().top:0))},time:Date.now(),target:H.target};G.position.y>O.position.y&&G.position.y-O.position.y>M&&(I='swipeup'),G.position.xL&&(I='swiperight'),G.position.yM&&(I='swipedown'),G.position.x>O.position.x&&G.position.x-O.position.x>L&&(I='swipeleft');var P=Math.abs(G.position.x-O.position.x),Q=Math.abs(G.position.y-O.position.y),R={startEvnt:G,endEvnt:O,direction:I.replace('swipe',''),xAmount:P,yAmount:Q,duration:O.time-G.time};B.trigger('swipeend',R)}C=!1,D=!1}var G,A=this,B=a(A),C=!1,D=!1,E={x:0,y:0},F={x:0,y:0};B.on(f.startevent,x),B.on(f.moveevent,y),B.on(f.endevent,z)},remove:function(){a(this).off(f.startevent,a(this).data.callee1).off(f.moveevent,a(this).data.callee2).off(f.endevent,a(this).data.callee3)}},a.event.special.scrollstart={setup:function(){function x(C,D){A=D,c(y,A?'scrollstart':'scrollend',C)}var A,B,y=this,z=a(y);z.on(f.scrollevent,function C(D){z.data('callee',C),A||x(D,!0),clearTimeout(B),B=setTimeout(function(){x(D,!1)},50)})},remove:function(){a(this).off(f.scrollevent,a(this).data.callee)}};var h,j,k,l,m,g=a(window),n={0:!0,180:!0};if(f.orientation_support){var o=window.innerWidth||g.width(),p=window.innerHeight||g.height();l=o>p&&o-p>50,m=n[window.orientation],(l&&m||!l&&!m)&&(n={90:!0,'-90':!0})}a.event.special.orientationchange=h={setup:function(){return!f.orientation_support&&(k=j(),g.on('throttledresize',b),!0)},teardown:function(){return!f.orientation_support&&(g.off('throttledresize',b),!0)},add:function(x){var y=x.handler;x.handler=function(z){return z.orientation=j(),y.apply(this,arguments)}}},a.event.special.orientationchange.orientation=j=function(){var x=!0,y=document.documentElement;return x=f.orientation_support?n[window.orientation]:y&&1.1>y.clientWidth/y.clientHeight,x?'portrait':'landscape'},a.event.special.throttledresize={setup:function(){a(this).on('resize',s)},teardown:function(){a(this).off('resize',s)}};var u,v,w,r=250,s=function(){v=Date.now(),w=v-t,w>=r?(t=v,a(this).trigger('throttledresize')):(u&&window.clearTimeout(u),u=window.setTimeout(b,r-w))},t=0;a.each({scrollend:'scrollstart',swipeup:'swipe',swiperight:'swipe',swipedown:'swipe',swipeleft:'swipe',swipeend:'swipe',tap2:'tap'},function(x,y){a.event.special[x]={setup:function(){a(this).on(y,a.noop)}}})})(jQuery); 29 | -------------------------------------------------------------------------------- /src/2.0.2/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2019, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | "use strict";!function(e){e.attrFn=e.attrFn||{};var t="ontouchstart"in window,a={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,shake_threshold:15,touch_capable:t,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:t?"touchstart":"mousedown",endevent:t?"touchend":"mouseup",moveevent:t?"touchmove":"mousemove",tapevent:t?"tap":"click",scrollevent:t?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.touch={},e.isTouchCapable=function(){return a.touch_capable},e.getStartEvent=function(){return a.startevent},e.getEndEvent=function(){return a.endevent},e.getMoveEvent=function(){return a.moveevent},e.getTapEvent=function(){return a.tapevent},e.getScrollEvent=function(){return a.scrollevent},e.touch.setSwipeThresholdX=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_h_threshold=e},e.touch.setSwipeThresholdY=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_v_threshold=e},e.touch.setDoubleTapInt=function(e){if("number"!=typeof e)throw new Error("Interval parameter must be a type of number");a.doubletap_int=e},e.touch.setTapHoldThreshold=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.taphold_threshold=e},e.touch.setTapRange=function(e){if("number"!=typeof e)throw new Error("Ranger parameter must be a type of number");a.tap_pixel_range=threshold},e.each(["tapstart","tapend","tapmove","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange","tap2","taphold2"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(a.startevent,function e(n){if(o.data("callee",e),n.which&&1!==n.which)return!1;var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.touches[0].pageX:n.pageX,y:a.touch_capable?r.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapstart",n,p),!0})},remove:function(){e(this).off(a.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(a.moveevent,function e(n){o.data("callee",e);var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.touches[0].pageX:n.pageX,y:a.touch_capable?r.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapmove",n,p),!0})},remove:function(){e(this).off(a.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(a.endevent,function e(n){o.data("callee",e);var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.changedTouches[0].pageX:n.pageX,y:a.touch_capable?r.changedTouches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapend",n,p),!0})},remove:function(){e(this).off(a.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),i={x:0,y:0},r=0,p=0;n.on(a.startevent,function e(h){if(h.which&&1!==h.which)return!1;n.data("tapheld",!1),t=h.target;var c=h.originalEvent,u=Date.now();a.touch_capable?c.touches[0].pageX:h.pageX,a.touch_capable?c.touches[0].pageY:h.pageY,a.touch_capable?(c.touches[0].pageX,c.touches[0].target.offsetLeft):h.offsetX,a.touch_capable?(c.touches[0].pageY,c.touches[0].target.offsetTop):h.offsetY;i.x=h.originalEvent.targetTouches?h.originalEvent.targetTouches[0].pageX:h.pageX,i.y=h.originalEvent.targetTouches?h.originalEvent.targetTouches[0].pageY:h.pageY,r=i.x,p=i.y;var s=n.parent().data("threshold")?n.parent().data("threshold"):n.data("threshold"),l=void 0!==s&&!1!==s&&parseInt(s)?parseInt(s):a.taphold_threshold;return n.data("hold_timer",window.setTimeout(function(){var s=i.x-r,l=i.y-p;if(h.target==t&&(i.x==r&&i.y==p||s>=-a.tap_pixel_range&&s<=a.tap_pixel_range&&l>=-a.tap_pixel_range&&l<=a.tap_pixel_range)){n.data("tapheld",!0);for(var g=Date.now()-u,d=h.originalEvent.targetTouches?h.originalEvent.targetTouches:[h],f=[],v=n.get(0)!==window&&n.get(0)!==document?n.offset():{left:0,top:0},_=0;_100){i.data("doubletapped",!0),window.clearTimeout(a.tap_timer);var l=i.get(0)!==window&&i.get(0)!==document?i.offset():{left:0,top:0},g={position:{x:a.touch_capable?c.originalEvent.changedTouches[0].pageX:c.pageX,y:a.touch_capable?c.originalEvent.changedTouches[0].pageY:c.pageY},offset:{x:a.touch_capable?Math.round(o.changedTouches[0].pageX-l.left):Math.round(c.pageX-l.left),y:a.touch_capable?Math.round(o.changedTouches[0].pageY-l.top):Math.round(c.pageY-l.top)},time:Date.now(),target:c.target,element:c.originalEvent.srcElement,index:e(c.target).index()},d={firstTap:r,secondTap:g,interval:g.time-r.time};p||(w(n,"doubletap",c,d),r=null),p=!0,window.setTimeout(function(){p=!1},a.doubletap_int)}else i.data("lastTouch",u),t=window.setTimeout(function(){r=null,window.clearTimeout(t)},a.doubletap_int,[c]);i.data("lastTouch",u)})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,i=null,r={x:0,y:0};o.on(a.startevent,function e(t){return(!t.which||1===t.which)&&(i=Date.now(),n=t.target,o.data("callee1",e),r.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,r.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,!0)}).on(a.endevent,function e(p){if(o.data("callee2",e),p.target==n){var h=p.originalEvent.changedTouches?p.originalEvent.changedTouches[0].pageX:p.pageX,c=p.originalEvent.changedTouches?p.originalEvent.changedTouches[0].pageY:p.pageY;a.tap_timer=window.setTimeout(function(){var e=r.x-h,n=r.y-c;if(!o.data("doubletapped")&&!o.data("tapheld")&&(r.x==h&&r.y==c||e>=-a.tap_pixel_range&&e<=a.tap_pixel_range&&n>=-a.tap_pixel_range&&n<=a.tap_pixel_range)){var u=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},s=p.originalEvent,l={position:{x:a.touch_capable?s.changedTouches[0].pageX:p.pageX,y:a.touch_capable?s.changedTouches[0].pageY:p.pageY},offset:{x:a.touch_capable?Math.round(s.changedTouches[0].pageX-u.left):Math.round(p.pageX-u.left),y:a.touch_capable?Math.round(s.changedTouches[0].pageY-u.top):Math.round(p.pageY-u.top)},time:Date.now(),target:p.target};l.time-i=-a.tap_pixel_range&&l<=a.tap_pixel_range&&g>=-a.tap_pixel_range&&g<=a.tap_pixel_range)){for(var d=i.get(0)!==window&&i.get(0)!==document?i.offset():{left:0,top:0},f=c.originalEvent,v=[],_=0;_p.y&&r.y-p.y>d&&(u="swipeup"),r.xg&&(u="swiperight"),r.yd&&(u="swipedown"),r.x>p.x&&r.x-p.x>g&&(u="swipeleft"),null!=u&&n){r.x=0,r.y=0,p.x=0,p.y=0,n=!1;var f=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},v=c.originalEvent,w={position:{x:a.touch_capable?v.touches[0].pageX:c.pageX,y:a.touch_capable?v.touches[0].pageY:c.pageY},offset:{x:a.touch_capable?Math.round(v.changedTouches[0].pageX-f.left):Math.round(c.pageX-f.left),y:a.touch_capable?Math.round(v.changedTouches[0].pageY-f.top):Math.round(c.pageY-f.top)},time:Date.now(),target:c.target},_=Math.abs(t.position.x-w.position.x),m=Math.abs(t.position.y-w.position.y),T={startEvnt:t,endEvnt:w,direction:u.replace("swipe",""),xAmount:_,yAmount:m,duration:w.time-t.time};i=!0,o.trigger("swipe",T).trigger(u,T)}}),o.on(a.endevent,function r(p){var h="";if((o=e(p.currentTarget)).data("callee3",r),i){var c=o.data("xthreshold"),u=o.data("ythreshold"),s=void 0!==c&&!1!==c&&parseInt(c)?parseInt(c):a.swipe_h_threshold,l=void 0!==u&&!1!==u&&parseInt(u)?parseInt(u):a.swipe_v_threshold,g=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},d=p.originalEvent,f={position:{x:a.touch_capable?d.changedTouches[0].pageX:p.pageX,y:a.touch_capable?d.changedTouches[0].pageY:p.pageY},offset:{x:a.touch_capable?Math.round(d.changedTouches[0].pageX-g.left):Math.round(p.pageX-g.left),y:a.touch_capable?Math.round(d.changedTouches[0].pageY-g.top):Math.round(p.pageY-g.top)},time:Date.now(),target:p.target};t.position.y>f.position.y&&t.position.y-f.position.y>l&&(h="swipeup"),t.position.xs&&(h="swiperight"),t.position.yl&&(h="swipedown"),t.position.x>f.position.x&&t.position.x-f.position.x>s&&(h="swipeleft");var v=Math.abs(t.position.x-f.position.x),w=Math.abs(t.position.y-f.position.y),_={startEvnt:t,endEvnt:f,direction:h.replace("swipe",""),xAmount:v,yAmount:w,duration:f.time-t.time};o.trigger("swipeend",_)}n=!1,i=!1})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.moveevent,e(this).data.callee2).off(a.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){var t,o,n=this,i=e(n);function r(e,a){w(n,(t=a)?"scrollstart":"scrollend",e)}i.on(a.scrollevent,function e(a){i.data("callee",e),t||r(a,!0),clearTimeout(o),o=setTimeout(function(){r(a,!1)},50)})},remove:function(){e(this).off(a.scrollevent,e(this).data.callee)}};var o,n,i,r,p=e(window),h={0:!0,180:!0};if(a.orientation_support){var c=window.innerWidth||p.width(),u=window.innerHeight||p.height();i=c>u&&c-u>50,r=h[window.orientation],(i&&r||!i&&!r)&&(h={"-90":!0,90:!0})}function s(){var e=o();e!==n&&(n=e,p.trigger("orientationchange"))}e.event.special.orientationchange={setup:function(){return!a.orientation_support&&(n=o(),p.on("throttledresize",s),!0)},teardown:function(){return!a.orientation_support&&(p.off("throttledresize",s),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=o(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=o=function(){var e=document.documentElement;return(a.orientation_support?h[window.orientation]:e&&e.clientWidth/e.clientHeight<1.1)?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",f)},teardown:function(){e(this).off("resize",f)}};var l,g,d,f=function(){g=Date.now(),(d=g-v)>=250?(v=g,e(this).trigger("throttledresize")):(l&&window.clearTimeout(l),l=window.setTimeout(s,250-d))},v=0;function w(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap",taphold2:"taphold"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 28 | -------------------------------------------------------------------------------- /src/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2019, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | "use strict";!function(e){e.attrFn=e.attrFn||{};var t="ontouchstart"in window,a={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,shake_threshold:15,touch_capable:t,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:t?"touchstart":"mousedown",endevent:t?"touchend":"mouseup",moveevent:t?"touchmove":"mousemove",tapevent:t?"tap":"click",scrollevent:t?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.touch={},e.isTouchCapable=function(){return a.touch_capable},e.getStartEvent=function(){return a.startevent},e.getEndEvent=function(){return a.endevent},e.getMoveEvent=function(){return a.moveevent},e.getTapEvent=function(){return a.tapevent},e.getScrollEvent=function(){return a.scrollevent},e.touch.setSwipeThresholdX=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_h_threshold=e},e.touch.setSwipeThresholdY=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_v_threshold=e},e.touch.setDoubleTapInt=function(e){if("number"!=typeof e)throw new Error("Interval parameter must be a type of number");a.doubletap_int=e},e.touch.setTapHoldThreshold=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.taphold_threshold=e},e.touch.setTapRange=function(e){if("number"!=typeof e)throw new Error("Ranger parameter must be a type of number");a.tap_pixel_range=e},e.each(["tapstart","tapend","tapmove","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange","tap2","taphold2"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(a.startevent,function e(n){if(o.data("callee",e),n.which&&1!==n.which)return!1;var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.touches[0].pageX:n.pageX,y:a.touch_capable?r.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapstart",n,p),!0})},remove:function(){e(this).off(a.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(a.moveevent,function e(n){o.data("callee",e);var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.touches[0].pageX:n.pageX,y:a.touch_capable?r.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapmove",n,p),!0})},remove:function(){e(this).off(a.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(a.endevent,function e(n){o.data("callee",e);var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.changedTouches[0].pageX:n.pageX,y:a.touch_capable?r.changedTouches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapend",n,p),!0})},remove:function(){e(this).off(a.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),i={x:0,y:0},r=0,p=0;n.on(a.startevent,function e(h){if(h.which&&1!==h.which)return!1;n.data("tapheld",!1),t=h.target;var c=h.originalEvent,s=Date.now();a.touch_capable?c.touches[0].pageX:h.pageX,a.touch_capable?c.touches[0].pageY:h.pageY,a.touch_capable?(c.touches[0].pageX,c.touches[0].target.offsetLeft):h.offsetX,a.touch_capable?(c.touches[0].pageY,c.touches[0].target.offsetTop):h.offsetY;i.x=h.originalEvent.targetTouches?h.originalEvent.targetTouches[0].pageX:h.pageX,i.y=h.originalEvent.targetTouches?h.originalEvent.targetTouches[0].pageY:h.pageY,r=i.x,p=i.y;var u=n.parent().data("threshold")?n.parent().data("threshold"):n.data("threshold"),l=void 0!==u&&!1!==u&&parseInt(u)?parseInt(u):a.taphold_threshold;return n.data("hold_timer",window.setTimeout(function(){var u=i.x-r,l=i.y-p;if(h.target==t&&(i.x==r&&i.y==p||u>=-a.tap_pixel_range&&u<=a.tap_pixel_range&&l>=-a.tap_pixel_range&&l<=a.tap_pixel_range)){n.data("tapheld",!0);for(var g=Date.now()-s,d=h.originalEvent.targetTouches?h.originalEvent.targetTouches:[h],f=[],v=n.get(0)!==window&&n.get(0)!==document?n.offset():{left:0,top:0},_=0;_100){i.data("doubletapped",!0),window.clearTimeout(a.tap_timer);var l=i.get(0)!==window&&i.get(0)!==document?i.offset():{left:0,top:0},g={position:{x:a.touch_capable?c.originalEvent.changedTouches[0].pageX:c.pageX,y:a.touch_capable?c.originalEvent.changedTouches[0].pageY:c.pageY},offset:{x:a.touch_capable?Math.round(o.changedTouches[0].pageX-l.left):Math.round(c.pageX-l.left),y:a.touch_capable?Math.round(o.changedTouches[0].pageY-l.top):Math.round(c.pageY-l.top)},time:Date.now(),target:c.target,element:c.originalEvent.srcElement,index:e(c.target).index()},d={firstTap:r,secondTap:g,interval:g.time-r.time};p||(w(n,"doubletap",c,d),r=null),p=!0,window.setTimeout(function(){p=!1},a.doubletap_int)}else i.data("lastTouch",s),t=window.setTimeout(function(){r=null,window.clearTimeout(t)},a.doubletap_int,[c]);i.data("lastTouch",s)})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,i=null,r={x:0,y:0};o.on(a.startevent,function e(t){return(!t.which||1===t.which)&&(i=Date.now(),n=t.target,o.data("callee1",e),r.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,r.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,!0)}).on(a.endevent,function e(p){if(o.data("callee2",e),p.target==n){var h=p.originalEvent.changedTouches?p.originalEvent.changedTouches[0].pageX:p.pageX,c=p.originalEvent.changedTouches?p.originalEvent.changedTouches[0].pageY:p.pageY;a.tap_timer=window.setTimeout(function(){var e=r.x-h,n=r.y-c;if(!o.data("doubletapped")&&!o.data("tapheld")&&(r.x==h&&r.y==c||e>=-a.tap_pixel_range&&e<=a.tap_pixel_range&&n>=-a.tap_pixel_range&&n<=a.tap_pixel_range)){var s=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},u=p.originalEvent,l={position:{x:a.touch_capable?u.changedTouches[0].pageX:p.pageX,y:a.touch_capable?u.changedTouches[0].pageY:p.pageY},offset:{x:a.touch_capable?Math.round(u.changedTouches[0].pageX-s.left):Math.round(p.pageX-s.left),y:a.touch_capable?Math.round(u.changedTouches[0].pageY-s.top):Math.round(p.pageY-s.top)},time:Date.now(),target:p.target};l.time-i=-a.tap_pixel_range&&l<=a.tap_pixel_range&&g>=-a.tap_pixel_range&&g<=a.tap_pixel_range)){for(var d=i.get(0)!==window&&i.get(0)!==document?i.offset():{left:0,top:0},f=c.originalEvent,v=[],_=0;_Math.abs(p.y-r.y)?(r.xg&&(s="swiperight"),r.x>p.x&&r.x-p.x>g&&(s="swipeleft")):(r.y>p.y&&r.y-p.y>d&&(s="swipeup"),r.yd&&(s="swipedown")),null!=s&&n){r.x=0,r.y=0,p.x=0,p.y=0,n=!1;var f=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},v=c.originalEvent,w={position:{x:a.touch_capable?v.touches[0].pageX:c.pageX,y:a.touch_capable?v.touches[0].pageY:c.pageY},offset:{x:a.touch_capable?Math.round(v.changedTouches[0].pageX-f.left):Math.round(c.pageX-f.left),y:a.touch_capable?Math.round(v.changedTouches[0].pageY-f.top):Math.round(c.pageY-f.top)},time:Date.now(),target:c.target},_=Math.abs(t.position.x-w.position.x),m=Math.abs(t.position.y-w.position.y),T={startEvnt:t,endEvnt:w,direction:s.replace("swipe",""),xAmount:_,yAmount:m,duration:w.time-t.time};i=!0,o.trigger("swipe",T).trigger(s,T)}}),o.on(a.endevent,function r(p){var h="";if((o=e(p.currentTarget)).data("callee3",r),i){var c=o.data("xthreshold"),s=o.data("ythreshold"),u=void 0!==c&&!1!==c&&parseInt(c)?parseInt(c):a.swipe_h_threshold,l=void 0!==s&&!1!==s&&parseInt(s)?parseInt(s):a.swipe_v_threshold,g=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},d=p.originalEvent,f={position:{x:a.touch_capable?d.changedTouches[0].pageX:p.pageX,y:a.touch_capable?d.changedTouches[0].pageY:p.pageY},offset:{x:a.touch_capable?Math.round(d.changedTouches[0].pageX-g.left):Math.round(p.pageX-g.left),y:a.touch_capable?Math.round(d.changedTouches[0].pageY-g.top):Math.round(p.pageY-g.top)},time:Date.now(),target:p.target},v=Math.abs(t.position.x-f.position.x),w=Math.abs(t.position.y-f.position.y);v>w?(t.position.xu&&(h="swiperight"),t.position.x>f.position.x&&t.position.x-f.position.x>u&&(h="swipeleft")):(t.position.y>f.position.y&&t.position.y-f.position.y>l&&(h="swipeup"),t.position.yl&&(h="swipedown"));var _={startEvnt:t,endEvnt:f,direction:h.replace("swipe",""),xAmount:v,yAmount:w,duration:f.time-t.time};o.trigger("swipeend",_)}n=!1,i=!1})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.moveevent,e(this).data.callee2).off(a.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){var t,o,n=this,i=e(n);function r(e,a){w(n,(t=a)?"scrollstart":"scrollend",e)}i.on(a.scrollevent,function e(a){i.data("callee",e),t||r(a,!0),clearTimeout(o),o=setTimeout(function(){r(a,!1)},50)})},remove:function(){e(this).off(a.scrollevent,e(this).data.callee)}};var o,n,i,r,p=e(window),h={0:!0,180:!0};if(a.orientation_support){var c=window.innerWidth||p.width(),s=window.innerHeight||p.height();i=c>s&&c-s>50,r=h[window.orientation],(i&&r||!i&&!r)&&(h={"-90":!0,90:!0})}function u(){var e=o();e!==n&&(n=e,p.trigger("orientationchange"))}e.event.special.orientationchange={setup:function(){return!a.orientation_support&&(n=o(),p.on("throttledresize",u),!0)},teardown:function(){return!a.orientation_support&&(p.off("throttledresize",u),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=o(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=o=function(){var e=document.documentElement;return(a.orientation_support?h[window.orientation]:e&&e.clientWidth/e.clientHeight<1.1)?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",f)},teardown:function(){e(this).off("resize",f)}};var l,g,d,f=function(){g=Date.now(),(d=g-v)>=250?(v=g,e(this).trigger("throttledresize")):(l&&window.clearTimeout(l),l=window.setTimeout(u,250-d))},v=0;function w(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap",taphold2:"taphold"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 28 | -------------------------------------------------------------------------------- /src/2.0.3/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2019, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | "use strict";!function(e){e.attrFn=e.attrFn||{};var t="ontouchstart"in window,a={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,shake_threshold:15,touch_capable:t,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:t?"touchstart":"mousedown",endevent:t?"touchend":"mouseup",moveevent:t?"touchmove":"mousemove",tapevent:t?"tap":"click",scrollevent:t?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.touch={},e.isTouchCapable=function(){return a.touch_capable},e.getStartEvent=function(){return a.startevent},e.getEndEvent=function(){return a.endevent},e.getMoveEvent=function(){return a.moveevent},e.getTapEvent=function(){return a.tapevent},e.getScrollEvent=function(){return a.scrollevent},e.touch.setSwipeThresholdX=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_h_threshold=e},e.touch.setSwipeThresholdY=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_v_threshold=e},e.touch.setDoubleTapInt=function(e){if("number"!=typeof e)throw new Error("Interval parameter must be a type of number");a.doubletap_int=e},e.touch.setTapHoldThreshold=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.taphold_threshold=e},e.touch.setTapRange=function(e){if("number"!=typeof e)throw new Error("Ranger parameter must be a type of number");a.tap_pixel_range=threshold},e.each(["tapstart","tapend","tapmove","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange","tap2","taphold2"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(a.startevent,function e(n){if(o.data("callee",e),n.which&&1!==n.which)return!1;var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.touches[0].pageX:n.pageX,y:a.touch_capable?r.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapstart",n,p),!0})},remove:function(){e(this).off(a.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(a.moveevent,function e(n){o.data("callee",e);var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.touches[0].pageX:n.pageX,y:a.touch_capable?r.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapmove",n,p),!0})},remove:function(){e(this).off(a.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(a.endevent,function e(n){o.data("callee",e);var i=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},r=n.originalEvent,p={position:{x:a.touch_capable?r.changedTouches[0].pageX:n.pageX,y:a.touch_capable?r.changedTouches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(r.changedTouches[0].pageX-i.left):Math.round(n.pageX-i.left),y:a.touch_capable?Math.round(r.changedTouches[0].pageY-i.top):Math.round(n.pageY-i.top)},time:Date.now(),target:n.target};return w(t,"tapend",n,p),!0})},remove:function(){e(this).off(a.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),i={x:0,y:0},r=0,p=0;n.on(a.startevent,function e(h){if(h.which&&1!==h.which)return!1;n.data("tapheld",!1),t=h.target;var c=h.originalEvent,s=Date.now();a.touch_capable?c.touches[0].pageX:h.pageX,a.touch_capable?c.touches[0].pageY:h.pageY,a.touch_capable?(c.touches[0].pageX,c.touches[0].target.offsetLeft):h.offsetX,a.touch_capable?(c.touches[0].pageY,c.touches[0].target.offsetTop):h.offsetY;i.x=h.originalEvent.targetTouches?h.originalEvent.targetTouches[0].pageX:h.pageX,i.y=h.originalEvent.targetTouches?h.originalEvent.targetTouches[0].pageY:h.pageY,r=i.x,p=i.y;var u=n.parent().data("threshold")?n.parent().data("threshold"):n.data("threshold"),l=void 0!==u&&!1!==u&&parseInt(u)?parseInt(u):a.taphold_threshold;return n.data("hold_timer",window.setTimeout(function(){var u=i.x-r,l=i.y-p;if(h.target==t&&(i.x==r&&i.y==p||u>=-a.tap_pixel_range&&u<=a.tap_pixel_range&&l>=-a.tap_pixel_range&&l<=a.tap_pixel_range)){n.data("tapheld",!0);for(var g=Date.now()-s,d=h.originalEvent.targetTouches?h.originalEvent.targetTouches:[h],f=[],v=n.get(0)!==window&&n.get(0)!==document?n.offset():{left:0,top:0},_=0;_100){i.data("doubletapped",!0),window.clearTimeout(a.tap_timer);var l=i.get(0)!==window&&i.get(0)!==document?i.offset():{left:0,top:0},g={position:{x:a.touch_capable?c.originalEvent.changedTouches[0].pageX:c.pageX,y:a.touch_capable?c.originalEvent.changedTouches[0].pageY:c.pageY},offset:{x:a.touch_capable?Math.round(o.changedTouches[0].pageX-l.left):Math.round(c.pageX-l.left),y:a.touch_capable?Math.round(o.changedTouches[0].pageY-l.top):Math.round(c.pageY-l.top)},time:Date.now(),target:c.target,element:c.originalEvent.srcElement,index:e(c.target).index()},d={firstTap:r,secondTap:g,interval:g.time-r.time};p||(w(n,"doubletap",c,d),r=null),p=!0,window.setTimeout(function(){p=!1},a.doubletap_int)}else i.data("lastTouch",s),t=window.setTimeout(function(){r=null,window.clearTimeout(t)},a.doubletap_int,[c]);i.data("lastTouch",s)})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,i=null,r={x:0,y:0};o.on(a.startevent,function e(t){return(!t.which||1===t.which)&&(i=Date.now(),n=t.target,o.data("callee1",e),r.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,r.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,!0)}).on(a.endevent,function e(p){if(o.data("callee2",e),p.target==n){var h=p.originalEvent.changedTouches?p.originalEvent.changedTouches[0].pageX:p.pageX,c=p.originalEvent.changedTouches?p.originalEvent.changedTouches[0].pageY:p.pageY;a.tap_timer=window.setTimeout(function(){var e=r.x-h,n=r.y-c;if(!o.data("doubletapped")&&!o.data("tapheld")&&(r.x==h&&r.y==c||e>=-a.tap_pixel_range&&e<=a.tap_pixel_range&&n>=-a.tap_pixel_range&&n<=a.tap_pixel_range)){var s=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},u=p.originalEvent,l={position:{x:a.touch_capable?u.changedTouches[0].pageX:p.pageX,y:a.touch_capable?u.changedTouches[0].pageY:p.pageY},offset:{x:a.touch_capable?Math.round(u.changedTouches[0].pageX-s.left):Math.round(p.pageX-s.left),y:a.touch_capable?Math.round(u.changedTouches[0].pageY-s.top):Math.round(p.pageY-s.top)},time:Date.now(),target:p.target};l.time-i=-a.tap_pixel_range&&l<=a.tap_pixel_range&&g>=-a.tap_pixel_range&&g<=a.tap_pixel_range)){for(var d=i.get(0)!==window&&i.get(0)!==document?i.offset():{left:0,top:0},f=c.originalEvent,v=[],_=0;_Math.abs(p.y-r.y)?(r.xg&&(s="swiperight"),r.x>p.x&&r.x-p.x>g&&(s="swipeleft")):(r.y>p.y&&r.y-p.y>d&&(s="swipeup"),r.yd&&(s="swipedown")),null!=s&&n){r.x=0,r.y=0,p.x=0,p.y=0,n=!1;var f=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},v=c.originalEvent,w={position:{x:a.touch_capable?v.touches[0].pageX:c.pageX,y:a.touch_capable?v.touches[0].pageY:c.pageY},offset:{x:a.touch_capable?Math.round(v.changedTouches[0].pageX-f.left):Math.round(c.pageX-f.left),y:a.touch_capable?Math.round(v.changedTouches[0].pageY-f.top):Math.round(c.pageY-f.top)},time:Date.now(),target:c.target},_=Math.abs(t.position.x-w.position.x),m=Math.abs(t.position.y-w.position.y),T={startEvnt:t,endEvnt:w,direction:s.replace("swipe",""),xAmount:_,yAmount:m,duration:w.time-t.time};i=!0,o.trigger("swipe",T).trigger(s,T)}}),o.on(a.endevent,function r(p){var h="";if((o=e(p.currentTarget)).data("callee3",r),i){var c=o.data("xthreshold"),s=o.data("ythreshold"),u=void 0!==c&&!1!==c&&parseInt(c)?parseInt(c):a.swipe_h_threshold,l=void 0!==s&&!1!==s&&parseInt(s)?parseInt(s):a.swipe_v_threshold,g=o.get(0)!==window&&o.get(0)!==document?o.offset():{left:0,top:0},d=p.originalEvent,f={position:{x:a.touch_capable?d.changedTouches[0].pageX:p.pageX,y:a.touch_capable?d.changedTouches[0].pageY:p.pageY},offset:{x:a.touch_capable?Math.round(d.changedTouches[0].pageX-g.left):Math.round(p.pageX-g.left),y:a.touch_capable?Math.round(d.changedTouches[0].pageY-g.top):Math.round(p.pageY-g.top)},time:Date.now(),target:p.target},v=Math.abs(t.position.x-f.position.x),w=Math.abs(t.position.y-f.position.y);v>w?(t.position.xu&&(h="swiperight"),t.position.x>f.position.x&&t.position.x-f.position.x>u&&(h="swipeleft")):(t.position.y>f.position.y&&t.position.y-f.position.y>l&&(h="swipeup"),t.position.yl&&(h="swipedown"));var _={startEvnt:t,endEvnt:f,direction:h.replace("swipe",""),xAmount:v,yAmount:w,duration:f.time-t.time};o.trigger("swipeend",_)}n=!1,i=!1})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.moveevent,e(this).data.callee2).off(a.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){var t,o,n=this,i=e(n);function r(e,a){w(n,(t=a)?"scrollstart":"scrollend",e)}i.on(a.scrollevent,function e(a){i.data("callee",e),t||r(a,!0),clearTimeout(o),o=setTimeout(function(){r(a,!1)},50)})},remove:function(){e(this).off(a.scrollevent,e(this).data.callee)}};var o,n,i,r,p=e(window),h={0:!0,180:!0};if(a.orientation_support){var c=window.innerWidth||p.width(),s=window.innerHeight||p.height();i=c>s&&c-s>50,r=h[window.orientation],(i&&r||!i&&!r)&&(h={"-90":!0,90:!0})}function u(){var e=o();e!==n&&(n=e,p.trigger("orientationchange"))}e.event.special.orientationchange={setup:function(){return!a.orientation_support&&(n=o(),p.on("throttledresize",u),!0)},teardown:function(){return!a.orientation_support&&(p.off("throttledresize",u),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=o(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=o=function(){var e=document.documentElement;return(a.orientation_support?h[window.orientation]:e&&e.clientWidth/e.clientHeight<1.1)?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",f)},teardown:function(){e(this).off("resize",f)}};var l,g,d,f=function(){g=Date.now(),(d=g-v)>=250?(v=g,e(this).trigger("throttledresize")):(l&&window.clearTimeout(l),l=window.setTimeout(u,250-d))},v=0;function w(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap",taphold2:"taphold"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); -------------------------------------------------------------------------------- /src/2.0.0/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2017, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | 28 | "use strict";!function(e){e.attrFn=e.attrFn||{};var t="ontouchstart"in window,a={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,shake_threshold:15,touch_capable:t,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:t?"touchstart":"mousedown",endevent:t?"touchend":"mouseup",moveevent:t?"touchmove":"mousemove",tapevent:t?"tap":"click",scrollevent:t?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.touch={},e.isTouchCapable=function(){return a.touch_capable},e.getStartEvent=function(){return a.startevent},e.getEndEvent=function(){return a.endevent},e.getMoveEvent=function(){return a.moveevent},e.getTapEvent=function(){return a.tapevent},e.getScrollEvent=function(){return a.scrollevent},e.touch.setSwipeThresholdX=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_h_threshold=e},e.touch.setSwipeThresholdY=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_v_threshold=e},e.touch.setDoubleTapInt=function(e){if("number"!=typeof e)throw new Error("Interval parameter must be a type of number");a.doubletap_int=e},e.touch.setTapHoldThreshold=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.taphold_threshold=e},e.touch.setTapRange=function(e){if("number"!=typeof e)throw new Error("Ranger parameter must be a type of number");a.tap_pixel_range=threshold},e.each(["tapstart","tapend","tapmove","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange","tap2","taphold2"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(a.startevent,function e(n){if(o.data("callee",e),n.which&&1!==n.which)return!1;var i=n.originalEvent,r={position:{x:a.touch_capable?i.touches[0].pageX:n.pageX,y:a.touch_capable?i.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(i.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(n.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(i.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(n.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:n.target};return w(t,"tapstart",n,r),!0})},remove:function(){e(this).off(a.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(a.moveevent,function e(n){o.data("callee",e);var i=n.originalEvent,r={position:{x:a.touch_capable?i.touches[0].pageX:n.pageX,y:a.touch_capable?i.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(i.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(n.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(i.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(n.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:n.target};return w(t,"tapmove",n,r),!0})},remove:function(){e(this).off(a.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(a.endevent,function e(n){o.data("callee",e);var i=n.originalEvent,r={position:{x:a.touch_capable?i.changedTouches[0].pageX:n.pageX,y:a.touch_capable?i.changedTouches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(i.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(n.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(i.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(n.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:n.target};return w(t,"tapend",n,r),!0})},remove:function(){e(this).off(a.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),i={x:0,y:0},r=0,s=0;n.on(a.startevent,function e(p){if(p.which&&1!==p.which)return!1;n.data("tapheld",!1),t=p.target;var h=p.originalEvent,c=Date.now();a.touch_capable?h.touches[0].pageX:p.pageX,a.touch_capable?h.touches[0].pageY:p.pageY,a.touch_capable?(h.touches[0].pageX,h.touches[0].target.offsetLeft):p.offsetX,a.touch_capable?(h.touches[0].pageY,h.touches[0].target.offsetTop):p.offsetY;i.x=p.originalEvent.targetTouches?p.originalEvent.targetTouches[0].pageX:p.pageX,i.y=p.originalEvent.targetTouches?p.originalEvent.targetTouches[0].pageY:p.pageY,r=i.x,s=i.y;var u=n.parent().data("threshold")?n.parent().data("threshold"):n.data("threshold"),f=void 0!==u&&!1!==u&&parseInt(u)?parseInt(u):a.taphold_threshold;return a.hold_timer=window.setTimeout(function(){var u=i.x-r,f=i.y-s;if(p.target==t&&(i.x==r&&i.y==s||u>=-a.tap_pixel_range&&u<=a.tap_pixel_range&&f>=-a.tap_pixel_range&&f<=a.tap_pixel_range)){n.data("tapheld",!0);for(var l=Date.now()-c,g=p.originalEvent.targetTouches?p.originalEvent.targetTouches:[p],d=[],v=0;v100){i.data("doubletapped",!0),window.clearTimeout(a.tap_timer);var f={position:{x:a.touch_capable?h.originalEvent.changedTouches[0].pageX:h.pageX,y:a.touch_capable?h.originalEvent.changedTouches[0].pageY:h.pageY},offset:{x:a.touch_capable?Math.round(o.changedTouches[0].pageX-(i.offset()?i.offset().left:0)):Math.round(h.pageX-(i.offset()?i.offset().left:0)),y:a.touch_capable?Math.round(o.changedTouches[0].pageY-(i.offset()?i.offset().top:0)):Math.round(h.pageY-(i.offset()?i.offset().top:0))},time:Date.now(),target:h.target,element:h.originalEvent.srcElement,index:e(h.target).index()},l={firstTap:r,secondTap:f,interval:f.time-r.time};s||(w(n,"doubletap",h,l),r=null),s=!0,window.setTimeout(function(){s=!1},a.doubletap_int)}else i.data("lastTouch",c),t=window.setTimeout(function(){r=null,window.clearTimeout(t)},a.doubletap_int,[h]);i.data("lastTouch",c)})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,i=null,r={x:0,y:0};o.on(a.startevent,function e(t){return(!t.which||1===t.which)&&(i=Date.now(),n=t.target,o.data("callee1",e),r.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,r.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,!0)}).on(a.endevent,function e(s){if(o.data("callee2",e),s.target==n){var p=s.originalEvent.changedTouches?s.originalEvent.changedTouches[0].pageX:s.pageX,h=s.originalEvent.changedTouches?s.originalEvent.changedTouches[0].pageY:s.pageY;a.tap_timer=window.setTimeout(function(){var e=r.x-p,n=r.y-h;if(!o.data("doubletapped")&&!o.data("tapheld")&&(r.x==p&&r.y==h||e>=-a.tap_pixel_range&&e<=a.tap_pixel_range&&n>=-a.tap_pixel_range&&n<=a.tap_pixel_range)){var c=s.originalEvent,u={position:{x:a.touch_capable?c.changedTouches[0].pageX:s.pageX,y:a.touch_capable?c.changedTouches[0].pageY:s.pageY},offset:{x:a.touch_capable?Math.round(c.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(s.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(c.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(s.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:s.target};u.time-i=-a.tap_pixel_range&&f<=a.tap_pixel_range&&l>=-a.tap_pixel_range&&l<=a.tap_pixel_range)){for(var g=h.originalEvent,d=[],v=0;vs.y&&r.y-s.y>g&&(c="swipeup"),r.xl&&(c="swiperight"),r.yg&&(c="swipedown"),r.x>s.x&&r.x-s.x>l&&(c="swipeleft"),void 0!=c&&n){r.x=0,r.y=0,s.x=0,s.y=0,n=!1;var d=h.originalEvent,v={position:{x:a.touch_capable?d.touches[0].pageX:h.pageX,y:a.touch_capable?d.touches[0].pageY:h.pageY},offset:{x:a.touch_capable?Math.round(d.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(h.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(d.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(h.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:h.target},w=Math.abs(t.position.x-v.position.x),_=Math.abs(t.position.y-v.position.y),T={startEvnt:t,endEvnt:v,direction:c.replace("swipe",""),xAmount:w,yAmount:_,duration:v.time-t.time};i=!0,o.trigger("swipe",T).trigger(c,T)}}),o.on(a.endevent,function r(s){var p="";if((o=e(s.currentTarget)).data("callee3",r),i){var h=o.data("xthreshold"),c=o.data("ythreshold"),u=void 0!==h&&!1!==h&&parseInt(h)?parseInt(h):a.swipe_h_threshold,f=void 0!==c&&!1!==c&&parseInt(c)?parseInt(c):a.swipe_v_threshold,l=s.originalEvent,g={position:{x:a.touch_capable?l.changedTouches[0].pageX:s.pageX,y:a.touch_capable?l.changedTouches[0].pageY:s.pageY},offset:{x:a.touch_capable?Math.round(l.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(s.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(l.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(s.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:s.target};t.position.y>g.position.y&&t.position.y-g.position.y>f&&(p="swipeup"),t.position.xu&&(p="swiperight"),t.position.yf&&(p="swipedown"),t.position.x>g.position.x&&t.position.x-g.position.x>u&&(p="swipeleft");var d=Math.abs(t.position.x-g.position.x),v=Math.abs(t.position.y-g.position.y),w={startEvnt:t,endEvnt:g,direction:p.replace("swipe",""),xAmount:d,yAmount:v,duration:g.time-t.time};o.trigger("swipeend",w)}n=!1,i=!1})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.moveevent,e(this).data.callee2).off(a.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){var t,o,n=this,i=e(n);function r(e,a){w(n,(t=a)?"scrollstart":"scrollend",e)}i.on(a.scrollevent,function e(a){i.data("callee",e),t||r(a,!0),clearTimeout(o),o=setTimeout(function(){r(a,!1)},50)})},remove:function(){e(this).off(a.scrollevent,e(this).data.callee)}};var o,n,i,r,s=e(window),p={0:!0,180:!0};if(a.orientation_support){var h=window.innerWidth||s.width(),c=window.innerHeight||s.height();i=h>c&&h-c>50,r=p[window.orientation],(i&&r||!i&&!r)&&(p={"-90":!0,90:!0})}function u(){var e=o();e!==n&&(n=e,s.trigger("orientationchange"))}e.event.special.orientationchange={setup:function(){return!a.orientation_support&&(n=o(),s.on("throttledresize",u),!0)},teardown:function(){return!a.orientation_support&&(s.off("throttledresize",u),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=o(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=o=function(){var e=document.documentElement;return(a.orientation_support?p[window.orientation]:e&&e.clientWidth/e.clientHeight<1.1)?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",d)},teardown:function(){e(this).off("resize",d)}};var f,l,g,d=function(){l=Date.now(),(g=l-v)>=250?(v=l,e(this).trigger("throttledresize")):(f&&window.clearTimeout(f),f=window.setTimeout(u,250-g))},v=0;function w(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap",taphold2:"taphold"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 29 | -------------------------------------------------------------------------------- /src/2.0.1/jquery.mobile-events.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mobile Events 3 | * by Ben Major 4 | * 5 | * Copyright 2011-2019, Ben Major 6 | * Licensed under the MIT License: 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | "use strict";!function(e){e.attrFn=e.attrFn||{};var t="ontouchstart"in window,a={tap_pixel_range:5,swipe_h_threshold:50,swipe_v_threshold:50,taphold_threshold:750,doubletap_int:500,shake_threshold:15,touch_capable:t,orientation_support:"orientation"in window&&"onorientationchange"in window,startevent:t?"touchstart":"mousedown",endevent:t?"touchend":"mouseup",moveevent:t?"touchmove":"mousemove",tapevent:t?"tap":"click",scrollevent:t?"touchmove":"scroll",hold_timer:null,tap_timer:null};e.touch={},e.isTouchCapable=function(){return a.touch_capable},e.getStartEvent=function(){return a.startevent},e.getEndEvent=function(){return a.endevent},e.getMoveEvent=function(){return a.moveevent},e.getTapEvent=function(){return a.tapevent},e.getScrollEvent=function(){return a.scrollevent},e.touch.setSwipeThresholdX=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_h_threshold=e},e.touch.setSwipeThresholdY=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.swipe_v_threshold=e},e.touch.setDoubleTapInt=function(e){if("number"!=typeof e)throw new Error("Interval parameter must be a type of number");a.doubletap_int=e},e.touch.setTapHoldThreshold=function(e){if("number"!=typeof e)throw new Error("Threshold parameter must be a type of number");a.taphold_threshold=e},e.touch.setTapRange=function(e){if("number"!=typeof e)throw new Error("Ranger parameter must be a type of number");a.tap_pixel_range=threshold},e.each(["tapstart","tapend","tapmove","tap","singletap","doubletap","taphold","swipe","swipeup","swiperight","swipedown","swipeleft","swipeend","scrollstart","scrollend","orientationchange","tap2","taphold2"],function(t,a){e.fn[a]=function(e){return e?this.on(a,e):this.trigger(a)},e.attrFn[a]=!0}),e.event.special.tapstart={setup:function(){var t=this,o=e(t);o.on(a.startevent,function e(n){if(o.data("callee",e),n.which&&1!==n.which)return!1;var i=n.originalEvent,r={position:{x:a.touch_capable?i.touches[0].pageX:n.pageX,y:a.touch_capable?i.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(i.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(n.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(i.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(n.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:n.target};return w(t,"tapstart",n,r),!0})},remove:function(){e(this).off(a.startevent,e(this).data.callee)}},e.event.special.tapmove={setup:function(){var t=this,o=e(t);o.on(a.moveevent,function e(n){o.data("callee",e);var i=n.originalEvent,r={position:{x:a.touch_capable?i.touches[0].pageX:n.pageX,y:a.touch_capable?i.touches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(i.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(n.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(i.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(n.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:n.target};return w(t,"tapmove",n,r),!0})},remove:function(){e(this).off(a.moveevent,e(this).data.callee)}},e.event.special.tapend={setup:function(){var t=this,o=e(t);o.on(a.endevent,function e(n){o.data("callee",e);var i=n.originalEvent,r={position:{x:a.touch_capable?i.changedTouches[0].pageX:n.pageX,y:a.touch_capable?i.changedTouches[0].pageY:n.pageY},offset:{x:a.touch_capable?Math.round(i.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(n.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(i.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(n.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:n.target};return w(t,"tapend",n,r),!0})},remove:function(){e(this).off(a.endevent,e(this).data.callee)}},e.event.special.taphold={setup:function(){var t,o=this,n=e(o),i={x:0,y:0},r=0,s=0;n.on(a.startevent,function e(p){if(p.which&&1!==p.which)return!1;n.data("tapheld",!1),t=p.target;var h=p.originalEvent,c=Date.now();a.touch_capable?h.touches[0].pageX:p.pageX,a.touch_capable?h.touches[0].pageY:p.pageY,a.touch_capable?(h.touches[0].pageX,h.touches[0].target.offsetLeft):p.offsetX,a.touch_capable?(h.touches[0].pageY,h.touches[0].target.offsetTop):p.offsetY;i.x=p.originalEvent.targetTouches?p.originalEvent.targetTouches[0].pageX:p.pageX,i.y=p.originalEvent.targetTouches?p.originalEvent.targetTouches[0].pageY:p.pageY,r=i.x,s=i.y;var u=n.parent().data("threshold")?n.parent().data("threshold"):n.data("threshold"),l=void 0!==u&&!1!==u&&parseInt(u)?parseInt(u):a.taphold_threshold;return n.data("hold_timer",window.setTimeout(function(){var u=i.x-r,l=i.y-s;if(p.target==t&&(i.x==r&&i.y==s||u>=-a.tap_pixel_range&&u<=a.tap_pixel_range&&l>=-a.tap_pixel_range&&l<=a.tap_pixel_range)){n.data("tapheld",!0);for(var f=Date.now()-c,g=p.originalEvent.targetTouches?p.originalEvent.targetTouches:[p],d=[],v=0;v100){i.data("doubletapped",!0),window.clearTimeout(a.tap_timer);var l={position:{x:a.touch_capable?h.originalEvent.changedTouches[0].pageX:h.pageX,y:a.touch_capable?h.originalEvent.changedTouches[0].pageY:h.pageY},offset:{x:a.touch_capable?Math.round(o.changedTouches[0].pageX-(i.offset()?i.offset().left:0)):Math.round(h.pageX-(i.offset()?i.offset().left:0)),y:a.touch_capable?Math.round(o.changedTouches[0].pageY-(i.offset()?i.offset().top:0)):Math.round(h.pageY-(i.offset()?i.offset().top:0))},time:Date.now(),target:h.target,element:h.originalEvent.srcElement,index:e(h.target).index()},f={firstTap:r,secondTap:l,interval:l.time-r.time};s||(w(n,"doubletap",h,f),r=null),s=!0,window.setTimeout(function(){s=!1},a.doubletap_int)}else i.data("lastTouch",c),t=window.setTimeout(function(){r=null,window.clearTimeout(t)},a.doubletap_int,[h]);i.data("lastTouch",c)})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.endevent,e(this).data.callee2)}},e.event.special.singletap={setup:function(){var t=this,o=e(t),n=null,i=null,r={x:0,y:0};o.on(a.startevent,function e(t){return(!t.which||1===t.which)&&(i=Date.now(),n=t.target,o.data("callee1",e),r.x=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageX:t.pageX,r.y=t.originalEvent.targetTouches?t.originalEvent.targetTouches[0].pageY:t.pageY,!0)}).on(a.endevent,function e(s){if(o.data("callee2",e),s.target==n){var p=s.originalEvent.changedTouches?s.originalEvent.changedTouches[0].pageX:s.pageX,h=s.originalEvent.changedTouches?s.originalEvent.changedTouches[0].pageY:s.pageY;a.tap_timer=window.setTimeout(function(){var e=r.x-p,n=r.y-h;if(!o.data("doubletapped")&&!o.data("tapheld")&&(r.x==p&&r.y==h||e>=-a.tap_pixel_range&&e<=a.tap_pixel_range&&n>=-a.tap_pixel_range&&n<=a.tap_pixel_range)){var c=s.originalEvent,u={position:{x:a.touch_capable?c.changedTouches[0].pageX:s.pageX,y:a.touch_capable?c.changedTouches[0].pageY:s.pageY},offset:{x:a.touch_capable?Math.round(c.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(s.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(c.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(s.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:s.target};u.time-i=-a.tap_pixel_range&&l<=a.tap_pixel_range&&f>=-a.tap_pixel_range&&f<=a.tap_pixel_range)){for(var g=h.originalEvent,d=[],v=0;vs.y&&r.y-s.y>g&&(c="swipeup"),r.xf&&(c="swiperight"),r.yg&&(c="swipedown"),r.x>s.x&&r.x-s.x>f&&(c="swipeleft"),null!=c&&n){r.x=0,r.y=0,s.x=0,s.y=0,n=!1;var d=h.originalEvent,v={position:{x:a.touch_capable?d.touches[0].pageX:h.pageX,y:a.touch_capable?d.touches[0].pageY:h.pageY},offset:{x:a.touch_capable?Math.round(d.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(h.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(d.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(h.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:h.target},w=Math.abs(t.position.x-v.position.x),_=Math.abs(t.position.y-v.position.y),T={startEvnt:t,endEvnt:v,direction:c.replace("swipe",""),xAmount:w,yAmount:_,duration:v.time-t.time};i=!0,o.trigger("swipe",T).trigger(c,T)}}),o.on(a.endevent,function r(s){var p="";if((o=e(s.currentTarget)).data("callee3",r),i){var h=o.data("xthreshold"),c=o.data("ythreshold"),u=void 0!==h&&!1!==h&&parseInt(h)?parseInt(h):a.swipe_h_threshold,l=void 0!==c&&!1!==c&&parseInt(c)?parseInt(c):a.swipe_v_threshold,f=s.originalEvent,g={position:{x:a.touch_capable?f.changedTouches[0].pageX:s.pageX,y:a.touch_capable?f.changedTouches[0].pageY:s.pageY},offset:{x:a.touch_capable?Math.round(f.changedTouches[0].pageX-(o.offset()?o.offset().left:0)):Math.round(s.pageX-(o.offset()?o.offset().left:0)),y:a.touch_capable?Math.round(f.changedTouches[0].pageY-(o.offset()?o.offset().top:0)):Math.round(s.pageY-(o.offset()?o.offset().top:0))},time:Date.now(),target:s.target};t.position.y>g.position.y&&t.position.y-g.position.y>l&&(p="swipeup"),t.position.xu&&(p="swiperight"),t.position.yl&&(p="swipedown"),t.position.x>g.position.x&&t.position.x-g.position.x>u&&(p="swipeleft");var d=Math.abs(t.position.x-g.position.x),v=Math.abs(t.position.y-g.position.y),w={startEvnt:t,endEvnt:g,direction:p.replace("swipe",""),xAmount:d,yAmount:v,duration:g.time-t.time};o.trigger("swipeend",w)}n=!1,i=!1})},remove:function(){e(this).off(a.startevent,e(this).data.callee1).off(a.moveevent,e(this).data.callee2).off(a.endevent,e(this).data.callee3)}},e.event.special.scrollstart={setup:function(){var t,o,n=this,i=e(n);function r(e,a){w(n,(t=a)?"scrollstart":"scrollend",e)}i.on(a.scrollevent,function e(a){i.data("callee",e),t||r(a,!0),clearTimeout(o),o=setTimeout(function(){r(a,!1)},50)})},remove:function(){e(this).off(a.scrollevent,e(this).data.callee)}};var o,n,i,r,s=e(window),p={0:!0,180:!0};if(a.orientation_support){var h=window.innerWidth||s.width(),c=window.innerHeight||s.height();i=h>c&&h-c>50,r=p[window.orientation],(i&&r||!i&&!r)&&(p={"-90":!0,90:!0})}function u(){var e=o();e!==n&&(n=e,s.trigger("orientationchange"))}e.event.special.orientationchange={setup:function(){return!a.orientation_support&&(n=o(),s.on("throttledresize",u),!0)},teardown:function(){return!a.orientation_support&&(s.off("throttledresize",u),!0)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=o(),t.apply(this,arguments)}}},e.event.special.orientationchange.orientation=o=function(){var e=document.documentElement;return(a.orientation_support?p[window.orientation]:e&&e.clientWidth/e.clientHeight<1.1)?"portrait":"landscape"},e.event.special.throttledresize={setup:function(){e(this).on("resize",d)},teardown:function(){e(this).off("resize",d)}};var l,f,g,d=function(){f=Date.now(),(g=f-v)>=250?(v=f,e(this).trigger("throttledresize")):(l&&window.clearTimeout(l),l=window.setTimeout(u,250-g))},v=0;function w(t,a,o,n){var i=o.type;o.type=a,e.event.dispatch.call(t,o,n),o.type=i}e.each({scrollend:"scrollstart",swipeup:"swipe",swiperight:"swipe",swipedown:"swipe",swipeleft:"swipe",swipeend:"swipe",tap2:"tap",taphold2:"taphold"},function(t,a){e.event.special[t]={setup:function(){e(this).on(a,e.noop)}}})}(jQuery); 28 | --------------------------------------------------------------------------------