1( function( $ ) { 2 /** 3 * @param $scope The Widget wrapper element as a jQuery element 4 * @param $ The jQuery alias 5 */ 6 var WidgetCTCountDownHandler = function( $scope, $ ) { 7 8 $('.ct-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 _this.html('' 29 + '<div class="countdown-item"><div class="countdown-item-inner"><div class="countdown-amount">' + days + '</div><div class="countdown-period">' + text_day + '</div></div><div class="space-dots"></div></div>' 30 + '<div class="countdown-item"><div class="countdown-item-inner"><div class="countdown-amount">' + hours + '</div><div class="countdown-period">' + text_hour + '</div></div><div class="space-dots"></div></div>' 31 + '<div class="countdown-item"><div class="countdown-item-inner"><div class="countdown-amount">' + minutes + '</div><div class="countdown-period">' + text_minu + '</div></div><div class="space-dots"></div></div>' 32 + '<div class="countdown-item"><div class="countdown-item-inner"><div class="countdown-amount">' + seconds + '</div><div class="countdown-period">' + text_second + '</div></div></div>' 33 ); 34 }, 100); 35 }); 36 37 }; 38 39 // Make sure you run this code under Elementor. 40 $( window ).on( 'elementor/frontend/init', function() { 41 elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_countdown.default', WidgetCTCountDownHandler ); 42 } ); 43} )( 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.