1( function( $ ) { 2 /** 3 * @param $scope The Widget wrapper element as a jQuery element 4 * @param $ The jQuery alias 5 */ 6 var PXLCountdownBarHandler = function( $scope, $ ) { 7 8 $('.pxl-countdown').each(function () { 9 var _this = $(this); 10 var count_down = $(this).find('> div').data("count-down"); 11 setInterval(function () { 12 var startDateTime = new Date().getTime(); 13 var endDateTime = new Date(count_down).getTime(); 14 var distance = endDateTime - startDateTime; 15 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 16 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 17 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 18 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 19 var text_day = days !== 1 ? _this.attr('data-days') : _this.attr('data-day'); 20 var text_hour = hours !== 1 ? _this.attr('data-hours') : _this.attr('data-hour'); 21 var text_minu = minutes !== 1 ? _this.attr('data-minutes') : _this.attr('data-minute'); 22 var text_second = seconds !== 1 ? _this.attr('data-seconds') : _this.attr('data-second'); 23 days = days < 10 ? '0' + days : days; 24 hours = hours < 10 ? '0' + hours : hours; 25 minutes = minutes < 10 ? '0' + minutes : minutes; 26 seconds = seconds < 10 ? '0' + seconds : seconds; 27 28 var arrDays = []; 29 var daysString = days.toString(); 30 for (var i = 0; i < daysString.length; i++) { 31 arrDays.push('<span>' + daysString[i] + '</span>'); 32 } 33 34 var arrHours = []; 35 var hoursString = hours.toString(); 36 for (var i = 0; i < hoursString.length; i++) { 37 arrHours.push('<span>' + hoursString[i] + '</span>'); 38 } 39 40 var arrMinutes = []; 41 var minutesString = minutes.toString(); 42 for (var i = 0; i < minutesString.length; i++) { 43 arrMinutes.push('<span>' + minutesString[i] + '</span>'); 44 } 45 46 var arrSeconds = []; 47 var secondsString = seconds.toString(); 48 for (var i = 0; i < secondsString.length; i++) { 49 arrSeconds.push('<span>' + secondsString[i] + '</span>'); 50 } 51 52 _this.html('' 53 + '<div class="countdown-item countdown-day"><div class="countdown-item-inner"><div class="countdown-amount">' + arrDays.join() + ' </div><div class="countdown-period">' + text_day + '</div></div></div>' 54 + '<div class="countdown-item countdown-hour"><div class="countdown-item-inner"><div class="countdown-amount">' + arrHours.join() + '</div><div class="countdown-period">' + text_hour + '</div></div></div>' 55 + '<div class="countdown-item countdown-minute"><div class="countdown-item-inner"><div class="countdown-amount">' + arrMinutes.join() + '</div><div class="countdown-period">' + text_minu + '</div></div></div>' 56 + '<div class="countdown-item countdown-second"><div class="countdown-item-inner"><div class="countdown-amount">' + arrSeconds.join() + '</div><div class="countdown-period">' + text_second + '</div></div></div>' 57 ); 58 }, 100); 59 }); 60 }; 61 62 // Make sure you run this code under Elementor. 63 $( window ).on( 'elementor/frontend/init', function() { 64 elementorFrontend.hooks.addAction( 'frontend/element_ready/pxl_countdown.default', PXLCountdownBarHandler ); 65 } ); 66} )( 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.