diff --git a/gulpfile.js b/gulpfile.js index 77431062b..fe048a49d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -104,7 +104,6 @@ const refactoredSrc = [ "./src/js/chart-controller.js", "./src/js/theme-controller.js", "./src/js/test/caret.js", - "./src/js/word-filter.js", "./src/js/custom-text-popup.js", "./src/js/manual-restart-tracker.js", "./src/js/config.js", diff --git a/src/js/custom-text-popup.js b/src/js/custom-text-popup.js index 0b4ea962c..02a89098f 100644 --- a/src/js/custom-text-popup.js +++ b/src/js/custom-text-popup.js @@ -2,7 +2,6 @@ import * as CustomText from "./custom-text"; import * as ManualRestart from "./manual-restart-tracker"; import * as Misc from "./misc"; import * as Notifications from "./notification-center"; -import * as WordFilter from "./word-filter"; import * as TestLogic from "./test-logic"; let wrapper = "#customTextPopupWrapper"; @@ -82,7 +81,7 @@ $(`${popup} .randomInputFields .time input`).keypress((e) => { $(`${popup} .randomInputFields .wordcount input`).val(""); }); -$("#customTextPopup .apply").click(() => { +$("#customTextPopup .button").click(() => { let text = $("#customTextPopup textarea").val(); text = text.trim(); // text = text.replace(/[\r]/gm, " "); @@ -155,7 +154,3 @@ $("#customTextPopup .apply").click(() => { TestLogic.restart(); hide(); }); - -$("#customTextPopup .wordfilter").click(() => { - WordFilter.showWordFilterPopup(); -}) \ No newline at end of file diff --git a/src/js/exports.js b/src/js/exports.js index 22286defe..c3dc504c0 100644 --- a/src/js/exports.js +++ b/src/js/exports.js @@ -10,5 +10,3 @@ global.snapshot = DB.getSnapshot; global.config = Config; // global.addnotif = Notifications.add; global.link = linkWithGoogle; - -global.wordFilter = WordFilter; \ No newline at end of file diff --git a/src/js/global-dependencies.js b/src/js/global-dependencies.js index 8a15db298..f0074f490 100644 --- a/src/js/global-dependencies.js +++ b/src/js/global-dependencies.js @@ -30,7 +30,6 @@ import * as OutOfFocus from "./out-of-focus"; import * as ChartController from "./chart-controller"; import * as ThemeController from "./theme-controller"; import * as Caret from "./caret"; -import * as WordFilter from "./word-filter"; import * as CustomTextPopup from "./custom-text-popup"; import * as ManualRestart from "./manual-restart-tracker"; import Config, * as UpdateConfig from "./config"; diff --git a/src/js/script.js b/src/js/script.js index 71761dce8..cae5fa375 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -813,8 +813,7 @@ $(document).keydown(function (event) { let modePopupVisible = !$("#customTextPopupWrapper").hasClass("hidden") || !$("#customMode2PopupWrapper").hasClass("hidden") || - !$("#quoteSearchPopupWrapper").hasClass("hidden") || - !$("#wordFilterPopupWrapper").hasClass("hidden"); + !$("#quoteSearchPopupWrapper").hasClass("hidden"); if ( pageTestActive && !commandLineVisible && diff --git a/src/js/word-filter.js b/src/js/word-filter.js deleted file mode 100644 index ced7eac18..000000000 --- a/src/js/word-filter.js +++ /dev/null @@ -1,81 +0,0 @@ -import { setCustomThemeColors } from "./config"; -import * as Misc from "./misc"; -import * as ThemeColors from "./theme-colors"; -//import * as config from "./userconfig"; - -export async function showWordFilterPopup(){ - - $("#wordFilterPopupWrapper").removeClass("hidden"); - $("#customTextPopupWrapper").addClass("hidden"); - let LanguageList = await Misc.getLanguageList(); - LanguageList.forEach(language => { - let prettyLang = language; - prettyLang = prettyLang.replace("_", " "); - $("#languageList").append(` - - `) - }) - $("#languageList").select2({ - minimumResultsForSearch: -1, - }); -} - -function hideWordFilterPopup(){ - $("#wordFilterPopupWrapper").addClass("hidden"); - $("#customTextPopupWrapper").removeClass("hidden"); -} - -async function applyWordFilterPopup(){ - let language = $("#languageList").val(); - let filteredWords = await filter(language); - let customText = ""; - filteredWords.forEach( word => { - customText += (word + " "); - }) - hideWordFilterPopup(); - $("#customTextPopup textarea").val(customText); -} - -$("#wordFilterPopupWrapper").mousedown((e) => { - if ($(e.target).attr("id") === "wordFilterPopupWrapper") { - hideWordFilterPopup(); - } -}); - -$("#wordFilterPopupWrapper .button").mousedown((e) => { - $("#wordFilterPopupWrapper .wfload").removeClass("hidden"); - $("#wordFilterPopupWrapper .button").addClass("hidden"); - setTimeout(() => { - applyWordFilterPopup(); - $("#wordFilterPopupWrapper .wfload").addClass("hidden"); - $("#wordFilterPopupWrapper .button").removeClass("hidden"); - }, 1) -}); - -async function filter(language){ - let filterin = $("#wordFilter").val(); - filterin = filterin.replace(/ /gi, "|"); - let regincl = new RegExp(filterin, "i"); - let filterout = $("#wordExclude").val(); - filterout = filterout.replace(/ /gi, "|"); - let regexcl = new RegExp(filterout, "i"); - let filteredWords = []; - let languageWordList = await Misc.getLanguage(language); - let maxLength = $("#wordMax").val(); - let minLength = $("#wordMin").val(); - if(maxLength == ""){ - maxLength = 999; - } - if(minLength == ""){ - minLength = 1; - } - for( let i = 0; i < languageWordList.words.length; i++){ - let word = languageWordList.words[i]; - let test1 = regincl.test(word); - let test2 = regexcl.test(word); - if((test1 && !test2 || test1 && filterout == "") && word.length <= maxLength && word.length >= minLength){ - filteredWords.push(word); - } - } - return filteredWords; -} \ No newline at end of file diff --git a/src/sass/style.scss b/src/sass/style.scss index 1109b2499..088e1958e 100644 --- a/src/sass/style.scss +++ b/src/sass/style.scss @@ -414,11 +414,6 @@ a:hover { gap: 1rem; width: 60vw; - .wordfilter{ - width: 33%; - justify-self:right; - } - textarea { background: var(--bg-color); padding: 1rem; @@ -432,8 +427,6 @@ a:hover { resize: vertical; height: 200px; color: var(--text-color); - overflow-x: hidden; - overflow-y: scroll; } .inputs { @@ -519,81 +512,6 @@ a:hover { } } -#wordFilterPopupWrapper{ - width: 100%; - height: 100%; - background: rgba(0, 0, 0, 0.75); - position: fixed; - left: 0; - top: 0; - z-index: 1000; - display: grid; - justify-content: center; - align-items: center; - padding: 5rem 0; - - #wordFilterPopup{ - background: var(--bg-color); - border-radius: var(--roundness); - padding: 2rem; - display: grid; - gap: 1rem; - width: 400px; - - .lengthgrid{ - display:grid; - grid-template-columns: 1fr 1fr; - grid-template-rows: 1fr 1fr; - gap: 0.2rem; - } - - .wordLength{ - width: 10rem; - } - - #languageList{ - background: rgba(0, 0, 0, 0.1); - height: fit-content; - padding: 5px; - border-radius: 5px; - color: var(--text-color); - font: var(--font); - border: none; - - - option{ - background: var(--bg-color); - } - } - #languageList:focus{ - height: fit-content; - padding: 5px; - border-radius: 5px; - color: var(--text-color); - font: var(--font); - border: none; - outline: none; - } - #languageList:active{ - height: fit-content; - padding: 5px; - border-radius: 5px; - color: var(--text-color); - font: var(--font); - border: none; - outline: none; - } - .wftip{ - color: var(--sub-color); - font-size: 0.8rem; - } - - .wfload{ - justify-self: center; - } - } -} - #simplePopupWrapper { width: 100%; height: 100%; diff --git a/static/index.html b/static/index.html index a4571c513..be7da9eb4 100644 --- a/static/index.html +++ b/static/index.html @@ -5,7 +5,6 @@ Monkeytype - @@ -103,7 +102,6 @@ - @@ -3777,6 +3754,5 @@ -