Skip to content

Commit

Permalink
simplify if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Jul 15, 2024
1 parent fa4fbbd commit b9d7f73
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions js/switch-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ 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")) {
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")) {
if (url.includes("/release")) {
button.innerText = "Main";
} else {
button.innerText = "Release";
Expand Down

0 comments on commit b9d7f73

Please sign in to comment.