mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-02-04 06:29:06 +08:00
change page function will change to a page based on pathname if no page name provided
This commit is contained in:
parent
955c49b324
commit
44b809d3c1
1 changed files with 17 additions and 0 deletions
17
src/js/ui.js
17
src/js/ui.js
|
|
@ -121,6 +121,23 @@ export function changePage(page, norestart = false) {
|
|||
console.log(`change page ${page} stopped`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (page == undefined) {
|
||||
//use window loacation
|
||||
let pages = {
|
||||
"/": "test",
|
||||
"/login": "login",
|
||||
"/settings": "settings",
|
||||
"/about": "about",
|
||||
"/account": "account",
|
||||
};
|
||||
let path = pages[window.location.pathname];
|
||||
if (!path) {
|
||||
path = "test";
|
||||
}
|
||||
page = path;
|
||||
}
|
||||
|
||||
console.log(`change page ${page}`);
|
||||
let activePageElement = $(".page.active");
|
||||
activePage = undefined;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue