function superTopovayaFunction(seconds, id) {
var pause = 0; // Пауза в игре. Если 1 то таймер замирает на 1000 секунд
var format = 3; // 4 - дни + часы + минуты + секунды, 3 - часы + минуты + секунды, 2 - минуты + секунды, 1 - секунды
var after_text_on = 0; // 1 = после того как таймер выйдет будет писать указанный текст, 0 = просто нули на таймере
var id_div_text = "t_two"; // Укажите ID блока для котоного будет писаться текст если after_text_on = 1
var div_text = "<h1>время вышло</h1>"; // Укажите сам текст для блока id_div_text
var id_seconds = "seconds" + id; // в каком блоке будут отображаться секунды <span id="seconds"></span>
var id_minutes = "minutes" + id; // в каком блоке будут отображаться минуты <span id="minutes"></span>
var id_hours = "hours" + id; // в каком блоке будут отображаться часы <span id="hours"></span>
var id_days = "days" + id; // в каком блоке будут отображаться дни <span id="days"></span>
initializeTimer(seconds, format, after_text_on, id_div_text, div_text, id_seconds, id_minutes, id_hours, id_days, pause);
}
window.onload = function () {
superTopovayaFunction(456465, '1');
superTopovayaFunction(6465, '2');
};
function initializeTimer(seconds,format,after_text_on,id_div_text,div_text,id_seconds,id_minutes,id_hours,id_days) {
if (seconds > 0) {
var minutes = seconds/60;
var hours = minutes/60;
var days = hours / 24;
minutes = (hours - Math.floor(hours)) * 60;
days = Math.floor(days);
hours = Math.floor(hours)- days * 24;
seconds = Math.floor((minutes - Math.floor(minutes)) * 60);
minutes = Math.floor(minutes);
// upd 7.12.2020
if (typeof timerId !== 'undefined') {
clearInterval(timerId);
}
// endupd
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.