1 2/* global momocountdown */ 3var triggerSlider = (options) => { 4 var $block = jQuery('body').find( '#' + options.blockId + ' .tec-slider-list'); 5 if ($block.length > 0) { 6 if ($block.hasClass('slick-initialized')) { 7 return; 8 } 9 var speed = $block.data('speed'); 10 var slidesToShow = $block.data('slides'); 11 var theme = $block.data('theme'); 12 var autoPlay = $block.data('auto'); 13 var color = $block.data('color'); 14 var id = $block.data('id'); 15 var count = $block.data('count'); 16 var dots = $block.data('dots'); 17 if ( count > 0) { 18 $block.slick({ 19 dots: dots, 20 infinite: true, 21 speed: speed, 22 slidesToShow: slidesToShow, 23 adaptiveHeight: true, 24 autoplay: autoPlay, 25 responsive: [ 26 { 27 breakpoint: 1024, 28 settings: { 29 slidesToShow: slidesToShow > 3 ? 3 : slidesToShow, 30 infinite: true, 31 dots: dots, 32 } 33 }, 34 { 35 breakpoint: 600, 36 settings: { 37 slidesToShow: slidesToShow > 2 ? 2 : slidesToShow, 38 infinite: true, 39 dots: dots, 40 } 41 }, 42 { 43 breakpoint: 480, 44 settings: { 45 slidesToShow: 1, 46 slidesToScroll: 1, 47 infinite: true, 48 dots: dots, 49 } 50 } 51 ] 52 }); 53 console.log('*** Running TecSlider Block****'); 54 fixHeightOfAll( '#' + options.blockId + ' .tec-slider-list'); 55 } 56 var $countdown = jQuery('body').find( '#' + options.blockId + ' .contdown-data-holder'); 57 var countdownsJson = $countdown.data('countdown'); 58 59 if (countdownsJson === undefined || countdownsJson === null) { 60 console.log('No countdowns found'); 61 } else if (typeof countdownsJson === 'object') { 62 // It's already a JavaScript object 63 var countdowns = countdownsJson; 64 for (const countdown of countdownsJson) { 65 enableAndUpdateCountdown( countdown.start, countdown.end, countdown.id, countdown.tmz ); 66 } 67 console.log('Its already a JavaScript object'); 68 } else if (typeof countdownsJson === 'string') { 69 // It's a JSON string, so parse it 70 var countdowns = JSON.parse(countdownsJson); 71 for (const countdown of countdowns) { 72 enableAndUpdateCountdown( countdown.start, countdown.end, countdown.id, countdown.tmz ); 73 } 74 console.log('Its json string'); 75 } else { 76 console.log('Unknown data format'); 77 } 78 } 79}; 80function fixHeightOfAll(ul) { 81 var $ul = $(ul); 82 83 // Get the maximum height of .tec-sse-details elements within this ul 84 var maxHeight = 0; 85 $ul.find('.tec-sse-details').each(function() { 86 var height = $(this).outerHeight(); 87 if (height > maxHeight) { 88 maxHeight = height; 89 } 90 }); 91 // Set the maximum height to all .tec-sse-details elements within this ul 92 $ul.find('.tec-sse-details').css('height', maxHeight + 'px'); 93 94 maxHeight = 0; 95 $ul.find('.image-middle-top').each(function() { 96 var height = $(this).outerHeight(); 97 if (height > maxHeight) { 98 maxHeight = height; 99 } 100 }); 101 $ul.find('.image-middle-top').css('height', maxHeight + 'px'); 102 103 maxHeight = 0; 104 $ul.find('.image-middle-bottom').each(function() { 105 var height = $(this).outerHeight(); 106 if (height > maxHeight) { 107 maxHeight = height; 108 } 109 }); 110 $ul.find('.image-middle-bottom').css('height', maxHeight + 'px'); 111 112 $ul.find('.hover-flip-info').each(function() { 113 var height = $(this).outerHeight(); 114 if (height > maxHeight) { 115 maxHeight = height; 116 } 117 }); 118 $ul.find('.hover-flip-info').css('height', maxHeight + 'px'); 119} 120// Function to calculate and display the countdown timer 121function enableAndUpdateCountdown(eventStartDate, eventEndDate, countdownElementId, etmz = null) {
122 let countdownInterval; 123 function updateCountdown() { 124 const eventTimezone = etmz !== null ? etmz : momocountdown.tmz; 125 const timeZoneOptions = { timeZone: eventTimezone }; 126 const nowtz = new Date().toLocaleString('en-US', timeZoneOptions); 127 const now = new Date(nowtz).getTime(); 128 const eventStartDateTime = new Date(eventStartDate).getTime(); 129 const eventEndDateTime = new Date(eventEndDate).getTime(); 130 const countdownElement = jQuery( '[data-id="' + countdownElementId + '"]').find('.tec-countdown'); 131 const info = countdownElement.find('.cd-info'); 132 const datetime = countdownElement.find('.cd-datetime'); 133 if (now < eventStartDateTime) { 134 // Event has not started yet 135 const timeLeft = eventStartDateTime - now; 136 const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24)); 137 const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 138 const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60)); 139 const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000); 140 info.html(momocountdown.start); 141 var html = ''; 142 html += ('off' === momocountdown.rmday) ? `${days}<span class="dhms">${momocountdown.dhmsd}</span> ` : ''; 143 html += ('off' === momocountdown.rmhrs) ? `${hours}<span class="dhms">${momocountdown.dhmsh}</span> ` : ''; 144 html += ('off' === momocountdown.rmmin) ? `${minutes}<span class="dhms">${momocountdown.dhmsm}</span> ` : ''; 145 html += ('off' === momocountdown.rmsec) ? `${seconds}<span class="dhms">${momocountdown.dhmss}</span> ` : ''; 146 /* var html = `${days}<span class="dhms">${momocountdown.dhmsd}</span> ${hours}<span class="dhms">${momocountdown.dhmsh}</span> ${minutes}<span class="dhms">${momocountdown.dhmsm}</span> ${seconds}<span class="dhms">${momocountdown.dhmss}</span>`; */ 147 datetime.html(html); 148 } else if (now < eventEndDateTime) { 149 // Event has started and is still running 150 const timeLeft = eventEndDateTime - now; 151 const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24)); 152 const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 153 const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60)); 154 const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000); 155 156 info.html(momocountdown.endsin); 157 var html = ''; 158 html += ('off' === momocountdown.rmday) ? `${days}<span class="dhms">${momocountdown.dhmsd}</span> ` : ''; 159 html += ('off' === momocountdown.rmhrs) ? `${hours}<span class="dhms">${momocountdown.dhmsh}</span> ` : ''; 160 html += ('off' === momocountdown.rmmin) ? `${minutes}<span class="dhms">${momocountdown.dhmsm}</span> ` : ''; 161 html += ('off' === momocountdown.rmsec) ? `${seconds}<span class="dhms">${momocountdown.dhmss}</span> ` : ''; 162 /* datetime.html(`${days}<span class="dhms">${momocountdown.dhmsd}</span> ${hours}<span class="dhms">${momocountdown.dhmsh}</span> ${minutes}<span class="dhms">${momocountdown.dhmsm}</span> ${seconds}<span class="dhms">${momocountdown.dhmss}</span>`); */ 163 datetime.html(html); 164 } else { 165 // Event has ended 166 info.html(momocountdown.end); 167 clearInterval(countdownInterval); // Stop updating the countdown 168 } 169 } 170 171 // Initial call to update the countdown 172 updateCountdown(); 173 174 // Update the countdown every second 175 countdownInterval = setInterval(updateCountdown, 1000); 176 console.log('***Countdown Timer Started***'); 177 // Return a function to clear the interval when needed 178 return function () { 179 clearInterval(countdownInterval); 180 }; 181}
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.