Files
Colormatic-Website/src/script/cookie.ts
Zakarya f81fa98851 Disable BG animation
I've made the tough decision to disable the BG animation by default.
It's just to heavy on performance and is somewhat distracting for some
people. I'm planning on making a toggle on it, but I'm not sure that
will be done by the next release.
2025-05-16 19:40:36 -07:00

28 lines
656 B
TypeScript

// The magic cookie system is so stupid
export function setCookie(
cname: string,
cvalue: string,
sameSite: string = "Lax",
) {
document.cookie =
cname + "=" + cvalue + ";" + "SameSite" + "=" + sameSite + ";";
}
// Credit: https://www.w3schools.com/js/js_cookies.asp
export function getCookie(cname: string): string {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(";");
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}