mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 23:20:25 +08:00
Revert "Merge branch 'master' of https://github.com/smithster/monkeytype"
This reverts commit83cf30362d
, reversing changes made to67fb123d8f
.
This commit is contained in:
parent
83cf30362d
commit
69b2242c96
8 changed files with 2 additions and 199 deletions
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
})
|
|
@ -10,5 +10,3 @@ global.snapshot = DB.getSnapshot;
|
|||
global.config = Config;
|
||||
// global.addnotif = Notifications.add;
|
||||
global.link = linkWithGoogle;
|
||||
|
||||
global.wordFilter = WordFilter;
|
|
@ -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";
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -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(`
|
||||
<option value=${language}>${prettyLang}</option>
|
||||
`)
|
||||
})
|
||||
$("#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;
|
||||
}
|
|
@ -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%;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Monkeytype</title>
|
||||
<!-- <link rel="stylesheet" href="css/fa.css" /> -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="css/balloon.css" />
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<link rel="stylesheet" href="themes/serika_dark.css" id="currentTheme" />
|
||||
|
@ -103,7 +102,6 @@
|
|||
</div>
|
||||
<div id="customTextPopupWrapper" class="hidden">
|
||||
<div id="customTextPopup" action="">
|
||||
<div class="wordfilter button"><i class="fas fa-filter"></i>Words filter</div>
|
||||
<textarea class="textarea" placeholder="Custom text"></textarea>
|
||||
<div class="inputs">
|
||||
<label class="check">
|
||||
|
@ -135,27 +133,6 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="button apply">ok</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wordFilterPopupWrapper" class="hidden">
|
||||
<div id="wordFilterPopup">
|
||||
<div class="wftitle">language</div>
|
||||
<select id="languageList" class="">
|
||||
|
||||
</select>
|
||||
<div class="lengthgrid">
|
||||
<div id="wordMinTitle" class="wftitle">min length</div>
|
||||
<div id="wordMaxTitle" class="wftitle">max length</div>
|
||||
<input id="wordMin" class="wordLength" autocomplete="off" type="number">
|
||||
<input id="wordMax" class="wordLength" autocomplete="off" type="number">
|
||||
</div>
|
||||
<div class="wftitle">include</div>
|
||||
<input id="wordFilter" autocomplete="off">
|
||||
<div class="wftitle">exclude</div>
|
||||
<input id="wordExclude" autocomplete="off">
|
||||
<div class="wftip">Use the above filters to include and exclude words or characters (separated by spaces)</div>
|
||||
<i class="fas fa-fw fa-spin fa-circle-notch hidden wfload"></i>
|
||||
<div class="button">ok</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3777,6 +3754,5 @@
|
|||
<script src="js/jquery.cookie-1.4.1.min.js"></script>
|
||||
<script src="js/moment.min.js"></script>
|
||||
<script src="js/html2canvas.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="js/monkeytype.js"></script>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue