updated project structure

added folders
renamed notification-center to notifications
This commit is contained in:
Jack 2021-03-29 00:33:13 +01:00
parent d1bd0d3178
commit 3029c29b8c
32 changed files with 123 additions and 120 deletions

View file

@ -90,24 +90,24 @@ const refactoredSrc = [
"./src/js/cloud-functions.js",
"./src/js/misc.js",
"./src/js/layouts.js",
"./src/js/monkey.js",
"./src/js/elements/monkey.js",
"./src/js/result-filters.js",
"./src/js/notification-center.js",
"./src/js/leaderboards.js",
"./src/js/elements/notifications.js",
"./src/js/elements/leaderboards.js",
"./src/js/sound.js",
"./src/js/custom-text.js",
"./src/js/shift-tracker.js",
"./src/js/test/custom-text.js",
"./src/js/test/shift-tracker.js",
"./src/js/test/test-stats.js",
"./src/js/theme-colors.js",
"./src/js/test/out-of-focus.js",
"./src/js/chart-controller.js",
"./src/js/theme-controller.js",
"./src/js/test/caret.js",
"./src/js/custom-text-popup.js",
"./src/js/manual-restart-tracker.js",
"./src/js/popups/custom-text-popup.js",
"./src/js/test/manual-restart-tracker.js",
"./src/js/config.js",
"./src/js/test/focus.js",
"./src/js/account-icon.js",
"./src/js/elements/account-icon.js",
"./src/js/test/practise-missed.js",
"./src/js/test/test-ui.js",
"./src/js/test/keymap.js",
@ -119,7 +119,7 @@ const refactoredSrc = [
"./src/js/test/test-logic.js",
"./src/js/test/funbox.js",
"./src/js/test/pace-caret.js",
"./src/js/quote-search-popup.js",
"./src/js/popups/quote-search-popup.js",
"./src/js/tag-controller.js",
"./src/js/ui.js",
"./src/js/test/pb-crown.js",
@ -129,15 +129,15 @@ const refactoredSrc = [
"./src/js/commandline-lists.js",
"./src/js/commandline.js",
"./src/js/challenge-controller.js",
"./src/js/custom-word-amount-popup.js",
"./src/js/custom-test-duration-popup.js",
"./src/js/popups/custom-word-amount-popup.js",
"./src/js/popups/custom-test-duration-popup.js",
"./src/js/test/test-config.js",
"./src/js/loader.js",
"./src/js/elements/loader.js",
"./src/js/mini-result-chart.js",
"./src/js/sign-out-button.js",
"./src/js/layout-emulator.js",
"./src/js/version-popup.js",
"./src/js/support-popup.js",
"./src/js/elements/sign-out-button.js",
"./src/js/test/layout-emulator.js",
"./src/js/popups/version-popup.js",
"./src/js/popups/support-popup.js",
];
//legacy files

View file

@ -1,5 +1,5 @@
import * as Misc from "./misc";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as UpdateConfig from "./config";
import * as ManualRestart from "./manual-restart-tracker";
import * as CustomText from "./custom-text";

View file

@ -1,7 +1,7 @@
import * as DB from "./db";
import * as Misc from "./misc";
import layouts from "./layouts";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as Sound from "./sound";
import * as TestStats from "./test-stats";
import * as ThemeController from "./theme-controller";

View file

@ -8,7 +8,7 @@ import * as TimerProgress from "./timer-progress";
import * as LiveWpm from "./live-wpm";
import * as LiveAcc from "./live-acc";
import * as Funbox from "./funbox";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as ThemeController from "./theme-controller";
import * as Keymap from "./keymap";
import * as LanguagePicker from "./language-picker";

View file

@ -1,7 +1,7 @@
import { loadTags } from "./result-filters";
import * as AccountIcon from "./account-icon";
import * as CloudFunctions from "./cloud-functions";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
const db = firebase.firestore();
db.settings({ experimentalForceLongPolling: true });

View file

@ -1,6 +1,6 @@
import * as CloudFunctions from "./cloud-functions";
import * as Loader from "./loader";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
let currentLeaderboard = "time_15";

View file

@ -12,7 +12,7 @@ import * as Misc from "./misc";
import * as CloudFunctions from "./cloud-functions";
import layouts from "./layouts";
import * as Monkey from "./monkey";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as ResultFilters from "./result-filters";
import * as Leaderboards from "./leaderboards";
import * as Sound from "./sound";

View file

@ -1,6 +1,6 @@
import * as UpdateConfig from "./config";
import * as ManualRestart from "./manual-restart-tracker";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as TestLogic from "./test-logic";
function parseInput(input) {

View file

@ -1,7 +1,7 @@
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 Notifications from "./notifications";
import * as TestLogic from "./test-logic";
let wrapper = "#customTextPopupWrapper";

View file

@ -1,6 +1,6 @@
import * as UpdateConfig from "./config";
import * as ManualRestart from "./manual-restart-tracker";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as TestLogic from "./test-logic";
export function show() {

View file

@ -1,5 +1,5 @@
import * as Misc from "./misc";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import Config from "./config";
import * as ManualRestart from "./manual-restart-tracker";
import * as TestLogic from "./test-logic";

View file

@ -0,0 +1,86 @@
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.trim();
filterin = filterin.replace(/ /gi, "|");
let regincl = new RegExp(filterin, "i");
let filterout = $("#wordExclude").val();
filterout = filterout.trim();
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;
}

View file

@ -1,5 +1,5 @@
import * as TestLogic from "./test-logic";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as TestUI from "./test-ui";
import * as Misc from "./misc";
import * as ManualRestart from "./manual-restart-tracker";

View file

@ -1,5 +1,5 @@
import * as TestStats from "./test-stats";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import Config, * as UpdateConfig from "./config";
import * as CustomText from "./custom-text";
import * as TestLogic from "./test-logic";

View file

@ -39,7 +39,7 @@ let leftSideKeys = [
"KeyX",
"KeyC",
"KeyV",
"Backquote",
"Digit1",
"Digit2",
@ -61,12 +61,12 @@ let rightSideKeys = [
"KeyN",
"KeyM",
"Digit7",
"Digit8",
"Digit9",
"Digit0",
"Backslash",
"BracketLeft",
"BracketRight",

View file

@ -1,6 +1,6 @@
import * as CloudFunctions from "./cloud-functions";
import * as DB from "./db";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import Config from "./config";
import * as Misc from "./misc";

View file

@ -2,7 +2,7 @@ import * as TestUI from "./test-ui";
import * as ManualRestart from "./manual-restart-tracker";
import Config, * as UpdateConfig from "./config";
import * as Misc from "./misc";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as CustomText from "./custom-text";
import * as TestStats from "./test-stats";
import * as PractiseMissed from "./practise-missed";

View file

@ -5,7 +5,7 @@ import * as LiveWpm from "./live-wpm";
import * as TestStats from "./test-stats";
import * as Monkey from "./monkey";
import * as Misc from "./misc";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as Funbox from "./funbox";
import * as TestLogic from "./test-logic";
import * as Caret from "./caret";

View file

@ -1,4 +1,4 @@
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as ThemeColors from "./theme-colors";
import Config, * as UpdateConfig from "./config";
import * as DB from "./db";

View file

@ -1,7 +1,7 @@
import * as ThemeColors from "./theme-colors";
import * as ChartController from "./chart-controller";
import * as Misc from "./misc";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import Config from "./config";
import * as UI from "./ui";

View file

@ -1,5 +1,5 @@
import Config, * as UpdateConfig from "./config";
import * as Notifications from "./notification-center";
import * as Notifications from "./notifications";
import * as Leaderboards from "./leaderboards";
import * as ManualRestart from "./manual-restart-tracker";
import * as Misc from "./misc";

View file

@ -1,83 +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.trim();
filterin = filterin.replace(/ /gi, "|");
let regincl = new RegExp(filterin, "i");
let filterout = $("#wordExclude").val();
filterout = filterout.trim();
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;
}