<span class="modal-button" id="btn-settings-close">×</span>
</h2>
<div id="prefs">
- <p><label><input type="checkbox" id="tiles-sound" checked="checked" /><span data-l10n="text-content">Sound of the tiles</span></label></p>
- <p><label><input type="checkbox" id="msg-sound" checked="checked" /><span data-l10n="text-content">Sound of messages</span></label></p>
+ <p><label><input type="checkbox" id="tiles-sound" /><span data-l10n="text-content">Sound of the tiles</span></label></p>
+ <p><label><input type="checkbox" id="msg-sound" /><span data-l10n="text-content">Sound of messages</span></label></p>
<p id="enable-spell-checker-outer" style="display:none"><label><input type="checkbox" id="enable-spell-checker" /> <span data-l10n="text-content">Enable spell checker</span></label></p>
<p><label><span data-l10n="text-content">(fast)</span><input type="range" min="0" max="0" id="double-tap-duration"/><span data-l10n="text-content">(slow)</span><br/><span data-l10n="text-content">Double tap duration</span></label></p>
<p><label><span data-l10n="text-content">(fast)</span><input type="range" min="0" max="0" id="flash-light-duration"/><span data-l10n="text-content">(slow)</span><br/><span data-l10n="text-content">Flash light duration</span></label></p>
setConf("ENABLE_EVENT_SOURCE", true);
setConf("MAX_WEBSOCKET_ERRORS", 1);
setConf("APP_PATH", "");
+ setConf("ENABLE_MSG_SOUND", true);
+ setConf("ENABLE_TILE_SOUND", true);
setConf("ENABLE_SPELL_CHECKER", false);
setConf("DOUBLE_TAP_DURATIONS", [650, 1100, 1800, 3000, 5000]);
setConf("FLASH_LIGHT_DURATIONS", [800, 1600, 3200]);
tile.lastChild.textContent = scoreOf[letter] || "";
if (highlight) {
tile.classList.add("tile-highlight");
- if (tilesSound.checked) {
+ if (getSetting("ENABLE_TILE_SOUND")) {
audioNotification.play();
}
} else {
chatMessages.scrollTop = chatMessages.scrollHeight;
if (sender && sender !== getSetting("trivabblePlayerName")) {
- if (msgSound.checked) {
+ if (getSetting("ENABLE_MSG_SOUND")) {
audioChat.play();
}
let audioTileLoaded = false;
let audioMsgLoaded = false;
- let tilesSound;
- let msgSound;
function loadAudio() {
- if (!audioTileLoaded && tilesSound.checked) {
+ if (!audioTileLoaded && getSetting("ENABLE_TILE_SOUND")) {
audioTileLoaded = true;
audioNotification.load();
}
- if (!audioMsgLoaded && msgSound.checked) {
+ if (!audioMsgLoaded && getSetting("ENABLE_MSG_SOUND")) {
audioMsgLoaded = true;
audioChat.load();
}
audioChat.appendChild(audioSourceOGG);
audioChat.appendChild(audioSourceMP3);
-
- tilesSound = document.getElementById("tiles-sound");
- msgSound = document.getElementById("msg-sound");
-
- tilesSound.onclick = function () {
- setSetting("trivabbleTileSound", tilesSound.checked);
- };
-
- msgSound.onclick = function () {
- setSetting("trivabbleMsgSound", msgSound.checked);
- };
-
- if (isSetting("trivabbleMsgSound")) {
- msgSound.checked = getSetting("trivabbleMsgSound");
- } else {
- setSetting("trivabbleMsgSound", msgSound.checked);
+ const tilesSound = document.getElementById("tiles-sound");
+ if (tilesSound) {
+ tilesSound.checked = getSetting("ENABLE_TILE_SOUND");
+ tilesSound.onclick = function () {
+ setSetting("ENABLE_TILE_SOUND", this.checked);
+ };
}
- if (isSetting("trivabbleTileSound")) {
- tilesSound.checked = getSetting("trivabbleTileSound");
- } else {
- setSetting("trivabbleTilesSound", tilesSound.checked);
+ const msgSound = document.getElementById("msg-sound");
+ if (msgSound) {
+ msgSound.checked = getSetting("ENABLE_MSG_SOUND");
+ msgSound.onclick = function () {
+ setSetting("ENABLE_MSG_SOUND", this.checked);
+ };
}
}