1/*! 2 * jQuery Double Tap Plugin. 3 * 4 * Copyright (c) 2010 Raul Sanchez (http://www.appcropolis.com) 5 * 6 * Dual licensed under the MIT and GPL licenses: 7 * http://www.opensource.org/licenses/mit-license.php 8 * http://www.gnu.org/licenses/gpl.html 9 */ 10 11(function($){ 12 // Determine if we on iPhone or iPad 13 var isiOS = false; 14 var agent = navigator.userAgent.toLowerCase(); 15 if(agent.indexOf('iphone') >= 0 || agent.indexOf('ipad') >= 0){ 16 isiOS = true; 17 } 18 19 $.fn.doubletap = function(onDoubleTapCallback, delay,onTapCallback){ 20 var eventName, action; 21 delay = delay == null? 500 : delay; 22 eventName = isiOS == true? 'touchend' : 'click'; 23 24 $(this).bind(eventName, function(event){ 25 var now = new Date().getTime(); 26 var lastTouch = $(this).data('lastTouch') || now + 1 /** the first time this will make delta a negative number */; 27 var delta = now - lastTouch; 28 clearTimeout(action); 29 if(delta<500 && delta>0){ 30 if(onDoubleTapCallback != null && typeof onDoubleTapCallback == 'function'){ 31 onDoubleTapCallback(event); 32 } 33 }else{ 34 $(this).data('lastTouch', now); 35 action = setTimeout(function(evt){ 36 if(onTapCallback != null && typeof onTapCallback == 'function'){ 37 onTapCallback(evt); 38 } 39 clearTimeout(action); // clear the timeout 40 }, delay, [event]); 41 } 42 $(this).data('lastTouch', now); 43 }); 44 }; 45})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.