Greasy Fork is available in English.
Change Reddit's theme based on your system theme
< Відгуки до Reddit Auto Dark Mode
If you're a moderator of any subreddit, the script (as of version 1.0) will end toggling the Mod Mode switch instead of the Dark Mode switch. To fix that, change line 13 from return document.querySelector('faceplate-switch-input'); to return document.querySelector('#darkmode-list-item > div > span.flex.items-center.shrink-0 > span > faceplate-switch-input');
Additionally, if you have issues with the switch quickly going back and forth between dark/light mode (ending mismatched with the browser setting), try increasing the timeout on line 25 (e.g. change it to setTimeout(() => toggleTheme(darkMedia.matches), 500) -- 500 seems to always work, while the default 300 from the script it normally triggers this bug)...
The mod switch fix works great. The timeout change doesn't work for me on Firefox, dark mode flashes on briefly before returning to light mode. 300 still works fine strangely.
Thanks, fixed using your code
If you're a moderator of any subreddit, the script (as of version 1.0) will end toggling the Mod Mode switch instead of the Dark Mode switch. To fix that, change line 13 from
return document.querySelector('faceplate-switch-input');
toreturn document.querySelector('#darkmode-list-item > div > span.flex.items-center.shrink-0 > span > faceplate-switch-input');
Additionally, if you have issues with the switch quickly going back and forth between dark/light mode (ending mismatched with the browser setting), try increasing the timeout on line 25 (e.g. change it to
setTimeout(() => toggleTheme(darkMedia.matches), 500)
-- 500 seems to always work, while the default 300 from the script it normally triggers this bug)...