Modify the `theme` value inside the cookie so reddit can switch dark mode automatically
当前为
// ==UserScript==
// @name Reddit Theme Cookie Modifier
// @namespace http://tampermonkey.net/
// @version 0.12
// @description Modify the `theme` value inside the cookie so reddit can switch dark mode automatically
// @author Orthon Jiang
// @match *://*.reddit.com/*
// @icon https://www.reddit.com/favicon.ico
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
function setThemeValue() {
const cookies = document.cookie.split('; ');
const themeCookies = cookies.filter(c => c.startsWith('theme='));
if (themeCookies.length === 0)
return;
document.cookie = "theme=0; path=/";
}
setThemeValue();
setInterval(setThemeValue, 2000);
})();