From: Laurent Mazet Date: Sun, 13 Sep 2020 20:38:40 +0000 (+0200) Subject: migrate old settings for tiles and messages sound enablers X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=830da2b15c85e78dbc4b1b0ea9f8731f200efff9;p=trivabble.git migrate old settings for tiles and messages sound enablers --- diff --git a/public/trivabble.js b/public/trivabble.js index 51ddbe4..1129c88 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -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);