-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpqtouch.min.js
8 lines (8 loc) · 1.33 KB
/
pqtouch.min.js
1
2
3
4
5
6
7
8
/*!
* ParamQuery Touch v1.0.1
*
* Copyright (c) 2012-2021 Paramvir Dhindsa (http://paramquery.com)
* Released under MIT license
*
*/
if("function"==typeof require)var jQuery=require("jquery-ui-pack");else var jQuery=window.jQuery;!function(e){function t(e,t,n,o){var u=document.createEvent("MouseEvents");return u.initMouseEvent(e,!0,!0,window,0,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,o),n.dispatchEvent(u),u}function n(e){if(1==e.touches.length){var n,r=e.changedTouches[0],i=e.target;t("mouseover",r,i),t("mousemove",r,i),n=t("mousedown",r,i),n.defaultPrevented&&(i.addEventListener("touchmove",o),i.addEventListener("touchend",u))}}function o(e){var n=e.changedTouches[0],o=document.elementFromPoint(n.clientX,n.clientY);o&&(r?o&&r!==o&&(t("mouseover",n,o,r),t("mouseout",n,r,o),r=o):r=o,e.preventDefault(),t("mousemove",n,o))}function u(e){var n=e.changedTouches[0],r=document.elementFromPoint(n.clientX,n.clientY),i=e.target;t("mouseup",n,r),t("mouseout",n,r),i.removeEventListener("touchmove",o),i.removeEventListener("touchend",u)}if("ontouchstart"in window){var r,i=e.ui.mouse.prototype,s=i._mouseInit,c=i._mouseDestroy;i._mouseInit=function(){this.element[0].addEventListener("touchstart",n),s.apply(this,arguments)},i._mouseDestroy=function(){this.element[0].removeEventListener("touchstart",n),c.apply(this,arguments)}}}(jQuery);