mirror of
https://github.com/kittywitch/dork.dev.git
synced 2026-02-09 15:19:18 -08:00
feat: put javascript into separate files
This commit is contained in:
parent
95345afe2f
commit
6ebd2ddee9
4 changed files with 31 additions and 31 deletions
|
|
@ -49,26 +49,6 @@
|
|||
|
||||
<noscript>Persistence of user-selected color scheme is not possible without Javascript, however automatic detection from CSS will still work.</noscript>
|
||||
|
||||
<script>
|
||||
var radios = document.getElementsByName("color-scheme");
|
||||
var prev = localStorage.getItem("color-scheme");
|
||||
for (var i = 0; i < radios.length; i++) {
|
||||
var _this = radios[i];
|
||||
_this.checked = _this.value == prev;
|
||||
radios[i].addEventListener("change", function() {
|
||||
if (this.value !== prev) {
|
||||
prev = this.value;
|
||||
localStorage.setItem("color-scheme", this.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
var button = document.getElementById("clear-color-scheme");
|
||||
button.addEventListener("click", function() {
|
||||
for (var i = 0; i < radios.length; i++) {
|
||||
var _this = radios[i];
|
||||
_this.checked = false;
|
||||
localStorage.removeItem("color-scheme");
|
||||
}
|
||||
});
|
||||
<script src="/colorscheme.js">
|
||||
</script>
|
||||
<!-- End of component for color scheme selection -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue