diff options
Diffstat (limited to 'js/main.js')
-rw-r--r-- | js/main.js | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -2,7 +2,46 @@ var timeWastingClock = new FlipClock($('.time-wasting-clock'), { autoStart:false }); +var $timeWastingClockRunning = false; + var activityClock = new FlipClock($('.activity-countdown'), { autoStart:false, countdown:true }); + +$(document).ready(function(){ + $('#timeWastingClockGo').button(); + $('#timeWastingClockGo').click(function() { + if ($timeWastingClockRunning) + { + $(this).html('Start timer (Hotkey: j)'); + timeWastingClock.stop(); + $timeWastingClockRunning = false; + } + else + { + $(this).html('Stop timer (Hotkey: j)'); + timeWastingClock.start(); + $timeWastingClockRunning = true; + } + }); + + $('#timeWastingClockReset').button(); + $('#timeWastingClockReset').click(function() { + if (timeWastingClock.getTime() != 0) + { + var $timeWastingClockResetConfirm = confirm("Are you sure?"); + if ($timeWastingClockResetConfirm) + { + if ($timeWastingClockRunning) + { + $('#timeWastingClockGo').html('Start timer (Hotkey: j)'); + timeWastingClock.stop(); + $timeWastingClockRunning = false; + } + timeWastingClock.setTime(0); + } + } + }); +}); + |