Fix: go home button
This commit is contained in:
+35
-6
@@ -15,17 +15,46 @@ function loadMaestroID() {
|
||||
console.log("loaded maestroID : " + maestroID);
|
||||
}
|
||||
|
||||
function saveMaestroID() {
|
||||
function saveMaestroID(maestroID) {
|
||||
sessionStorage.setItem("maestroID", maestroID);
|
||||
console.log("saved maestroID : " + maestroID);
|
||||
// console.log("saved maestroID : " + maestroID);
|
||||
}
|
||||
|
||||
function getParentDirectory(url) {
|
||||
let directories = url.split("/");
|
||||
if(directories.length < 2)
|
||||
return "";
|
||||
|
||||
return directories[directories.length - 2];
|
||||
}
|
||||
|
||||
function getPage(url) {
|
||||
let directories = url.split("/");
|
||||
if(directories.length < 1)
|
||||
return "";
|
||||
|
||||
return directories[directories.length - 1];
|
||||
}
|
||||
|
||||
function goHome() {
|
||||
if(maestroID === -1) {
|
||||
location.href = "./../main/index.html";
|
||||
} else {
|
||||
location.href = "./../maestro/main_menu.html";
|
||||
let url = window.location.href;
|
||||
|
||||
if(getParentDirectory(url) === "maestro") {
|
||||
if(getPage(url) !== "main_menu.html")
|
||||
location.href = "./../maestro/main_menu.html";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// parent directory is "main"
|
||||
if(getPage(url) === "faq.html") {
|
||||
if(maestroID === -1) {
|
||||
location.href = "./../main/index.html";
|
||||
} else {
|
||||
location.href = "./../maestro/main_menu.html";
|
||||
}
|
||||
} else if(getPage(url) !== "index.html")
|
||||
location.href = "./../main/index.html";
|
||||
}
|
||||
|
||||
function logout() {
|
||||
|
||||
Reference in New Issue
Block a user