function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function shuffleArray(array) { var currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } var mainNow = 0; function addTopLine(isMobile) { isMobile = isMobile ? isMobile : false; var allToday = new Date().getHours() * 100 + Math.floor(Math.random() * 1000); var now = mainNow != 0 ? mainNow : getRandomInt(45, 150); mainNow = now; var todayBuy = getRandomInt(50, 100) + new Date().getHours(); if (allToday <= todayBuy) { todayBuy = Math.floor(allToday / 2) + 2; } var allHeight = isMobile ? 34 : 36; var html = '' + '
' + '
' + 'Посетителей сегодня: ' + allToday + '' + 'Сейчас на сайте: ' + now + '' + 'Покупок сегодня: ' + todayBuy + '' + '
'; $(html).appendTo($(document.body)); } function showSwimmer() { var count = mainNow != 0 ? mainNow : getRandomInt(45, 150); var bottom = 6; if ($('.delivery-notify').length) { bottom = 88; } mainNow = count; var html = '
' + '
×
' + '' + 'Сейчас ' + count + ' пользователей просматривают эту страницу вместе с вами.' + '
'; $(html).appendTo($(document.body)); $('.close-swimmer').on('click', function () { $('.swimmer').remove(); }); setInterval(function () { if ($('.delivery-notify').length) { $('.swimmer').css('bottom', 88); } else { $('.swimmer').css('bottom', 6); } }, 1000); } function freezeMoney(balance, dollar) { var html = '' + '
' + '
Мы заморозили цену!
' + '
1$ = ' + dollar + ' рублей
' + '
Осталось ' + balance + ' штук
по старому курсу' + '
' + '' + '
'; $(html).appendTo($(document.body)); $('.freezing-close').on('click', function (e) { $('.freezing-info').remove(); e.preventDefault(); e.stopPropagation(); }); } /*$(function(){ let moveMouse = false; let scrollMouse = false; let keyDown = false; let setCookie = (document.cookie == "" ? false : true); $("html").mousemove(function(){ moveMouse = true; }); $("html").keydown(function() { keyDown = true; }); $("form").submit(function() { $(this).append(""); $(this).append(""); $(this).append(""); }); });*/