mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 15:26:15 +08:00
Merge branch 'master' of https://github.com/Miodec/monkey-type
This commit is contained in:
commit
590a40b4a9
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1682,7 +1682,7 @@
|
|||
target="_blank"
|
||||
>
|
||||
<div class="fab fa-github"></div>
|
||||
Github
|
||||
GitHub
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue