您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
黑暗模式
// ==UserScript== // @name 知乎黑暗模式 // @namespace http://tampermonkey.net/ // @version 1.2 // @description 黑暗模式 // @license GNU GPLv3 // @author lz // @match *://www.zhihu.com/* // @match *://zhuanlan.zhihu.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=zhihu.com // @run-at document-end // @grant GM_registerMenuCommand // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // ==/UserScript== let menu1 = GM_registerMenuCommand('黑暗模式', function () { if(location.href.endsWith("?theme=dark")||location.href.endsWith("?theme=light")){ var stringlength = location.href.length if(location.href.endsWith("?theme=dark")){ var newstring= location.href.substring(0, stringlength-11); }else{newstring= location.href.substring(0, stringlength-12); } location.assign(newstring+'?theme=dark'); }else{location.assign(location.href+'?theme=dark'); } }, 'o'); let menu2 = GM_registerMenuCommand('浅色模式', function () { if(location.href.endsWith("?theme=dark")||location.href.endsWith("?theme=light")){ var stringlength = location.href.length if(location.href.endsWith("?theme=dark")){ var newstring= location.href.substring(0, stringlength-11); }else{newstring= location.href.substring(0, stringlength-12); } location.assign(newstring+'?theme=light'); }else{location.assign(location.href+'?theme=light'); } }, 'o');