- This site uses cookies to store information about your browsing activity.
+ This site uses your browser's local storage to store information about your browsing activity.
For more information, check out the privacy policy.
Have a nice day!
`);
$("#notif-close").on("click", function () {
- setCookie("notification", "true", 365);
+ localStorage.setItem("notification", "true");
});
-}
\ No newline at end of file
+}
diff --git a/main/scripts/main.js b/main/scripts/main.js
index d52c200..b981651 100644
--- a/main/scripts/main.js
+++ b/main/scripts/main.js
@@ -1,7 +1,10 @@
-const darkCookie = getCookie("dark");
-const dark = darkCookie == undefined ? window.matchMedia("(prefers-color-scheme: dark)").matches : darkCookie == "true";
+const darkCookie = localStorage.getItem("dark");
+const dark = darkCookie === null ? window.matchMedia("(prefers-color-scheme: dark)").matches : darkCookie === "true";
if (dark)
- addStyle("/style/dark.css");
+ $('head').append($("", {
+ rel: "stylesheet",
+ href: "/style/dark.css"
+ }));
// redirect legacy anchors
if (/^#privacy\/?$/.test(location.hash))
@@ -21,8 +24,8 @@ $(function () {
let mode = $('#dark-mode');
mode.prop('checked', dark);
mode.on('click', function () {
- setCookie("dark", $(this).prop('checked'), 365);
+ localStorage.setItem("dark", $(this).prop('checked'));
location.hash = "";
location.reload();
});
-});
\ No newline at end of file
+});
diff --git a/main/scripts/util.js b/main/scripts/util.js
deleted file mode 100644
index ee0b4ef..0000000
--- a/main/scripts/util.js
+++ /dev/null
@@ -1,30 +0,0 @@
-function getCookie(key) {
- let match = new RegExp(`${key}=([^;]+);?`, "g").exec(document.cookie);
- return match ? match[1] : undefined;
-}
-
-function setCookie(key, value, days) {
- let date = new Date();
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
- document.cookie = `${key}=${value}; expires=${date.toUTCString()}; path=/`;
-}
-
-function forceToAnchor(customAnchor) {
- let anchor = customAnchor || location.hash;
- // this is probably a terrible hack
- if (anchor.startsWith("#")) {
- let element = $(anchor);
- if (element.length) {
- $('html, body').animate({
- scrollTop: element.offset().top
- }, 0);
- }
- }
-}
-
-function addStyle(path) {
- $('head').append($("", {
- rel: "stylesheet",
- href: path
- }));
-}
\ No newline at end of file