From f9328e24c1b4adf2d6e5f36a471fd504fa8dd8f7 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 5 Jan 2021 02:43:55 -0500 Subject: move javascript files to js directory --- static/build.html | 2 +- static/faq.html | 2 +- static/index.html | 2 +- static/js/redirect.js | 36 ++++++++++++++++++++++++++++++++++++ static/js/releases.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ static/redirect.js | 36 ------------------------------------ static/releases.html | 4 ++-- static/releases.js | 44 -------------------------------------------- static/usage.html | 2 +- 9 files changed, 86 insertions(+), 86 deletions(-) create mode 100644 static/js/redirect.js create mode 100644 static/js/releases.js delete mode 100644 static/redirect.js delete mode 100644 static/releases.js diff --git a/static/build.html b/static/build.html index 432ae517..75f9ccb7 100644 --- a/static/build.html +++ b/static/build.html @@ -26,7 +26,7 @@ - +
diff --git a/static/faq.html b/static/faq.html index 8aa25048..ab1b8b9d 100644 --- a/static/faq.html +++ b/static/faq.html @@ -26,7 +26,7 @@ - +
diff --git a/static/index.html b/static/index.html index 18588032..6ca17fc1 100644 --- a/static/index.html +++ b/static/index.html @@ -26,7 +26,7 @@ - +
diff --git a/static/js/redirect.js b/static/js/redirect.js new file mode 100644 index 00000000..e11560d1 --- /dev/null +++ b/static/js/redirect.js @@ -0,0 +1,36 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT + +// Client-side redirects for fragments (anchors) +// +// It should be possible to do this with server-side redirects, but it was never implemented or +// standardized. For reference: +// +// https://www.w3.org/People/Bos/redirect +// https://www.w3.org/Protocols/HTTP/Fragment/draft-bos-http-redirect-00.txt + +const redirects = new Map([ + ["/#device-support", "/faq#device-support"], + ["/#roadmap", "/faq#roadmap"], + ["/#copyright-and-licensing", "/faq#copyright-and-licensing"], + ["/usage#default-connections", "/faq#default-connections"], + ["/releases#marlin-stable", "/faq#legacy-devices"], + ["/releases#sailfish-stable", "/faq#legacy-devices"], + ["/releases#marlin-beta", "/faq#legacy-devices"], + ["/releases#sailfish-beta", "/faq#legacy-devices"], + ["/faq#dns", "/faq#custom-dns"], + ["/build#upgrading-to-android-10", "/build#generating-release-signing-keys"], +]); + +function handle_hash() { + if (window.location.hash) { + const redirect = redirects.get(window.location.pathname + window.location.hash); + if (redirect) { + window.location.replace(redirect); + } + } +} + +handle_hash(); +addEventListener("hashchange", handle_hash, false); + +// @license-end diff --git a/static/js/releases.js b/static/js/releases.js new file mode 100644 index 00000000..53b782d1 --- /dev/null +++ b/static/js/releases.js @@ -0,0 +1,44 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT + +const baseUrl = "https://releases.grapheneos.org/"; +const versionBaseUrl = "https://github.com/GrapheneOS/platform_manifest/releases/tag/"; +const devices = ["sunfish", "coral", "flame", "bonito", "sargo", "crosshatch", "blueline", "taimen", "walleye"]; +const channels = ["stable", "beta"]; + +for (const channel of channels) { + for (const device of devices) { + fetch(baseUrl + device + "-" + channel).then(response => { + if (!response.ok) { + return Promise.reject(); + } + return response.text(); + }).then(text => { + const metadata = text.trim().split(" "); + + const factoryFilename = device + "-factory-" + metadata[0] + ".zip"; + const factoryUrl = baseUrl + factoryFilename; + + const updateFilename = device + "-ota_update-" + metadata[0] + ".zip"; + const updateUrl = baseUrl + updateFilename; + + const tag = metadata[2] + "." + metadata[0]; + + const release = document.getElementById(device + "-" + channel); + const links = release.getElementsByTagName("a"); + + links[1].innerText = tag; + links[1].setAttribute("href", versionBaseUrl + tag); + + links[2].innerText = factoryFilename; + links[2].setAttribute("href", factoryUrl); + + links[3].innerText = factoryFilename + ".sig"; + links[3].setAttribute("href", factoryUrl + ".sig"); + + links[4].innerText = updateFilename; + links[4].setAttribute("href", updateUrl); + }); + } +} + +// @license-end diff --git a/static/redirect.js b/static/redirect.js deleted file mode 100644 index e11560d1..00000000 --- a/static/redirect.js +++ /dev/null @@ -1,36 +0,0 @@ -// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT - -// Client-side redirects for fragments (anchors) -// -// It should be possible to do this with server-side redirects, but it was never implemented or -// standardized. For reference: -// -// https://www.w3.org/People/Bos/redirect -// https://www.w3.org/Protocols/HTTP/Fragment/draft-bos-http-redirect-00.txt - -const redirects = new Map([ - ["/#device-support", "/faq#device-support"], - ["/#roadmap", "/faq#roadmap"], - ["/#copyright-and-licensing", "/faq#copyright-and-licensing"], - ["/usage#default-connections", "/faq#default-connections"], - ["/releases#marlin-stable", "/faq#legacy-devices"], - ["/releases#sailfish-stable", "/faq#legacy-devices"], - ["/releases#marlin-beta", "/faq#legacy-devices"], - ["/releases#sailfish-beta", "/faq#legacy-devices"], - ["/faq#dns", "/faq#custom-dns"], - ["/build#upgrading-to-android-10", "/build#generating-release-signing-keys"], -]); - -function handle_hash() { - if (window.location.hash) { - const redirect = redirects.get(window.location.pathname + window.location.hash); - if (redirect) { - window.location.replace(redirect); - } - } -} - -handle_hash(); -addEventListener("hashchange", handle_hash, false); - -// @license-end diff --git a/static/releases.html b/static/releases.html index 2a8f7fec..0773f8d7 100644 --- a/static/releases.html +++ b/static/releases.html @@ -27,8 +27,8 @@ - - + +
diff --git a/static/releases.js b/static/releases.js deleted file mode 100644 index 53b782d1..00000000 --- a/static/releases.js +++ /dev/null @@ -1,44 +0,0 @@ -// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT - -const baseUrl = "https://releases.grapheneos.org/"; -const versionBaseUrl = "https://github.com/GrapheneOS/platform_manifest/releases/tag/"; -const devices = ["sunfish", "coral", "flame", "bonito", "sargo", "crosshatch", "blueline", "taimen", "walleye"]; -const channels = ["stable", "beta"]; - -for (const channel of channels) { - for (const device of devices) { - fetch(baseUrl + device + "-" + channel).then(response => { - if (!response.ok) { - return Promise.reject(); - } - return response.text(); - }).then(text => { - const metadata = text.trim().split(" "); - - const factoryFilename = device + "-factory-" + metadata[0] + ".zip"; - const factoryUrl = baseUrl + factoryFilename; - - const updateFilename = device + "-ota_update-" + metadata[0] + ".zip"; - const updateUrl = baseUrl + updateFilename; - - const tag = metadata[2] + "." + metadata[0]; - - const release = document.getElementById(device + "-" + channel); - const links = release.getElementsByTagName("a"); - - links[1].innerText = tag; - links[1].setAttribute("href", versionBaseUrl + tag); - - links[2].innerText = factoryFilename; - links[2].setAttribute("href", factoryUrl); - - links[3].innerText = factoryFilename + ".sig"; - links[3].setAttribute("href", factoryUrl + ".sig"); - - links[4].innerText = updateFilename; - links[4].setAttribute("href", updateUrl); - }); - } -} - -// @license-end diff --git a/static/usage.html b/static/usage.html index 9c71d67e..fdccc98c 100644 --- a/static/usage.html +++ b/static/usage.html @@ -26,7 +26,7 @@ - +
-- cgit v1.3.1