mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-21 07:46:15 +08:00
Merge branch 'master' of https://github.com/Miodec/monkeytype
This commit is contained in:
commit
d527b2359e
|
@ -24,12 +24,23 @@ export function loading(truefalse: boolean): void {
|
|||
export function update(discordId?: string, discordAvatar?: string): void {
|
||||
if (Auth.currentUser != null) {
|
||||
if (discordAvatar && discordId) {
|
||||
usingAvatar = true;
|
||||
$("#top #menu .account .avatar").css(
|
||||
"background-image",
|
||||
`url(https://cdn.discordapp.com/avatars/${discordId}/${discordAvatar}.png)`
|
||||
);
|
||||
$("#top #menu .account .avatar").removeClass("hidden");
|
||||
// Replace font-awesome account icon with Discord avatar only if it loads successfully
|
||||
// https://stackoverflow.com/a/5058336/9080819
|
||||
const avatarUrl = `https://cdn.discordapp.com/avatars/${discordId}/${discordAvatar}.png`;
|
||||
$("<img/>")
|
||||
.attr("src", avatarUrl)
|
||||
.on("load", (event) => {
|
||||
$(event.currentTarget).remove();
|
||||
|
||||
usingAvatar = true;
|
||||
$("#top #menu .account .avatar").css(
|
||||
"background-image",
|
||||
`url(${avatarUrl})`
|
||||
);
|
||||
|
||||
$("#top #menu .account .icon").addClass("hidden");
|
||||
$("#top #menu .account .avatar").removeClass("hidden");
|
||||
});
|
||||
} else {
|
||||
$("#top #menu .account .avatar").addClass("hidden");
|
||||
}
|
||||
|
|
|
@ -19,7 +19,15 @@ function setMemory(id: string): void {
|
|||
|
||||
async function getLatest(): Promise<MonkeyTypes.PSA[]> {
|
||||
const response = await Ape.psas.get();
|
||||
if (response.message === "Server is down for maintenance") {
|
||||
if (response.status === 500) {
|
||||
Notifications.addBanner(
|
||||
"PSA request failed. If this issue persists the server might be experiencing unexpected down time. <a target= '_blank' href='https://monkeytype.instatus.com/'>Check the status page</a> or <a target= '_blank' href='https://twitter.com/monkeytypegame'>Twitter</a> for more information.",
|
||||
-1,
|
||||
"exclamation-triangle",
|
||||
true
|
||||
);
|
||||
return [];
|
||||
} else if (response.status === 503) {
|
||||
Notifications.addBanner(
|
||||
"Server is currently under maintenance. <a target= '_blank' href='https://monkeytype.instatus.com/'>Check the status page</a> for more info.",
|
||||
-1,
|
||||
|
|
|
@ -35730,6 +35730,36 @@
|
|||
"source": "It's Not Like",
|
||||
"length": 105,
|
||||
"id": 6109
|
||||
},
|
||||
{
|
||||
"text": "Well, you know the old formula: Comedy equals tragedy plus time. And you have been asleep for a while. So I guess it's actually pretty funny when you do the math.",
|
||||
"source": "Portal 2",
|
||||
"length": 162,
|
||||
"id": 6110
|
||||
},
|
||||
{
|
||||
"text": "Day before yesterday I saw a rabbit, and yesterday a deer, and today, you.",
|
||||
"source": "The Dandelion Girl - Robert F. Young",
|
||||
"length": 74,
|
||||
"id": 6111
|
||||
},
|
||||
{
|
||||
"text": "Wherever I end up after this... in whatever reality... all those moments between us were real, and they'll always be ours.",
|
||||
"source": "Life Is Strange",
|
||||
"length": 122,
|
||||
"id": 6112
|
||||
},
|
||||
{
|
||||
"text": "I could frame any one of you in a dark corner, and capture you in a moment of desperation. And any of you could do that to me. Isn't that too easy? Too obvious?",
|
||||
"source": "Life Is Strange",
|
||||
"length": 160,
|
||||
"id": 6113
|
||||
},
|
||||
{
|
||||
"text": "Those first days before classes started I spent alone in my whitewashed room, in the bright meadows of Hampden. And I was happy in those first days as really I'd never been before, roaming like a sleepwalker, stunned and drunk with beauty.",
|
||||
"source": "The Secret History - Donna Tartt",
|
||||
"length": 239,
|
||||
"id": 6114
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue