Skip to content
Snippets Groups Projects
Commit 90412f51 authored by echicken's avatar echicken :chicken:
Browse files

Fix whoopsie in previous doopsie

parent 1adb2b36
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -93,13 +93,13 @@ function registerEventListener(scope, callback, params) {
document.addEventListener('DOMContentLoaded', () => {
// originally based on dark-mode-switch by Christian Oliff
if ($('#darkSwitch').length) {
$('#darkSwitch').checked = localStorage.getItem('darkSwitch') || (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
$('#darkSwitch').prop('checked', localStorage.getItem('darkSwitch') || (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches));
$('#darkSwitch').change(resetTheme);
resetTheme();
function resetTheme() {
if (this.checked) {
if ($('#darkSwitch').prop('checked')) {
$('body').addClass('dark');
localStorage.setItem('darkSwitch', 'dark');
localStorage.setItem('darkSwitch', true);
} else {
$('body').removeClass('dark');
localStorage.removeItem('darkSwitch');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment