1/* global jQuery */ 2jQuery(document).ready(function ($) { 3 $('.adp-advertising-timer').each(function () { 4 var self = $(this) 5 var timestamp = +$(this).data('timestamp'); 6 if (timestamp <= 0) { 7 return true; 8 } 9 showTimer(self) 10 setInterval(() => showTimer(self), 1000); 11 }) 12 13 function showTimer(timer) { 14 15 var timestamp = +timer.data('timestamp') 16 var currentTimestamp = (new Date()).getTime() / 1000 17 var diffTimestamp = timestamp - currentTimestamp 18 19 var days = parseInt(diffTimestamp / (3600 * 24)) 20 21 var hours = parseInt(diffTimestamp / 3600) 22 var minutes = parseInt((diffTimestamp - hours * 3600) / 60) 23 var seconds = parseInt(diffTimestamp - hours * 3600 - minutes * 60) 24 25 var timerContent = ''; 26 27 if (hours >= 12) { 28 timerContent = days > 1 ? days + ' ' + wdp_advertising_timer_script_data.days_left : ((days ? days : 1) + ' ' + wdp_advertising_timer_script_data.day_left) 29 } else { 30 timerContent = (hours > 9 ? hours : '0' + hours) + ':' + (minutes > 9 ? minutes : '0' + minutes) 31 } 32 33 if (!hours && minutes < 10) { 34 timerContent += ':' + (seconds > 9 ? seconds : '0' + seconds) 35 } 36 37 if (hours < 12) { 38 timerContent += ' ' + wdp_advertising_timer_script_data.left 39 } 40 41 if (timerContent) { 42 timer.html(timerContent) 43 } 44 } 45})
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.