// ==UserScript== // @name CSDN Focus // @description 🌚 黑暗模式上线, 一键变天 | CSDN, 脚本之家 无弹窗无广告无任何干扰, 自动展开文章和评论, 外链直达! 隐藏属性等你发现, 不试一下? 😃 // @version 1.5 // @author Finn // @namespace https://github.com/Germxu // @homepage https://github.com/Germxu/Scripts-for-TamperMonkey // @supportURL https://github.com/Germxu/Scripts-for-TamperMonkey/issues/new // @run-at document-start // @match blog.csdn.net/*/article/details/* // @match *.blog.csdn.net/article/details/* // @match www.jb51.net/article/* // // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @license MIT // @compatible chrome 54+ // @compatible firefox 49+ // // @note V1.5 重要更新: 添加黑暗模式, 一键切换, 优化精简大量静态代码,修复隐性Bug // @note V1.2 优化:作者标签显示为作者名字, 竖排以减小显示遮挡, 优化动作 // @note V1.1 添加隐藏内容提示标签, 侧边栏和推荐阅读 // @note V1.0 添加脚本之家页面净化 jb51.net 净化 // @downloadURL none // ==/UserScript== (function () { 'use strict'; const h = document.documentElement; let FinnData = new Proxy(GM_getValue('FinnData', {}), { get(target, key) { return Reflect.get(target, key); }, set(target, key, val) { if (key === "dark") { if (val) { h.setAttribute("darkMode", true); } else { h.removeAttribute("darkMode"); } } Reflect.set(target, key, val); GM_setValue('FinnData',FinnData); return true; }, deleteProperty(target, key) { Reflect.deleteProperty(target, key); GM_setValue('FinnData',FinnData); return true; } }) FinnData.dark && h.setAttribute("darkMode", true); const csdn = `