-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add switcher between release and main
- Loading branch information
1 parent
e650135
commit 3d93f29
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#switch-deploy { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
} | ||
|
||
#switch-deploy-button { | ||
cursor: pointer; | ||
background-color: #fff; | ||
border: 1px solid #000; | ||
padding: 5px; | ||
border-radius: 5px; | ||
font-family: sans-serif; | ||
font-size: 14px; | ||
} | ||
|
||
#switch-deploy-button:hover { | ||
background-color: #c5c5c5; | ||
} | ||
|
||
#switch-deploy-text { | ||
margin: 0 10px 0 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const button = document.getElementById("switch-deploy-button"); | ||
|
||
button.addEventListener("click", () => { | ||
const currentUrl = window.location.href; | ||
|
||
if (currentUrl.includes("/main")) { | ||
window.location.href = currentUrl.replace("/main", "/release"); | ||
} else if (currentUrl.includes("/release")) { | ||
window.location.href = currentUrl.replace("/release", "/main"); | ||
} else { | ||
window.location.href = "https://key4hep.github.io/eede/release/index.html"; | ||
} | ||
}); | ||
|
||
const url = window.location.href; | ||
if (url.includes("/main")) { | ||
button.innerText = "Release"; | ||
} else if (url.includes("/release")) { | ||
button.innerText = "Main"; | ||
} else { | ||
button.innerText = "Release"; | ||
} |