// ==UserScript== // @name 笔趣阁外观优化 // @namespace https://gitee.com/linhq1999/OhMyScript // @version 1.1 // @description 专注阅读 // @author LinHQ // @match https://www.shuquge.com/txt/* // @inject-into content // @downloadURL none // ==/UserScript== 'use strict'; (function () { var oldCfg = localStorage.getItem("bqg_cfg"); var cfg = oldCfg === null ? { "fontSize": 1.2, "lineHeight": 1.5 } : JSON.parse(oldCfg); new MutationObserver(function (_, ob) { var _document$querySelect, _document$querySelect2, _document$querySelect3; (_document$querySelect = document.querySelector("div.header")) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.remove(); (_document$querySelect2 = document.querySelector("div.link")) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.remove(); (_document$querySelect3 = document.querySelector("div.nav")) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.remove(); document.body.style.backgroundColor = '#EAEAEF'; var mainWin = document.querySelector("div.book.reader"); mainWin.style.width = '50%'; mainWin.style.border = '2px double gray'; var title = mainWin.getElementsByTagName("h1")[0]; title.style.color = "black"; title.style.fontFamily = "楷体"; var textWin = document.querySelector("#content"); textWin.style.fontFamily = 'kaiti'; textWin.style.fontSize = cfg.fontSize + "rem"; textWin.style.lineHeight = cfg.lineHeight + "rem"; document.body.onkeydown = function (ev) { switch (ev.key) { case "-": cfg.fontSize -= 0.1; textWin.style.fontSize = "".concat(cfg.fontSize, "rem"); break; case "=": cfg.fontSize += 0.1; textWin.style.fontSize = "".concat(cfg.fontSize, "rem"); break; default: break; } cfg.lineHeight = cfg.fontSize + 0.3; textWin.style.lineHeight = "".concat(cfg.lineHeight, "rem"); localStorage.setItem("bqg_cfg", JSON.stringify(cfg)); }; if (textWin !== null || textWin !== undefined) ob.disconnect(); }).observe(document.body, { subtree: true, childList: true }); })();