/* min: 1439 */
/* timer: Array
(
[days] => 0
[hours] => 23
[minutes] => 59
[secs] => 0
)
*/
/* insert res2: 21099 */
/* row_data: Array
(
[min] => 1439
[promo] => 228
[ip] => 216.73.216.115
[timer] => Array
(
[days] => 0
[hours] => 23
[minutes] => 59
[secs] => 0
)
[coupon] => SL-EB59F-D9SP7DN
[product_id] => Array
(
[505] => Array
(
[product_id] => 505
[price] => 6800.00
)
)
[new_price] => 3000
[product] => 505
[price] => 6800.00
)
*/
(function(){
document.getElementById("timer-promo-order-mobile").innerHTML = '
\
\
\
0\
Дней\
\
\
0\
Часов\
\
\
0\
Минут\
\
\
0\
Секунд\
\
\
\
\
';
document.getElementById("timer-promo-order").innerHTML = '\
\
\
0\
Дней\
\
\
0\
Часов\
\
\
0\
Минут\
\
\
0\
Секунд\
\
\
\
\
';
var secondsLeft = 86340;
var deadline = new Date(Date.parse(new Date()) + secondsLeft * 1000);
initializeClock('countdown_mobile', deadline);
initializeClock('countdown', deadline);
function getTimeRemaining(endtime) {
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor((t / 1000) % 60);
var minutes = Math.floor((t / 1000 / 60) % 60);
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
var days = Math.floor(t / (1000 * 60 * 60 * 24));
return {'total': t,'days': days,'hours': hours,'minutes': minutes,'seconds': seconds};
}
function initializeClock(id, endtime) {
var clock = document.getElementById(id);
if (!clock) return;
var daysSpan = clock.querySelector('.days');
var hoursSpan = clock.querySelector('.hours');
var minutesSpan = clock.querySelector('.minutes');
var secondsSpan = clock.querySelector('.seconds');
function updateClock() {
var t = getTimeRemaining(endtime);
if (daysSpan) daysSpan.innerHTML = t.days;
if ((('0' + t.hours).slice(-2)) != '-1') {
if (hoursSpan) hoursSpan.innerHTML = ('0' + t.hours).slice(-2);
if (minutesSpan) minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
if (secondsSpan) secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
} else {
if (hoursSpan) hoursSpan.innerHTML = '00';
if (minutesSpan) minutesSpan.innerHTML = '00';
if (secondsSpan) secondsSpan.innerHTML = '00';
var fullpriceElement = document.querySelector('.timer-fullprice');
var salepriceElement = document.querySelector('.timer-saleprice');
if (fullpriceElement) fullpriceElement.classList.remove('is-hidden');
if (salepriceElement) salepriceElement.classList.add('is-hidden');
}
if (t.total <= 0) {
var fullpriceElement2 = document.querySelector('.timer-fullprice');
var salepriceElement2 = document.querySelector('.timer-saleprice');
if (fullpriceElement2) fullpriceElement2.classList.remove('is-hidden');
if (salepriceElement2) salepriceElement2.classList.add('is-hidden');
clearInterval(timeinterval);
} else {
var msgMobile = document.getElementById("countdown_msg_mobile");
var msg = document.getElementById("countdown_msg");
if (msgMobile) msgMobile.innerHTML = 'Скидка исчезнет через:
';
if (msg) msg.innerHTML = 'Скидка исчезнет через:
';
}
}
updateClock();
var timeinterval = setInterval(updateClock, 1000);
}
})();