您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
2/29/2024, 5:21:54 PM
// ==UserScript== // @name Reddit auto dark mode for newest UI // @namespace Violentmonkey Scripts // @match https://*.reddit.com/* // @grant none // @version 1.0 // @license MIT // @author - // @description 2/29/2024, 5:21:54 PM // ==/UserScript== const syncTheme = () => { const modeSwitch = document.querySelector('[name=darkmode-switch-name]') if (!modeSwitch) return console.warn(`Dark mode switch not found on reddit.com, skipping auto dark mode...`) const isLightToggled = modeSwitch.getAttribute('checked') === null; const lightMode = window.matchMedia('(prefers-color-scheme: light)').matches; if (isLightToggled !== lightMode) modeSwitch.click(); } addEventListener("load", () => { syncTheme(); window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', syncTheme); });