avoid deleting existing classes when muting time elements

and make muting work for negative values
This commit is contained in:
Adam Spiers 2016-04-16 17:40:21 +01:00
parent b1b4ee270b
commit 1eada3b360
1 changed files with 12 additions and 2 deletions

View File

@ -468,9 +468,19 @@
var minutes = Math.floor( ( time / ( 1000 * 60 ) ) % 60 ); var minutes = Math.floor( ( time / ( 1000 * 60 ) ) % 60 );
var seconds = Math.floor( ( time / 1000 ) % 60 ); var seconds = Math.floor( ( time / 1000 ) % 60 );
hrEl.innerHTML = zeroPadInteger( hours ); hrEl.innerHTML = zeroPadInteger( hours );
hrEl.className = hours > 0 ? '' : 'mute'; if (hours == 0) {
hrEl.classList.add( 'mute' );
}
else {
hrEl.classList.remove( 'mute' );
}
minEl.innerHTML = ':' + zeroPadInteger( minutes ); minEl.innerHTML = ':' + zeroPadInteger( minutes );
minEl.className = (hours > 0 || minutes > 0) ? '' : 'mute'; if (hours == 0 && minutes == 0) {
minEl.classList.add( 'mute' );
}
else {
minEl.classList.remove( 'mute' );
}
secEl.innerHTML = ':' + zeroPadInteger( seconds ); secEl.innerHTML = ':' + zeroPadInteger( seconds );
} }