diff --git a/css/switch-deploy.css b/css/switch-deploy.css new file mode 100644 index 00000000..5f496930 --- /dev/null +++ b/css/switch-deploy.css @@ -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; +} diff --git a/index.html b/index.html index 3cb6744e..700ccfbf 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ + @@ -148,6 +149,10 @@ +
+

Switch to

+ +
@@ -162,6 +167,7 @@ + \ No newline at end of file diff --git a/js/switch-deploy.js b/js/switch-deploy.js new file mode 100644 index 00000000..445ae82b --- /dev/null +++ b/js/switch-deploy.js @@ -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"; +}