/*! * jQuery UI Touch Punch 0.2.3w - WPXP Edition (dl'ed 2015-09-25 by sfa. Fixes problems with closing dialog boxes in android and drag and drop in android) * * Copyright 2011–2014, Dave Furfero * Dual licensed under the MIT or GPL Version 2 licenses. * WPXP Edition - by Manuel Gumpinger * * Depends: * jquery.ui.widget.js * jquery.ui.mouse.js */ (function(c){c.support.touch="ontouchend" in document;if(!c.support.touch){return}var b=c.ui.mouse.prototype,f=b._mouseInit,g=b._mouseDestroy,e,d,i,h;function a(k,l){if(k.originalEvent.touches.length>1){return}k.preventDefault();var m=k.originalEvent.changedTouches[0],j=document.createEvent("MouseEvents");j.initMouseEvent(l,true,true,window,1,m.screenX,m.screenY,m.clientX,m.clientY,false,false,false,false,0,null);k.target.dispatchEvent(j)}b._touchStart=function(k){var j=this;if(i||!j._mouseCapture(k.originalEvent.changedTouches[0])){return}i=true;h=false;e=k.originalEvent.touches[0].screenX;d=k.originalEvent.touches[0].screenY;a(k,"mouseover");a(k,"mousemove");a(k,"mousedown")};b._touchMove=function(l){if(!i){return}var k=l.originalEvent.touches[0].screenX,j=l.originalEvent.touches[0].screenY;if(e>=k-2&&e<=k+2&&d>=j-2&&d<=j+2){h=false;return}h=true;a(l,"mousemove")};b._touchEnd=function(j){if(!i){return}a(j,"mouseup");a(j,"mouseout");if(!h){a(j,"click")}i=false};b._mouseInit=function(){var j=this;j.element.bind({touchstart:c.proxy(j,"_touchStart"),touchmove:c.proxy(j,"_touchMove"),touchend:c.proxy(j,"_touchEnd")});f.call(j)};b._mouseDestroy=function(){var j=this;j.element.unbind({touchstart:c.proxy(j,"_touchStart"),touchmove:c.proxy(j,"_touchMove"),touchend:c.proxy(j,"_touchEnd")});g.call(j)}})(jQuery);