From c2b3f998ea937a48234e4ac9fa1e1556512a1ec7 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 23 Jan 2021 16:57:57 +0000 Subject: [PATCH] version bump, syncing config when changing min acc wpm punc and numbers --- src/js/script.js | 3 ++- src/js/tribe.js | 7 ++++--- src/js/userconfig.js | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index dbffb9174..dfa9b9bd8 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -5738,7 +5738,8 @@ if (firebase.app().options.projectId === "monkey-type-dev-67af4") { ); } -if (window.location.hostname === "localhost") { +if (firebase.app().options.projectId === "monkey-type-dev-67af4") { + // if (window.location.hostname === "localhost") { window.onerror = function (error) { Notifications.add(error, -1); }; diff --git a/src/js/tribe.js b/src/js/tribe.js index fdaf3595e..bd7acb6cd 100644 --- a/src/js/tribe.js +++ b/src/js/tribe.js @@ -15,7 +15,7 @@ let MP = { maxReconnectionAttempts: 1, activePage: "preloader", pageTransition: false, - expectedVersion: "0.7.0", + expectedVersion: "0.7.1", }; let tribeSounds = { @@ -140,12 +140,12 @@ function mp_applyRoomConfig(cfg) { setPunctuation(cfg.punctuation, true, true); setNumbers(cfg.numbers, true, true); if (cfg.minAcc != null) { - setMinAcc("custom", true, true); setMinAccCustom(cfg.minAcc, true, true); + setMinAcc("custom", true, true); } if (cfg.minWpm != null) { - setMinWpm("custom", true, true); setMinWpmCustomSpeed(cfg.minAcc, true, true); + setMinWpm("custom", true, true); } customText = cfg.customText; } @@ -659,6 +659,7 @@ MP.socket.on("mp_update_online_stats", (data) => { ); if (data.version !== MP.expectedVersion) { MP.socket.disconnect(); + mp_changeActiveSubpage("preloader"); Notifications.add( `Tribe version mismatch. Try refreshing or clearing cache. Client version: ${MP.expectedVersion}, server version: ${data.version}`, -1 diff --git a/src/js/userconfig.js b/src/js/userconfig.js index 1761495ee..f5d019faf 100644 --- a/src/js/userconfig.js +++ b/src/js/userconfig.js @@ -434,6 +434,7 @@ function setMinWpm(minwpm, nosave, mp = false) { } config.minWpm = minwpm; updateTestModesNotice(); + mp_syncConfig(); if (!nosave) saveConfigToCookie(); } @@ -445,6 +446,7 @@ function setMinWpmCustomSpeed(val, nosave, mp = false) { val = 100; } config.minWpmCustomSpeed = val; + mp_syncConfig(); if (!nosave) saveConfigToCookie(); } @@ -458,6 +460,7 @@ function setMinAcc(min, nosave, mp = false) { } config.minAcc = min; updateTestModesNotice(); + mp_syncConfig(); if (!nosave) saveConfigToCookie(); } @@ -469,6 +472,7 @@ function setMinAccCustom(val, nosave, mp = false) { val = 90; } config.minAccCustom = val; + mp_syncConfig(); if (!nosave) saveConfigToCookie(); } @@ -958,6 +962,7 @@ function setNumbers(numb, nosave, mp = false) { } else { $("#top .config .numbersMode .text-button").addClass("active"); } + mp_syncConfig(); if (!nosave) saveConfigToCookie(); } @@ -982,6 +987,7 @@ function setPunctuation(punc, nosave, mp = false) { } else { $("#top .config .punctuationMode .text-button").addClass("active"); } + mp_syncConfig(); if (!nosave) saveConfigToCookie(); }