| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/plugins/eltd-core/shortcodes/countdown/assets/js/ |
Upload File : |
(function($) {
'use strict';
var countdown = {};
eltd.modules.countdown = countdown;
countdown.eltdInitCountdown = eltdInitCountdown;
countdown.eltdOnDocumentReady = eltdOnDocumentReady;
$(document).ready(eltdOnDocumentReady);
/*
All functions to be called on $(document).ready() should be in this function
*/
function eltdOnDocumentReady() {
eltdInitCountdown();
}
/**
* Countdown Shortcode
*/
function eltdInitCountdown() {
var countdowns = $('.eltd-countdown'),
date = new Date(),
currentMonth = date.getMonth(),
currentYear = date.getFullYear(),
year,
month,
day,
hour,
minute,
timezone,
monthLabel,
dayLabel,
hourLabel,
minuteLabel,
secondLabel;
if (countdowns.length) {
countdowns.each(function(){
//Find countdown elements by id-s
var countdownId = $(this).attr('id'),
countdown = $('#'+countdownId),
digitFontSize,
labelFontSize;
//Get data for countdown
year = countdown.data('year');
month = countdown.data('month');
day = countdown.data('day');
hour = countdown.data('hour');
minute = countdown.data('minute');
timezone = countdown.data('timezone');
monthLabel = countdown.data('month-label');
dayLabel = countdown.data('day-label');
hourLabel = countdown.data('hour-label');
minuteLabel = countdown.data('minute-label');
secondLabel = countdown.data('second-label');
digitFontSize = countdown.data('digit-size');
labelFontSize = countdown.data('label-size');
if( currentMonth != month || currentYear !== year) {
month = month - 1;
}
//Initialize countdown
countdown.countdown({
until: new Date(year, month, day, hour, minute, 44),
labels: ['', monthLabel, '', dayLabel, hourLabel, minuteLabel, secondLabel],
format: 'DHMS',
timezone: timezone,
padZeroes: true,
onTick: setCountdownStyle
});
function setCountdownStyle() {
countdown.find('.countdown-amount').css({
'font-size' : digitFontSize+'px',
'line-height' : digitFontSize+'px'
});
countdown.find('.countdown-period').css({
'font-size' : labelFontSize+'px'
});
}
});
}
}
})(jQuery);