turns out this code was important

This commit is contained in:
floppydiskette 2024-01-22 01:33:40 +00:00
parent 1c1999f54a
commit 20acf67992
Signed by: fwoppydwisk
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
2 changed files with 18 additions and 1 deletions

View file

@ -51,3 +51,20 @@ function swapScheme(scheme) {
document.getElementById("css-colorscheme").href = `/css/colorschemes/${scheme}.css`; document.getElementById("css-colorscheme").href = `/css/colorschemes/${scheme}.css`;
console.log(`Set colorscheme to ${getCookie("colorscheme")}`) console.log(`Set colorscheme to ${getCookie("colorscheme")}`)
} }
function setSchemeSelector() {
if (!cookieExists("colorscheme")) {
setCookie("colorscheme", "catppuccin-macchiato", 90);
} else {
const scheme = getCookie("colorscheme");
const schemeselector = document.getElementById("scheme-selector");
if (scheme && schemeselector) {
for (let option of schemeselector.options) {
if (option.value == scheme) {
option.selected = true;
break;
}
}
}
}
}

View file

@ -4,7 +4,7 @@
@include('includes.head') @include('includes.head')
</head> </head>
<body> <body onload="setSchemeSelector()">
<div class="page"> <div class="page">
<div id="header" class="header"> <div id="header" class="header">
@include('includes.header') @include('includes.header')