feat: implement no-client-JavaScript support for back-to-top and search (WIP)

This commit is contained in:
grassblock 2025-05-22 21:43:35 +08:00
parent 5c3eba62b1
commit a7fea79d98
4 changed files with 29 additions and 6 deletions

View file

@ -1,7 +1,8 @@
---
import {siteConfig} from "../config";
const noscript = siteConfig.noClientJavaScript
---
<button id="toTopBtn" title="Go to top">Top</button>
{noscript ? <a href="#top"><button id="toTopBtn" style="display: block" title="Go to top">Top</button></a> : <button id="toTopBtn" title="Go to top">Top</button>
<script>
// Get the button
let toTopButton = document.getElementById("toTopBtn");
@ -31,4 +32,4 @@
document.documentElement.scrollTop = 0;
}
}
</script>
</script>}