Skip to content

Commit 608e1ff

Browse files
authored
Merge pull request #240 from hughrun/v0.7.5
fix version switching in 0.7.5
2 parents 6bd211e + 422317f commit 608e1ff

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

site/static/js/bookwyrm.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ document.addEventListener('DOMContentLoaded', () => {
3434
var arr = current_location.split("/")
3535
var regx = /\/v[0-9\.]+/
3636
if (regx.test(current_location)) {
37-
window.location = window.location.href.replace(regx,`${target_version}`)
37+
window.location = window.location.href.replace(regx,`/${target_version}`)
3838
} else {
3939
window.location = `/${target_version}${current_location}`
4040
}
@@ -60,4 +60,16 @@ document.addEventListener('DOMContentLoaded', () => {
6060
$menuTarget.classList.toggle('is-hidden-touch');
6161
});
6262
});
63+
64+
// Table of contents
65+
const $tocController = document.getElementById("toc");
66+
if ($tocController) {
67+
$tocController.addEventListener('click', () => {
68+
$tocController.classList.toggle('is-active');
69+
const target = $tocController.dataset.target;
70+
const $target = document.getElementById(target);
71+
$target.classList.toggle('is-hidden-touch');
72+
})
73+
}
74+
6375
});

0 commit comments

Comments
 (0)