add default values for tiles and messages sound enablers
This commit is contained in:
parent
aee069d6f8
commit
db81c3e00c
|
@ -51,8 +51,8 @@
|
|||
<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>
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
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]);
|
||||
|
@ -662,7 +664,7 @@
|
|||
tile.lastChild.textContent = scoreOf[letter] || "";
|
||||
if (highlight) {
|
||||
tile.classList.add("tile-highlight");
|
||||
if (tilesSound.checked) {
|
||||
if (getSetting("ENABLE_TILE_SOUND")) {
|
||||
audioNotification.play();
|
||||
}
|
||||
} else {
|
||||
|
@ -835,7 +837,7 @@
|
|||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||
|
||||
if (sender && sender !== getSetting("trivabblePlayerName")) {
|
||||
if (msgSound.checked) {
|
||||
if (getSetting("ENABLE_MSG_SOUND")) {
|
||||
audioChat.play();
|
||||
}
|
||||
|
||||
|
@ -1519,16 +1521,14 @@
|
|||
|
||||
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();
|
||||
}
|
||||
|
@ -1952,28 +1952,20 @@
|
|||
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);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue