Merge branch 'single-list-command-line' of https://github.com/willerbee/monkey-type into single-list-command-line

This commit is contained in:
willerbee 2020-10-14 09:23:14 +08:00
commit 155deff9a8
4 changed files with 42 additions and 14 deletions

View file

@ -762,13 +762,13 @@
<div class="bottom">monkey-type</div>
</div>
<div id="menu">
<div class="icon-button" tabindex="2" href="/" onclick="this.blur();">
<div class="icon-button view-start" tabindex="2" href="/" onclick="this.blur();">
<div class="icon">
<i class="fas fa-fw fa-keyboard"></i>
</div>
</div>
<div
class="icon-button leaderboards"
class="icon-button leaderboards view-leaderboards"
tabindex="2"
onclick="this.blur();"
>
@ -777,7 +777,7 @@
</div>
</div>
<div
class="icon-button"
class="icon-button view-about"
tabindex="2"
href="/about"
onclick="this.blur();"
@ -799,7 +799,7 @@
</div>
</a> -->
<div
class="icon-button"
class="icon-button view-settings"
tabindex="2"
href="/settings"
onclick="this.blur();"
@ -809,7 +809,7 @@
</div>
</div>
<div
class="icon-button hidden account"
class="icon-button hidden account view-account"
tabindex="2"
href="/account"
onclick="this.blur();"
@ -820,7 +820,7 @@
<div class="text"></div>
</div>
<div
class="icon-button login"
class="icon-button login view-login"
tabindex="2"
href="/login"
onclick="this.blur();"

View file

@ -464,6 +464,34 @@ let commands = {
display: "Next random theme",
exec: () => randomiseTheme()
},
{
id: "viewTypingPage",
display: "View Typing Page",
exec: () => $('#top #menu .icon-button.view-start').click()
},
{
id: "viewLeaderboards",
display: "View Leaderboards Page",
exec: () => $('#top #menu .icon-button.view-leaderboards').click()
},
{
id: "viewAbout",
display: "View About Page",
exec: () => $('#top #menu .icon-button.view-about').click()
},
{
id: "viewSettings",
display: "View Settings Page",
exec: () => $('#top #menu .icon-button.view-settings').click()
},
{
id: "viewAccount",
display: "View Account Page",
exec: () =>
$('#top #menu .icon-button.view-account').hasClass('hidden') ?
$('#top #menu .icon-button.view-login').click() :
$('#top #menu .icon-button.view-account').click()
},
{
id: "bailOut",
display: "Bail out...",

View file

@ -68,6 +68,7 @@ async function db_getUserSnapshot() {
.then((res) => {
// console.log('getting data from db!');
let data = res.data();
if (data === undefined) return;
try {
if (data.personalBests !== undefined) {
snap.personalBests = data.personalBests;

View file

@ -714,10 +714,9 @@ function punctuateWord(previousWord, currentWord, index, maxindex) {
}
function addWord() {
let bound = 60;
let bound = 100;
if (activeFunBox === "plus_one") bound = 1;
if (
!config.showAllLines &&
(wordsList.length - inputHistory.length > bound ||
(config.mode === "words" && wordsList.length >= config.words) ||
(config.mode === "custom" &&
@ -4792,11 +4791,11 @@ $(document).keydown((event) => {
) {
updateTimer();
}
if (config.showAllLines) {
if (config.mode == "time") {
addWord();
}
} else {
// if (config.showAllLines) {
// if (config.mode == "time") {
// addWord();
// }
// } else {
if (
config.mode == "time" ||
config.mode == "words" ||
@ -4804,7 +4803,7 @@ $(document).keydown((event) => {
) {
addWord();
}
}
// }
}
}
});