From 830da2b15c85e78dbc4b1b0ea9f8731f200efff9 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Sun, 13 Sep 2020 22:38:40 +0200 Subject: [PATCH] migrate old settings for tiles and messages sound enablers --- public/trivabble.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); -- 2.30.2