1"use strict"; 2(function ($) { 3 jQuery(document).ready(function ($) { 4 // Time calculations for days, hours, minutes and seconds 5 const get_countdown_text_from_time = (time) => { 6 var days = Math.floor(time / (1000 * 60 * 60 * 24)); 7 var hours = Math.floor((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 8 var minutes = Math.floor((time % (1000 * 60 * 60)) / (1000 * 60)); 9 var seconds = Math.floor((time % (1000 * 60)) / 1000); 10 let countdown_text = 11 days > 0 12 ? `<span class="yaydp-timer-group"><span class="yaydp-timer-number">${ 13 days < 10 ? "0" + days : days 14 }</span> <span class="yaydp-timer-label">${ 15 window.yaydp_frontend_data.i18n.days ?? "days" 16 }</span></span>` 17 : ""; 18 countdown_text += 19 days > 0 ? `<span class="yaydp-timer-space-group">:</span>` : ""; 20 countdown_text += 21 hours > 0 22 ? `<span class="yaydp-timer-group"><span class="yaydp-timer-number">${ 23 hours < 10 ? "0" + hours : hours 24 }</span> <span class="yaydp-timer-label"> ${ 25 window.yaydp_frontend_data.i18n.hours ?? "hours" 26 } </span></span>` 27 : ""; 28 countdown_text += 29 hours > 0 ? `<span class="yaydp-timer-space-group">:</span>` : ""; 30 countdown_text += 31 hours > 0 || minutes > 0 32 ? `<span class="yaydp-timer-group"><span class="yaydp-timer-number">${ 33 minutes < 10 ? "0" + minutes : minutes 34 }</span> <span class="yaydp-timer-label"> ${ 35 window.yaydp_frontend_data.i18n.minutes ?? "mins" 36 } </span></span>` 37 : ""; 38 countdown_text += 39 hours > 0 || minutes > 0 40 ? `<span class="yaydp-timer-space-group">:</span>` 41 : " "; 42 countdown_text += `<span class="yaydp-timer-group"><span class="yaydp-timer-number">${ 43 seconds < 10 ? "0" + seconds : seconds 44 }</span> <span class="yaydp-timer-label"> ${ 45 window.yaydp_frontend_data.i18n.seconds ?? "secs" 46 } </span></span>`; 47 return countdown_text; 48 }; 49 50 const renderCountdown = (element) => { 51 var time = element.attr("data-timer").replace("Z", ""); 52 53 var countDownDate = new Date( 54 time + window.yaydp_countdown_data.timezone_string 55 ).getTime(); 56 57 var initial_time = new Date().getTime(); 58 59 // Calculate the time left between now and the count down date 60 var time_left = countDownDate - initial_time; 61 62 element.html(get_countdown_text_from_time(time_left)); 63 64 // Update the count down every 1 second 65 var CountdownFunc = setInterval(function () { 66 // Get today's date and time 67 var now = new Date().getTime(); 68 69 time_left = countDownDate - now; 70 71 element.html(get_countdown_text_from_time(time_left)); 72 73 // If the count down is over, write some text 74 if (time_left <= 1000) { 75 clearInterval(CountdownFunc); 76 // element.parent().parent().remove(); 77 } 78 }, 1000); 79 }; 80 81 $(".yaydp-event-wrapper .yaydp-event-countdown").each(function () { 82 renderCountdown($(this)); 83 }); 84 }); 85})(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.