summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2024-01-26 12:26:48 +0000
committerFrankie B <git@diskfloppy.me>2024-01-26 12:26:48 +0000
commitbf5df323d29a07e36d4cb71b38405b65da36ca04 (patch)
tree69904e1c8035817d13f9f72e532108e50c263e01
parentfdeb7f1c48dad903b5c6f0297ce363eb71b9d216 (diff)
Improve schemeSwap.js
-rw-r--r--public/js/schemeSwap.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/public/js/schemeSwap.js b/public/js/schemeSwap.js
index e048f6a..d1d01c0 100644
--- a/public/js/schemeSwap.js
+++ b/public/js/schemeSwap.js
@@ -9,10 +9,10 @@ function getCookie(cname) {
let ca = decodedCookie.split(';');
for(let i = 0; i <ca.length; i++) {
let c = ca[i];
- while (c.charAt(0) == ' ') {
+ while (c.charAt(0) === ' ') {
c = c.substring(1);
}
- if (c.indexOf(name) == 0) {
+ if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
@@ -29,7 +29,7 @@ function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
let expires = "expires="+ d.toUTCString();
- document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
+ document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;SameSite=Strict";
}
/**
@@ -57,10 +57,10 @@ function setSchemeSelector() {
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) {
+ const scheme_selector = document.getElementById("scheme-selector");
+ if (scheme && scheme_selector) {
+ for (let option of scheme_selector.options) {
+ if (option.value === scheme) {
option.selected = true;
break;
}