diff --git a/src/js/popups/word-filter-popup.js b/src/js/popups/word-filter-popup.js index 79cb583d6..cc1bc9f6c 100644 --- a/src/js/popups/word-filter-popup.js +++ b/src/js/popups/word-filter-popup.js @@ -65,15 +65,15 @@ async function filter(language) { return filteredWords; } -async function apply() { +async function apply(set) { let language = $("#wordFilterPopup .languageInput").val(); let filteredWords = await filter(language); - let customText = ""; - filteredWords.forEach((word) => { - customText += word + " "; - }); + let customText = filteredWords.join(" "); + + $("#customTextPopup textarea").val( + (index, val) => (set ? "" : val + " ") + customText + ); hide(); - $("#customTextPopup textarea").val(customText); } $("#wordFilterPopupWrapper").mousedown((e) => { @@ -90,8 +90,9 @@ $("#wordFilterPopupWrapper .button").mousedown((e) => { $("#wordFilterPopupWrapper .loadingIndicator").removeClass("hidden"); $("#wordFilterPopupWrapper .button").addClass("hidden"); setTimeout(() => { - apply(); - $("#wordFilterPopupWrapper .loadingIndicator").addClass("hidden"); - $("#wordFilterPopupWrapper .button").removeClass("hidden"); + apply($(e.target).is("#set")).then(() => { + $("#wordFilterPopupWrapper .loadingIndicator").addClass("hidden"); + $("#wordFilterPopupWrapper .button").removeClass("hidden"); + }); }, 1); }); diff --git a/src/js/test/test-logic.js b/src/js/test/test-logic.js index d450d16ae..c014ea7aa 100644 --- a/src/js/test/test-logic.js +++ b/src/js/test/test-logic.js @@ -641,8 +641,20 @@ export function restart(withSameWordset = false, nosave = false, event) { let testSeconds = TestStats.calculateTestSeconds(performance.now()); let afkseconds = TestStats.calculateAfkSeconds(); // incompleteTestSeconds += ; - TestStats.incrementIncompleteSeconds(testSeconds - afkseconds); + let tt = testSeconds - afkseconds; + console.log( + `increasing incomplete time by ${tt}s (${testSeconds}s - ${afkseconds}s afk)` + ); + TestStats.incrementIncompleteSeconds(tt); TestStats.incrementRestartCount(); + if (tt > 600) { + Notifications.add( + `Your time typing just increased by ${Misc.roundTo2( + tt / 60 + )} minutes. If you think this is incorrect please contact Miodec and dont refresh the website.`, + -1 + ); + } // restartCount++; } diff --git a/static/index.html b/static/index.html index 8963b0626..e4266ebca 100644 --- a/static/index.html +++ b/static/index.html @@ -202,10 +202,15 @@ Use the above filters to include and exclude words or characters (separated by spaces) +
+ "Set" replaces the current custom word list with the filter result, "Add" + appends the filter result to the current custom word list +
-
ok
+
set
+
add