From a5d65ecd9fb7cb6edd14402e842286b7debf1052 Mon Sep 17 00:00:00 2001 From: Alexey Nurgaliev Date: Sun, 3 Sep 2023 16:42:02 +0300 Subject: [PATCH] ability to hide mute button and volume slider --- data/emulator.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/data/emulator.js b/data/emulator.js index f9a9975..ebbbb7f 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -1646,8 +1646,10 @@ class EmulatorJS { e.gain.gain.value = volume; }) } - unmuteButton.style.display = (volume === 0) ? "" : "none"; - muteButton.style.display = (volume === 0) ? "none" : ""; + if (!this.config.buttonOpts || this.config.buttonOpts.mute !== false) { + unmuteButton.style.display = (volume === 0) ? "" : "none"; + muteButton.style.display = (volume === 0) ? "none" : ""; + } } if (!this.muted) this.setVolume(this.volume); @@ -1659,9 +1661,11 @@ class EmulatorJS { this.setVolume(this.volume); }, 5); }) - - volumeSettings.appendChild(volumeSlider); - + + if (!this.config.buttonOpts || this.config.buttonOpts.volume !== false) { + volumeSettings.appendChild(volumeSlider); + } + this.elements.menu.appendChild(volumeSettings); this.settingParent = this.createElement("div"); @@ -1792,6 +1796,10 @@ class EmulatorJS { enter.style.display = "none"; exit.style.display = "none"; } + if (this.config.buttonOpts.mute === false) { + muteButton.style.display = "none"; + unmuteButton.style.display = "none"; + } if (this.config.buttonOpts.saveState === false) saveState.style.display = "none" if (this.config.buttonOpts.loadState === false) loadState.style.display = "none" if (this.config.buttonOpts.saveSavFiles === false) saveSavFiles.style.display = "none"