Skip to content

Commit

Permalink
Merge pull request #222 from pandaninjas/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrumplex authored Sep 28, 2023
2 parents 87e74b6 + 714aaa7 commit 4212de7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/_includes/layouts/download.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ eleventyComputed:
title: "Downloads"
description: "Download Prism Launcher {{version.current}}"
---
<script>
function appendToURL(url, path) {
if (!url.pathname.endsWith("/")) {
url.pathname += "/"; // if there isn't a slash, add it
}
url.pathname += path;
}
let url = new URL(window.location.href);
if (url.searchParams.get("from") === "button") {
url.searchParams.delete("from"); // don't eternally redirect
// redirect the user to the correct place
if (navigator.platform.indexOf("Mac") !== -1) {
appendToURL(url, "mac");
window.location.href = url.href;
} else if (navigator.platform.indexOf("nix") !== -1 || navigator.platform.indexOf("nux") !== -1 || navigator.userAgent.indexOf("X11") !== -1) {
appendToURL(url, "linux");
window.location.href = url.href;
}
}
</script>
<style>
.background {
filter: brightness(80%);
Expand Down
2 changes: 1 addition & 1 deletion src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hero:
dark: ./src/img/screenshots/LauncherDark.png
light: ./src/img/screenshots/LauncherLight.png
button:
url: /download
url: /download?from=button
content: 'Download Now'
---

Expand Down

0 comments on commit 4212de7

Please sign in to comment.