bde-liste/static/js/main.js

33 lines
829 B
JavaScript
Raw Normal View History

2022-12-15 13:30:34 +00:00
$(window).on("load", function() {
2022-12-20 20:23:31 +00:00
/* Register the Service Worker */
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./js/sw.js');
}
2022-12-15 13:30:34 +00:00
/* load timer */
window.setInterval(function() {
var time = $("#timer").text();
var t = time.split(":").map(t => parseInt(t));
t[2] -= 1;
if (t[2] < 0) {
t[2] = 59;
t[1] -= 1;
}
if (t[1] < 0) {
t[1] = 59;
t[0] -= 1;
}
if (t[0] < 0) {
t[0] = 0;
t[1] = 0;
t[2] = 0;
}
2022-12-15 16:14:41 +00:00
$("#timer").text((new Date('December 17, 1995 ' + t.join(':'))).toLocaleTimeString('default', {
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}));
2022-12-15 13:30:34 +00:00
}, 1000);
2022-12-20 20:23:31 +00:00
});