mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 15:26:15 +08:00
impr: update title on page change
This commit is contained in:
parent
bebf7b6f52
commit
cf1c93f551
|
@ -74,6 +74,14 @@ export async function change(
|
|||
AdController.reinstate();
|
||||
},
|
||||
async () => {
|
||||
if (nextPage.name === "test") {
|
||||
Misc.updateTitle();
|
||||
} else {
|
||||
Misc.updateTitle(
|
||||
Misc.capitalizeFirstLetterOfEachWord(nextPage.name) +
|
||||
" | Monkeytype"
|
||||
);
|
||||
}
|
||||
Focus.set(false);
|
||||
ActivePage.set(nextPage.name);
|
||||
previousPage?.afterHide();
|
||||
|
|
|
@ -14,7 +14,6 @@ import * as FunboxList from "./test/funbox/funbox-list";
|
|||
import Konami from "konami";
|
||||
|
||||
if (Misc.isLocalhost()) {
|
||||
$("head title").text("localhost");
|
||||
$("footer .currentVersion .text").text("localhost");
|
||||
$("body").prepend(
|
||||
`<a class='button configureAPI' href='http://localhost:5005/configure/' target='_blank' aria-label="Configure API" data-balloon-pos="right"><i class="fas fa-fw fa-server"></i></a>`
|
||||
|
|
|
@ -1668,4 +1668,15 @@ export function reloadAfter(seconds: number): void {
|
|||
}, seconds * 1000);
|
||||
}
|
||||
|
||||
export function updateTitle(title?: string): void {
|
||||
const local = isLocalhost() ? "localhost - " : "";
|
||||
|
||||
if (!title) {
|
||||
document.title =
|
||||
local + "Monkeytype | A minimalistic, customizable typing test";
|
||||
} else {
|
||||
document.title = local + title;
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT ALTER GLOBAL OBJECTSONSTRUCTOR, IT WILL BREAK RESULT HASHES
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
<%= compilation.assets["html/header.html"].source() %>
|
||||
<main style="height: 100%">
|
||||
<%= compilation.assets["html/pages/loading.html"].source() %> <%=
|
||||
compilation.assets["html/pages/test.html"].source() %> <%=
|
||||
compilation.assets["html/pages/about.html"].source() %> <%=
|
||||
compilation.assets["html/pages/settings.html"].source() %> <%=
|
||||
compilation.assets["html/pages/login.html"].source() %> <%=
|
||||
compilation.assets["html/pages/account.html"].source() %> <%=
|
||||
compilation.assets["html/pages/profile.html"].source() %> <%=
|
||||
compilation.assets["html/pages/test.html"].source() %> <%=
|
||||
compilation.assets["html/pages/404.html"].source() %>
|
||||
</main>
|
||||
|
||||
|
|
Loading…
Reference in a new issue