Use Math.floor in 90-timers
[plack-app-gruntmaster.git] / js / 90-timers.js
index 7281f6f3fd689a9d37c364ff335886660802038f..d439299ebe6d562f3d47cab5883f4f986589ce34 100644 (file)
@@ -13,9 +13,9 @@ function update_timer(timer){
                value = Math.max(value * 3 / 10, value * left / total);
                timer.innerHTML = Math.floor(value);
        } else {
-               var hours = left / 60 / 60;
+               var hours = Math.floor(left / 60 / 60);
                hours = hours < 10 ? '0' + hours : hours;
-               var minutes = left / 60 % 60;
+               var minutes = Math.floor(left / 60) % 60;
                minutes = minutes < 10 ? '0' + minutes : minutes;
                var seconds = left % 60;
                seconds = seconds < 10 ? '0' + seconds : seconds;
@@ -23,9 +23,7 @@ function update_timer(timer){
        }
 }
 
-$(function() {
-       $('.timer').each(function(item){
-               update_timer(item);
-               setInterval(function(){update_timer(item)}, 1000);
-       });
-});
+$(() => $('.timer').each(item => {
+       update_timer(item);
+       setInterval(() => update_timer(item), 1000);
+}));
This page took 0.009573 seconds and 4 git commands to generate.