From 717b037dc4fdfd8053a9740494a79a9c491de91c Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Sun, 10 Nov 2013 03:38:22 +0000 Subject: [PATCH] add jQuery ui touch-punch for draggable support on mobile devices. Thanks to Dave Furfero. --- Makefile.am | 1 + assets/html/layout.html | 1 + assets/js/jquery.ui.touch-punch.min.js | 11 +++++++++++ 3 files changed, 13 insertions(+) create mode 100644 assets/js/jquery.ui.touch-punch.min.js diff --git a/Makefile.am b/Makefile.am index 0d0ef6e..7385b7e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,7 @@ nobase_trdata_DATA = assets/html/example.html \ assets/image/rambler-logo2-small.jpg \ assets/js/jquery.js \ assets/js/jquery-ui.js \ + assets/js/jquery.ui.touch-punch.min.js \ assets/js/serverval.js \ assets/js/session.js \ assets/js/init.js \ diff --git a/assets/html/layout.html b/assets/html/layout.html index 7c02496..824b7cc 100644 --- a/assets/html/layout.html +++ b/assets/html/layout.html @@ -11,6 +11,7 @@ + diff --git a/assets/js/jquery.ui.touch-punch.min.js b/assets/js/jquery.ui.touch-punch.min.js new file mode 100644 index 0000000..33d6f97 --- /dev/null +++ b/assets/js/jquery.ui.touch-punch.min.js @@ -0,0 +1,11 @@ +/* + * jQuery UI Touch Punch 0.2.2 + * + * Copyright 2011, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery); \ No newline at end of file