diff options
Diffstat (limited to 'plugin/notes/notes.html')
-rw-r--r-- | plugin/notes/notes.html | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 4fda869..2704130 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -463,22 +463,26 @@ minutesEl = timeEl.querySelector( '.minutes-value' ), secondsEl = timeEl.querySelector( '.seconds-value' ); + function _displayTime( hrEl, minEl, secEl, time) { + var hours = Math.floor( time / ( 1000 * 60 * 60 ) ); + var minutes = Math.floor( ( time / ( 1000 * 60 ) ) % 60 ); + var seconds = Math.floor( ( time / 1000 ) % 60 ); + hrEl.innerHTML = zeroPadInteger( hours ); + hrEl.className = hours > 0 ? '' : 'mute'; + minEl.innerHTML = ':' + zeroPadInteger( minutes ); + minEl.className = minutes > 0 ? '' : 'mute'; + secEl.innerHTML = ':' + zeroPadInteger( seconds ); + } + function _updateTimer() { var diff, hours, minutes, seconds, now = new Date(); diff = now.getTime() - start.getTime(); - hours = Math.floor( diff / ( 1000 * 60 * 60 ) ); - minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 ); - seconds = Math.floor( ( diff / 1000 ) % 60 ); clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } ); - hoursEl.innerHTML = zeroPadInteger( hours ); - hoursEl.className = hours > 0 ? '' : 'mute'; - minutesEl.innerHTML = ':' + zeroPadInteger( minutes ); - minutesEl.className = minutes > 0 ? '' : 'mute'; - secondsEl.innerHTML = ':' + zeroPadInteger( seconds ); + _displayTime( hoursEl, minutesEl, secondsEl, diff ); } |