Skip to content

Commit

Permalink
Naming and minor JS nits fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Jul 22, 2019
1 parent 36aeae2 commit d4be72d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions resources/media-controls.js
Expand Up @@ -243,12 +243,8 @@
this.elements.positionDurationBox.show(currentTime, duration);

// Volume.
const volumeSwitchClass = this.media.muted || this.media.volume == 0 ? "muted" : "volumeup";
if (!this.elements.volumeSwitch.classList.contains(volumeSwitchClass)) {
this.elements.volumeSwitch.classList = "";
this.elements.volumeSwitch.classList.add(volumeSwitchClass);
}
const volumeLevelValue = Math.round((this.media.muted ? 0 : this.media.volume) * 100);
this.elements.volumeSwitch.className = this.media.muted || !this.media.volume ? "muted" : "volumeup";
const volumeLevelValue = this.media.muted ? 0 : Math.round(this.media.volume * 100);
if (this.elements.volumeLevel.value != volumeLevelValue) {
this.elements.volumeLevel.value = volumeLevelValue;
}
Expand All @@ -275,7 +271,7 @@
this.playOrPause();
break;
case this.elements.volumeSwitch:
this.muteUnmute();
this.toggleMuted();
break;
}
break;
Expand Down Expand Up @@ -329,7 +325,7 @@
}
}

muteUnmute() {
toggleMuted() {
this.media.muted = !this.media.muted;
}

Expand Down

0 comments on commit d4be72d

Please sign in to comment.