Fix: go home button

This commit is contained in:
2018-07-12 14:54:45 +09:00
parent a0e0702370
commit a549a63491
10 changed files with 174 additions and 91 deletions
+35 -6
View File
@@ -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() {