1var counter = setInterval(countdownTimer, 1000); // 1000 will run the method every second 2var globalSeconds = null; // Global seconds counter so we don't have to keep parsing the HTML element 3 4function countdownTimer() { 5 try { 6 var currentCounterValueElement = document.getElementById("countdownClockTimer"); 7 8 // Safety check in case the element in not on the page this JS file is included in 9 if(currentCounterValueElement == null) { 10 clearInterval(counter); 11 return; 12 } 13 14 if(globalSeconds == null) { 15 setGlobalSeconds(currentCounterValueElement); 16 } 17 18 // If the count down is finished, remove the call to this method which occurs every second 19 if(globalSeconds == 0) { 20 clearInterval(counter); 21 return; 22 } 23 24 globalSeconds = globalSeconds - 1; 25 var newHours = Math.floor(globalSeconds / 3600); 26 var newMinutes = Math.floor((globalSeconds - (newHours * 3600)) / 60); 27 var newSeconds = globalSeconds - (newMinutes * 60) - (newHours * 3600); 28 29 var formattedHours = ((newHours < 10 && newHours >=0) ? ("0" + newHours) : newHours); 30 var formattedMinutes = ((newMinutes < 10 && newMinutes >=0) ? ("0" + newMinutes) : newMinutes); 31 var formattedSeconds = ((newSeconds < 10 && newSeconds >=0) ? ("0" + newSeconds) : newSeconds); 32 33 currentCounterValueElement.innerHTML = ((newHours > 0) ? formattedHours + ":" : "") + formattedMinutes + ":" + formattedSeconds; 34 } catch(err) { 35 clearInterval(counter); 36 return; 37 } 38} 39 40function setGlobalSeconds(currentCounterValueElement) { 41 var counterComponents = currentCounterValueElement.innerHTML.split(":"); 42 if(counterComponents.length == 2) { 43 // minutes and seconds 44 var minute = parseInt(counterComponents[0]); 45 globalSeconds = parseInt(counterComponents[1]) + (parseInt(minute) * 60); 46 } else if (counterComponents.length == 3) { 47 // hours, minutes and seconds 48 var hour = parseInt(counterComponents[0]); 49 var minute = parseInt(counterComponents[1]); 50 globalSeconds = parseInt(counterComponents[2]) + (parseInt(minute) * 60) + (parseInt(hour) * 3600); 51 } 52}
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.