1//(function($){ 2 $ = jQuery; 3 // Collection of timers for this page. 4 var timers = new Array(); 5 6 // Actual timer code, which wakes up every second and updates all the timers on the page. 7 function updateTimers() { 8 var i; 9 for( i = 0; i < timers.length; i++ ) { 10 updateTimer( timers[ i ] ); 11 } 12 window.setTimeout(updateTimers, 1000); 13 } 14 15 // Utility function for adding zero padding. 16 function zeroPad( n ) { 17 n = parseInt( n ); 18 if ( n < 10 ) { 19 return '0' + n; 20 } else { 21 return n; 22 } 23 } 24 25 // Creates a new timer object. 26 function Timer( id, seconds, format, complete ) { 27 this.id = id; 28 this.seconds = seconds; 29 this.format = format; 30 this.complete = complete; 31 } 32 33 // Decrements a given timer object and renders it in the 34 // appropriate div. 35 function updateTimer( t ) { 36 var output = t.complete; 37 t.seconds -= 1; 38 if ( t.seconds > 0 ) { 39 var days = zeroPad( ( t.seconds ) / ( 60*60*24 ) ); 40 var hours = zeroPad( ( t.seconds % ( 60*60*24 ) / (60*60))); 41 var minutes = zeroPad( ( t.seconds % ( 60*60 ) )/( 60 ) ); 42 var seconds = zeroPad( ( t.seconds % 60 ) ); 43 output = t.format.replace( 'DD', days ).replace( 'HH', hours ).replace( 'MM', minutes ).replace('SS', seconds ); 44 } 45 //console.log("#" + t.id); 46 $( "#" + t.id ).html( output ); 47 } 48 49 //$(document).ready(function() { 50 // Find all countdown timer divs, create a timer object for each 51 // one and kick off the timers. 52 var countdown_timers = $( '.tribe-countdown-timer' ); 53 if ( $( countdown_timers ).length > 0 ) { 54 $(countdown_timers).each( function( index, value ) { 55 var unique_id = 'tribe-countdown-' + Math.floor( Math.random()*99999 ); 56 var seconds = $(value).find( 'span.tribe-countdown-seconds' ).text(); 57 var format = $(value).find( 'span.tribe-countdown-format' ).html(); 58 var complete = $( 'h3.tribe-countdown-complete' ).show(); 59 60 // Wrap the timer in a span with a unique id so we can refer to it 61 // in the timer update code. 62 //$(value).wrap( '<span class="tribe-countdown-time" id=' + unique_id + '/>' ); //STOP this. 63 $( value ).wrap( $( '<div>' ).attr( 'id', unique_id ).addClass( 'tribe-countdown-time' ) ); //WPB-4282 64 65 timers.push( new Timer( unique_id, seconds, format, complete ) ); 66 67 // Kick off first update if we're at the end. 68 if ( index == countdown_timers.length - 1 ) { 69 updateTimers(); 70 } 71 }); 72 } 73 //}); 74 75//})(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.