aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2023-07-12 13:52:51 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2023-07-12 13:52:51 -0700
commitacfe3d9707f47e7078a1c1e6e121537eec65f76d (patch)
tree38e0a38a56493817684cc0c4236bec435329eae4
parentdownloads: fix JS inside yaml (diff)
downloadwww-acfe3d9707f47e7078a1c1e6e121537eec65f76d.tar.gz
www-acfe3d9707f47e7078a1c1e6e121537eec65f76d.tar.bz2
www-acfe3d9707f47e7078a1c1e6e121537eec65f76d.zip
downloads: move JS and make it also onhashchange
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--downloads/index.html19
1 files changed, 11 insertions, 8 deletions
diff --git a/downloads/index.html b/downloads/index.html
index f8ab833..fb5fe69 100644
--- a/downloads/index.html
+++ b/downloads/index.html
@@ -4,11 +4,16 @@ nav1-show: true
nav1-weight: 9
title: 'Downloads'
-# Select the correct tab based on the anchor hash in the URL.
-# TODO: better validation, use explicit arch list.
inlinejs: |
$(
- function() {
+ loadTabByHash();
+ );
+---
+<script>
+ // Select the right tab based on the hash.
+ // TODO: we also want to be able to change the hash based on some clicks
+ // TODO: better validation, use explicit arch list.
+ function loadTabByHash() {
var h = window.location.hash;
var hb = '#other-arches a';
var h2 = hb + '[href="' + h + '"]';
@@ -16,11 +21,9 @@ inlinejs: |
h2 = hb + ':first';
};
$(h2).tab('show');
- }
- );
----
-
-<div class="row">
+ }
+</script>
+<div class="row" onhashchange="loadTabByHash()">
<div class="col-xs-12 col-md-6">
<div class="panel panel-default featured-panel">
<div class="panel-body">