19 lines
462 B
JavaScript
19 lines
462 B
JavaScript
<script>
|
|
const defaultTheme = "/bigger.css";
|
|
|
|
// Set default if nothing is stored yet
|
|
if (!localStorage.getItem("theme")) {
|
|
localStorage.setItem("theme", defaultTheme);
|
|
}
|
|
|
|
// Load the selected theme
|
|
document.write(
|
|
`<link rel="stylesheet" href="${localStorage.getItem("theme")}">`
|
|
);
|
|
|
|
// Make function globally available to onclick
|
|
window.setTheme = function(themeFile) {
|
|
localStorage.setItem("theme", themeFile);
|
|
location.reload();
|
|
};
|
|
</script>
|