(function(e){e.fn.longpress=function(t,n,r){if(typeof r==="undefined"){r=500}return this.each(function(){function u(n){s=(new Date).getTime();var i=e(this);o=setTimeout(function(){if(typeof t==="function"){t.call(i,n)}else{e.error("Callback required for long press. You provided: "+typeof t)}},r)}function a(t){var i=(new Date).getTime()-s;if(i<r){clearTimeout(o);if(typeof n==="function"){n.call(e(this),t)}else if(typeof n==="undefined"){}else{e.error("Optional callback for short press should be a function.")}}}var i=e(this);var s;var o;i.on("mousedown",u);i.on("mouseup",a);i.on("touchstart",u);i.on("touchend",a)})}})(jQuery)