1(function($) { 2 $.widget('blcms.smartTimer', { 3 options: { 4 autoplay: true, 5 6 periodic: true, 7 bypass: false, 8 9 delay: 1000, 10 11 hoverpause: false, 12 13 onTimer: null 14 }, 15 16 timer: null, 17 playing: false, 18 hover: false, 19 20 _create: function() { 21 var This=this; 22 23 This.element.hover( 24 function() { 25 if (This.options.hoverpause && This.playing) { 26 This.hover=true; 27 This.stop(); 28 } 29 }, 30 31 function() { 32 if (This.options.hoverpause && This.hover) { 33 This.hover=false; 34 This.play(); 35 } 36 } 37 ); 38 39 if (This.options.autoplay) 40 This.play(); 41 42 if (!This.options.bypass) 43 This._handle(); 44 }, 45 46 _handle: function() { 47 var This=this; 48 49 if (This.playing && This.options.onTimer) { 50 This._trigger('onTimer'); 51 } 52 }, 53 54 stop: function() { 55 var This=this; 56 57 if (This.playing && This.timer) { 58 window.clearInterval(This.timer); 59 This.timer=null 60 } 61 62 This.playing=false; 63 }, 64 65 play: function() { 66 var This=this; 67 68 if (!This.playing) { 69 if (This.options.periodic) { 70 This.timer=window.setInterval($.proxy(This._handle, This), This.options.delay); 71 } else { 72 This.timer=window.setTimeout($.proxy(This._handle, This), This.options.delay); 73 } 74 75 This.playing=true; 76 } 77 } 78 }); 79})(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.