// ==UserScript== // @name 微信读书网页版 · 背景颜色主题 // @name:zh-CN 微信读书网页版 · 背景颜色主题 // @namespace https://github.com/ForestSun2023 // @version 3.3.0 // @description 给微信读书网页版阅读页补上手机 App 才有的「亮度 / 颜色 / 背景」功能:白天三色(白 / 米黄 / 青绿)× 五种纸张背景。白天/黑夜沿用站点原生的「深色」按钮,黑夜模式完全用官方原装外观。 // @author ForestSun // @license MIT // @homepageURL https://github.com/ForestSun2023/weread-bg-theme // @supportURL https://github.com/ForestSun2023/weread-bg-theme/issues // @icon https://raw.githubusercontent.com/ForestSun2023/weread-bg-theme/main/assets/icon-96.png // @match https://weread.qq.com/web/reader/* // @match https://weread.qq.com/web/* // @run-at document-idle // @grant none // @noframes // @downloadURL https://raw.githubusercontent.com/ForestSun2023/weread-bg-theme/main/weread-bg-theme.user.js // @updateURL https://raw.githubusercontent.com/ForestSun2023/weread-bg-theme/main/weread-bg-theme.user.js // ==/UserScript== /* * 工作原理(基于对 weread.qq.com 阅读页 DOM 的实测): * · 阅读区背景画在 .readerContent .app_content 上,顶栏 .readerTopBar,悬浮按钮 .readerControls_item; * · 正文是逐字绝对定位的 ,颜色继承自 .readerChapterContent; * · 上的 wr_whiteTheme 是「浅色主题」开关,站点 CSS 的默认(无该类)即深色; * · 右侧工具条 .readerControls 为 position:fixed; z-index:90,其子元素绝对定位可溢出到左侧。 * 因此本脚本: * 1) 在 .readerControls 里插入一个「背景」按钮(位置与原生按钮一致、样式沿用 readerControls_item); * 2) 用自带