migrate old settings for tiles and messages sound enablers

This commit is contained in:
Laurent Mazet 2020-09-13 22:38:40 +02:00
parent db81c3e00c
commit 830da2b15c
1 changed files with 16 additions and 0 deletions

View File

@ -1954,6 +1954,14 @@
const tilesSound = document.getElementById("tiles-sound");
if (tilesSound) {
/* migration of old settings for tiles sound */
const oldSetting = getSetting("trivabbleTilesSound");
if (oldSetting) {
setSetting("ENABLE_TILE_SOUND", oldSetting === "true");
delete localStorage.trivabbleTilesSound;
}
tilesSound.checked = getSetting("ENABLE_TILE_SOUND");
tilesSound.onclick = function () {
setSetting("ENABLE_TILE_SOUND", this.checked);
@ -1962,6 +1970,14 @@
const msgSound = document.getElementById("msg-sound");
if (msgSound) {
/* migration of old settings for message sound */
const oldSetting = getSetting("trivabbleMsgSound");
if (oldSetting) {
setSetting("ENABLE_MSG_SOUND", oldSetting === "true");
delete localStorage.trivabbleMsgSound;
}
msgSound.checked = getSetting("ENABLE_MSG_SOUND");
msgSound.onclick = function () {
setSetting("ENABLE_MSG_SOUND", this.checked);