|
|
| Line 19: |
Line 19: |
| } | | } |
| }); | | }); |
|
| |
| defaultDarkModeToOs();
| |
|
| |
| function defaultDarkModeToOs() {
| |
| // Name of the cookie
| |
| var cookieName = "IdeaSuprememwclientpreferences";
| |
| // Desired value if not already set
| |
| var cookieValue = "skin-theme-clientpref-os";
| |
|
| |
| // If the cookie doesn’t exist, create it
| |
| if (!getCookie(cookieName)) {
| |
| // Set cookie to expire in 1 year
| |
| var expires = new Date();
| |
| expires.setFullYear(expires.getFullYear() + 1);
| |
| document.cookie = cookieName + "=" + encodeURIComponent(cookieValue) +
| |
| "; path=/; expires=" + expires.toUTCString();
| |
| }
| |
| }
| |
| // Helper function to get a cookie by name
| |
| function getCookie(name) {
| |
| var match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
| |
| return match ? decodeURIComponent(match[2]) : null;
| |
| }
| |