praiadeseselle/wire/modules/Jquery/JqueryCore/jquery.longclick.min.js

15 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-03-10 19:41:40 +01:00
/**
* jQuery Longclick Event
* ======================
* Press & hold mouse button "long click" special event for jQuery 1.4.x
*
* @license Longclick Event
* Copyright (c) 2014 Pascal GANAYE
* Largely based from from a work Petr Vostrel (http://petr.vostrel.cz/)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Version: 0.4.0
* Updated: 2014-10-13
*/
!function(t){function n(n){return t.each("touchstart touchend touchcancel".split(/ /),function(i,e){n.addEventListener(e,function(i){t(n).trigger(e)},!1)}),t(n)}function i(n){if(!t(this).data(b)){var i=this,e=arguments;t(this).data(m,!1).data(b,setTimeout(function(){t(i).data(m,!0).data(b,null),n.type=o,(jQuery.event.dispatch||jQuery.event.handle).apply(i,e)},t(this).data(g)||t.longclick.duration))}}function e(n){var i=t(this).data(b);i&&t(this).data(b,clearTimeout(i)||null)}function a(n){if(t(this).data(m))return n.stopImmediatePropagation()||!1}t.fn.longclick=function(){var n=arguments[0],i=arguments[1],e=t(this).data(g,i||null);return n?e.bind(o,n):e.trigger(o)},t.longclick={duration:600},t.event.special.longclick={setup:function(o,c){/iphone|ipad|ipod/i.test(navigator.userAgent)?n(this).bind(h,i).bind([f,p].join(" "),e).bind(d,a).css({WebkitUserSelect:"none"}):t(this).bind(u,i).bind([r,s,l].join(" "),e).bind(d,a)},teardown:function(n){t(this).unbind(c)}};var o="longclick",c="."+o,u="mousedown"+c,d="click"+c,r="mouseup"+c,s="mouseout"+c,l="contextmenu"+c,h="touchstart"+c,f="touchend"+c,p="touchcancel"+c,g="duration"+c,b="timer"+c,m="fired"+c}(jQuery);