diff --git a/src/js/tribe.js b/src/js/tribe.js index 42a34e11e..01fb0330d 100644 --- a/src/js/tribe.js +++ b/src/js/tribe.js @@ -137,6 +137,16 @@ function mp_applyRoomConfig(cfg) { activateFunbox(cfg.funbox, null, true); setStopOnError(cfg.stopOnError, true, true); setConfidenceMode(cfg.confidenceMode, true, true); + setPunctuation(cfg.punctuation, true, true); + setNumbers(cfg.numbers, true, true); + if (cfg.minAcc != null) { + setMinAcc("custom", true, true); + setMinAccCustom(cfg.minAcc, true, true); + } + if (cfg.minWpm != null) { + setMinWpm("custom", true, true); + setMinWpmCustomSpeed(cfg.minAcc, true, true); + } customText = cfg.customText; } @@ -177,6 +187,10 @@ function mp_syncConfig() { stopOnError: config.stopOnError, confidenceMode: config.confidenceMode, customText: customText, + punctuation: config.punctuation, + numbers: config.numbers, + minWpm: config.minWpm === "custom" ? config.minWpmCustomSpeed : null, + minAcc: config.minAcc === "custom" ? config.minAccCustom : null, }, }); } @@ -329,6 +343,28 @@ function mp_refreshConfig() { ${qstring} `); + } else if (MP.room.config.mode === "custom") { + let t = "Custom settings:"; + + t += `\ntext length: ${customText.text.length}`; + if (customText.isTimeRandom || customText.isWordRandom) { + let r = ""; + let n = ""; + if (customText.isTimeRandom) { + r = "time"; + n = customText.time; + } else if (customText.isWordRandom) { + r = "words"; + n = customText.word; + } + t += `\nrandom: ${r} ${n}`; + } + + $(".pageTribe .lobby .currentSettings .groups").append(` +
+ custom +
+ `); } $(".pageTribe .lobby .currentSettings .groups").append(` @@ -1019,6 +1055,10 @@ $(".pageTribe #createPrivateRoom").click((f) => { stopOnError: config.stopOnError, confidenceMode: config.confidenceMode, customText: customText, + punctuation: config.punctuation, + numbers: config.numbers, + minWpm: config.minWpm === "custom" ? config.minWpmCustomSpeed : null, + minAcc: config.minAcc === "custom" ? config.minAccCustom : null, }, }); }); diff --git a/src/js/userconfig.js b/src/js/userconfig.js index dfdd5359d..b1d7442db 100644 --- a/src/js/userconfig.js +++ b/src/js/userconfig.js @@ -425,7 +425,10 @@ function setPaceCaretCustomSpeed(val, nosave) { } //min wpm -function setMinWpm(minwpm, nosave) { +function setMinWpm(minwpm, nosave, mp = false) { + if (!mp_checkIfCanChangeConfig(mp)) { + return; + } if (minwpm == undefined) { minwpm = "off"; } @@ -434,7 +437,10 @@ function setMinWpm(minwpm, nosave) { if (!nosave) saveConfigToCookie(); } -function setMinWpmCustomSpeed(val, nosave) { +function setMinWpmCustomSpeed(val, nosave, mp = false) { + if (!mp_checkIfCanChangeConfig(mp)) { + return; + } if (val == undefined || Number.isNaN(parseInt(val))) { val = 100; } @@ -443,7 +449,10 @@ function setMinWpmCustomSpeed(val, nosave) { } //min acc -function setMinAcc(min, nosave) { +function setMinAcc(min, nosave, mp = false) { + if (!mp_checkIfCanChangeConfig(mp)) { + return; + } if (min == undefined) { min = "off"; } @@ -452,7 +461,10 @@ function setMinAcc(min, nosave) { if (!nosave) saveConfigToCookie(); } -function setMinAccCustom(val, nosave) { +function setMinAccCustom(val, nosave, mp = false) { + if (!mp_checkIfCanChangeConfig(mp)) { + return; + } if (val == undefined || Number.isNaN(parseInt(val))) { val = 90; } @@ -932,7 +944,10 @@ function toggleQuickTabMode() { } //numbers -function setNumbers(numb, nosave) { +function setNumbers(numb, nosave, mp = false) { + if (!mp_checkIfCanChangeConfig(mp)) { + return; + } config.numbers = numb; if (!config.numbers) { $("#top .config .numbersMode .text-button").removeClass("active"); @@ -953,7 +968,10 @@ function toggleNumbers() { } //punctuation -function setPunctuation(punc, nosave) { +function setPunctuation(punc, nosave, mp = false) { + if (!mp_checkIfCanChangeConfig(mp)) { + return; + } config.punctuation = punc; if (!config.punctuation) { $("#top .config .punctuationMode .text-button").removeClass("active");