This commit is contained in:
Jack 2021-06-21 18:10:19 +01:00
commit 590a40b4a9
7 changed files with 22 additions and 19 deletions

View file

@ -1,4 +1,5 @@
import * as Loader from "./loader";
import Config from "./config";
export function getuid() {
console.error("Only share this uid with Miodec and nobody else!");
@ -262,9 +263,9 @@ export function showNotification(text, time) {
);
}
let currentLanguage = null;
export function getCurrentLanguage() {
return currentLanguage;
let currentLanguage;
export async function getCurrentLanguage() {
return await getLanguage(Config.language);
}
export async function getLanguage(lang) {

View file

@ -168,7 +168,7 @@ list.updateEmail = new SimplePopup(
pass
);
Loader.show();
user.reauthenticateWithCredential(pass).then(() => {
user.reauthenticateWithCredential(credential).then(() => {
CloudFunctions.updateEmail({
uid: user.uid,
previousEmail: previousEmail,

View file

@ -27,7 +27,7 @@ export function hide() {
$("#caret").addClass("hidden");
}
export function updatePosition() {
export async function updatePosition() {
if ($("#wordsWrapper").hasClass("hidden")) return;
if ($("#caret").hasClass("off")) {
return;
@ -56,7 +56,8 @@ export function updatePosition() {
}
if (Config.mode != "zen" && $(currentLetter).length == 0) return;
const isLanguageLeftToRight = Misc.getCurrentLanguage().leftToRight;
const currentLanguage = await Misc.getCurrentLanguage();
const isLanguageLeftToRight = currentLanguage.leftToRight;
let currentLetterPosLeft = isLanguageLeftToRight
? currentLetter.offsetLeft
: currentLetter.offsetLeft + $(currentLetter).width();

View file

@ -94,7 +94,8 @@ export async function activate(funbox) {
if (funbox === undefined || funbox === null) {
funbox = Config.funbox;
}
if (Misc.getCurrentLanguage().ligatures) {
if (await Misc.getCurrentLanguage().ligatures) {
if (funbox == "choo_choo" || funbox == "earthquake") {
Notifications.add(
"Current language does not support this funbox mode",

View file

@ -468,24 +468,24 @@ export async function init() {
const previousWord = words.get(i - 1);
const previousWord2 = words.get(i - 2);
if (
Config.mode == "custom" &&
(CustomText.isWordRandom || CustomText.isTimeRandom) &&
wordset.length < 3
) {
randomWord = wordset[Math.floor(Math.random() * wordset.length)];
} else if (
Config.mode == "custom" &&
!CustomText.isWordRandom &&
!CustomText.isTimeRandom
) {
randomWord = CustomText.text[i];
} else {
} else if (
Config.mode == "custom" &&
(wordset.length < 3 || PractiseMissed.before.mode !== null)
) {
randomWord = wordset[Math.floor(Math.random() * wordset.length)];
} else {
while (
randomWord == previousWord ||
randomWord == previousWord2 ||
(!Config.punctuation && randomWord == "I") ||
randomWord.indexOf(" ") > -1
) {
console.log('rerandomising');
randomWord = wordset[Math.floor(Math.random() * wordset.length)];
}
}
@ -926,7 +926,7 @@ export function calculateWpmAndRaw() {
};
}
export function addWord() {
export async function addWord() {
let bound = 100;
if (Config.funbox === "plus_one") bound = 1;
if (Config.funbox === "plus_two") bound = 2;
@ -946,10 +946,10 @@ export function addWord() {
return;
const language =
Config.mode !== "custom"
? Misc.getCurrentLanguage()
? await Misc.getCurrentLanguage()
: {
//borrow the direction of the current language
leftToRight: Misc.getCurrentLanguage().leftToRight,
leftToRight: await Misc.getCurrentLanguage().leftToRight,
words: CustomText.text,
};
const wordset = language.words;

View file

@ -1682,7 +1682,7 @@
target="_blank"
>
<div class="fab fa-github"></div>
Github
GitHub
</a>
</div>
</div>

View file

@ -96,7 +96,7 @@
<ul>
<li>
<a href="#Vulnerability_Disclosure">
How to Disclose a Vulnearbility
How to Disclose a Vulnerability
</a>
</li>
<li><a href="#Submission_Guidelines">Submission Guidelines</a></li>