Merge branches 'master' and 'master' of https://github.com/Miodec/monkey-type

This commit is contained in:
Jack 2021-10-12 15:46:04 +01:00
commit 2a6fee088e
5 changed files with 93 additions and 3 deletions

View file

@ -3,12 +3,18 @@ const { mongoDB } = require("../init/mongodb");
const fs = require("fs");
const simpleGit = require("simple-git");
const path = require("path");
const git = simpleGit(path.join(__dirname, "../../../monkeytype-new-quotes"));
let git;
try {
git = simpleGit(path.join(__dirname, "../../../monkeytype-new-quotes"));
} catch (e) {
git = undefined;
}
const stringSimilarity = require("string-similarity");
const { ObjectID } = require("mongodb");
class NewQuotesDAO {
static async add(text, source, language, uid) {
if (!git) throw new MonkeyError(500, "Git not available.");
let quote = {
text: text,
source: source,
@ -48,6 +54,7 @@ class NewQuotesDAO {
}
static async get() {
if (!git) throw new MonkeyError(500, "Git not available.");
return await mongoDB()
.collection("new-quotes")
.find({ approved: false })
@ -57,6 +64,7 @@ class NewQuotesDAO {
}
static async approve(quoteId, editQuote, editSource) {
if (!git) throw new MonkeyError(500, "Git not available.");
//check mod status
let quote = await mongoDB()
.collection("new-quotes")
@ -122,6 +130,7 @@ class NewQuotesDAO {
}
static async refuse(quoteId) {
if (!git) throw new MonkeyError(500, "Git not available.");
return await mongoDB()
.collection("new-quotes")
.deleteOne({ _id: ObjectID(quoteId) });

View file

@ -830,7 +830,7 @@ export function setShowTimerProgress(timer, nosave) {
timer = false;
}
config.showTimerProgress = timer;
if (config.showTimerProgress) {
if (config.showTimerProgress && TestLogic.active) {
TimerProgress.show();
} else {
TimerProgress.hide();
@ -961,6 +961,7 @@ export function setTimerStyle(style, nosave) {
style = "mini";
}
config.timerStyle = style;
TimerProgress.updateStyle();
if (!nosave) saveToLocalStorage();
}

View file

@ -85,6 +85,14 @@ export function restart() {
}
}
export function updateStyle() {
hide();
update();
setTimeout(() => {
show();
}, 125);
}
export function update() {
let time = TestTimer.time;
if (

View file

@ -596,7 +596,7 @@
</div>
</div>
</div>
<div id="supportMeWrapper" class="hidden">
<div id="supportMeWrapper" class="popupWrapper hidden">
<div id="supportMe">
<div class="title">Support Monkeytype</div>
<div class="text">

View file

@ -33802,6 +33802,78 @@
"source": "The Wolf Of Wall Street",
"length": 148,
"id": 5705
},
{
"text": "The only thing that we're allowed to believe is that we won't regret the choice we made. ",
"source": "Hajime Isayama, Attack on Titan",
"length": 89,
"id": 5706
},
{
"text": "Language is a process of free creation; its laws and principles are fixed, but the manner in which the principles of generation are used is free and infinitely varied.",
"source": "Noam Chomsky",
"length": 167,
"id": 5707
},
{
"text": "The behaviour of the domestic cat, Felis silvestris catus, has many features that set it apart from other common domestic animals, even its fellow carnivore the dog. Cats seem to have effected a unique and successful compromise between reliance on man and the retention of behaviour patterns that permit an independent existence. During the first decade of the 21st century the cat has become the preferred pet of many owners, valued because it combines an affectionate nature with a degree of independence, as well as more prosaic qualities such as cleanliness and convenience.",
"source": "The Behaviour of the Domestic Cat by John W.S. Bradshaw",
"length": 578,
"id": 5708
},
{
"text": "What do you mean? Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?",
"source": "The Hobbit, or There and Back Again",
"length": 183,
"id": 5709
},
{
"text": "Let's suppose that you were able every night to dream any dream that you wanted to dream. And that you could, for example, have the power within one night to dream 75 years of time. Or any length of time you wanted to have. And you would, naturally as you began on this adventure of dreams, you would fulfill all your wishes. You would have every kind of pleasure you could conceive. And after several nights of 75 years of total pleasure each, you would say \"Well, that was pretty great.\" But now let's have a surprise. Let's have a dream which isn't under control. Where something is gonna happen to me that I don't know what it's going to be. And you would dig that and come out of that and say \"Wow, that was a close shave, wasn't it?\" And then you would get more and more adventurous, and you would make further and further out gambles as to what you would dream. And finally, you would dream where you are now. You would dream the dream of living the life that you are actually living today.",
"source": "Alan Watts",
"length": 997,
"id": 5710
},
{
"text": "And good news to the purists: they've discovered a cure for the symptoms of being alive. It's a painless procedure with a low rate of failure, but very few patients survive.",
"source": "Marsha, Thankk You for the Dialectics, but I Need You to Leave",
"length": 173,
"id": 5711
},
{
"text": "Their morals, their code; it's a bad joke. Dropped at the first sign of trouble. They're only as good as the world allows them to be. You'll see- I'll show you. When the chips are down these, uh, civilized people? They'll eat each other. See I'm not a monster, I'm just ahead of the curve.",
"source": "The Dark Knight",
"length": 289,
"id": 5712
},
{
"text": "My mom always said life was like a box of chocolates. You never know what you're gonna get.",
"source": "Forrest Gump",
"length": 91,
"id": 5713
},
{
"text": "I am not crazy! I know he swapped those numbers! I knew it was 1216. One after Magna Carta. As if I could ever make such a mistake. Never. Never! I just - I just couldn't prove it. He - he covered his tracks, he got that idiot at the copy shop to lie for him. You think this is something? You think this is bad? This? This chicanery? He's done worse. That billboard! Are you telling me that a man just happens to fall like that? No! He orchestrated it! Jimmy! He defecated through a sunroof! And I saved him! And I shouldn't have. I took him into my own firm! What was I thinking? He'll never change. He'll never change! Ever since he was 9, always the same! Couldn't keep his hands out of the cash drawer! But not our Jimmy! Couldn't be precious Jimmy! Stealing them blind! And he gets to be a lawyer!? What a sick joke! I should've stopped him when I had the chance! And you - you have to stop him!",
"source": "Better Call Saul",
"length": 900,
"id": 5714
},
{
"text": "If we waited until we were ready, we would be waiting our entire lives. ",
"source": "Violet and Klaus Baudelaire, A Series of Unfortunate Events by Lemony Snicket",
"length": 72,
"id": 5715
},
{
"text": "Christie! Ms. Esposito! Hold up. Hey, Jimmy McGill, we met inside. Hi. You didnt get it. You were never gonna get it. They dangle these things in front of you. They tell you, you got a chance, but Im sorry. Its a lie because they had already made up their mind and they knew what they were going to do before you walked in the door. You made a mistake and they are never forgetting it. As far as theyre concerned, your mistake is just, its who you are. And its all you are. And Im not just talking about the scholarship here, Im talking about everything. I mean, theyll smile at you, theyll pat you on the head, but they are never, ever letting you in. But listen… Listen… it doesnt matter. It doesnt because you dont need them. Theyre not going to give it to you? So what? Youre going to take it. Youre going to do whatever it takes. Do you hear me? You are not going to play by the rules. Youre going to go your own way. Youre going to do what they wont do. Youre going to be smart. You are going to cut corners and you are going to win. Their on the 35th floor? Youre going to be on the 50th floor. Youre going to be looking down on them. And the higher you rise, the more theyre going to hate you. Good. Good! You rub their noses in it. You make them suffer. Because you dont matter all that much to them. So what? So what? Screw them! Remember... the winner takes it all. You understand what Im trying to tell you, right? All right. All right. Go get them.",
"source": "Better Call Saul",
"length": 1486,
"id": 5716
},
{
"text": "I'd rather be hated for who I am, than loved for who I am not.",
"source": "Kurt Cobain",
"length": 62,
"id": 5717
}
]
}