给微信读书增加护眼模式
// ==UserScript== // @namespace yunyuyuan // @name 微信读书护眼模式 // @description 给微信读书增加护眼模式 // @match *://*.weread.qq.com/web/reader/* // @version 0.0.1.2 // @license MIT // ==/UserScript== (function () { 'use strict'; const epClass = '.epTheme'; const epColor = '#f1e5c9'; const style = document.createElement("style"); style.innerHTML = ` html body${epClass},${epClass} .readerContent .app_content, ${epClass} .readerTopBar, ${epClass} .readerControls_fontSize, ${epClass} .readerControls_item, ${epClass} .readerChapterContent_container, ${epClass} .readerChapterContent { background: ${epColor} !important; } ${epClass} .readerFooter_button { background-color: ${epColor}; color: black; border: 1px solid black; } `; document.head.appendChild(style); const controlContainer = document.querySelector('.readerControls'); const getInEP = document.createElement('button'); getInEP.className = 'readerControls_item'; getInEP.onclick = () => { document.body.classList.toggle(epClass.substring(1)); } getInEP.innerHTML = '<span>护眼</span>'; setTimeout(() => { controlContainer.appendChild(getInEP); },1000) })()