此提示来自于脚本:
移动页面的阅读模式
当前版本号: 0.0.6beta
只是希望能够稍微提高一点在移动端的阅读体验。
此提示会在 秒之后隐藏,刷新页面可以重新显示此提示。
// ==UserScript== // @name 移动页面的阅读模式 // @namespace Reading_mode_for_mobile_CN // @version 0.0.6beta // @description 只是希望能够稍微提高一点在移动端的阅读体验。 // @author 稻米鼠 // @run-at document-start // @icon https://i.v2ex.co/L00DUOAOl.png // @contributionURL https://script.izyx.xyz/reading-mode-for-mobile/ // @require https://cdn.bootcdn.net/ajax/libs/highlight.js/11.0.0-alpha0/highlight.min.js // @noframes // @antifeature payment // @match *://www.jianshu.com/p/* // @match *://www.zhihu.com/question/* // @match *://zhuanlan.zhihu.com/p/* // @grant none // @downloadURL https://update.greasyfork.icu/scripts/427549/%E7%A7%BB%E5%8A%A8%E9%A1%B5%E9%9D%A2%E7%9A%84%E9%98%85%E8%AF%BB%E6%A8%A1%E5%BC%8F.user.js // @updateURL https://update.greasyfork.icu/scripts/427549/%E7%A7%BB%E5%8A%A8%E9%A1%B5%E9%9D%A2%E7%9A%84%E9%98%85%E8%AF%BB%E6%A8%A1%E5%BC%8F.meta.js // ==/UserScript== (() => { "use strict"; var e = { 863: (e, t, o) => { o.d(t, { Z: () => l }); var r = o(645); var n = o.n(r); var i = n()((function(e) { return e[1]; })); i.push([ e.id, "/*\n\nAtom One Dark by Daniel Gamage\nOriginal One Dark Syntax theme from https://github.com/atom/one-dark-syntax\n\nbase: #282c34\nmono-1: #abb2bf\nmono-2: #818896\nmono-3: #5c6370\nhue-1: #56b6c2\nhue-2: #61aeee\nhue-3: #c678dd\nhue-4: #98c379\nhue-5: #e06c75\nhue-5-2: #be5046\nhue-6: #d19a66\nhue-6-2: #e6c07b\n\n*/\n\n.hljs {\n display: block;\n overflow-x: auto;\n padding: 0.5em;\n color: #abb2bf;\n background: #282c34;\n}\n\n.hljs-comment,\n.hljs-quote {\n color: #5c6370;\n font-style: italic;\n}\n\n.hljs-doctag,\n.hljs-keyword,\n.hljs-formula {\n color: #c678dd;\n}\n\n.hljs-section,\n.hljs-name,\n.hljs-selector-tag,\n.hljs-deletion,\n.hljs-subst {\n color: #e06c75;\n}\n\n.hljs-literal {\n color: #56b6c2;\n}\n\n.hljs-string,\n.hljs-regexp,\n.hljs-addition,\n.hljs-attribute,\n.hljs-meta-string {\n color: #98c379;\n}\n\n.hljs-built_in,\n.hljs-class .hljs-title {\n color: #e6c07b;\n}\n\n.hljs-attr,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-type,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-number {\n color: #d19a66;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link,\n.hljs-meta,\n.hljs-selector-id,\n.hljs-title {\n color: #61aeee;\n}\n\n.hljs-emphasis {\n font-style: italic;\n}\n\n.hljs-strong {\n font-weight: bold;\n}\n\n.hljs-link {\n text-decoration: underline;\n}\n", "" ]); const l = i; }, 152: (e, t, o) => { o.d(t, { Z: () => l }); var r = o(645); var n = o.n(r); var i = n()((function(e) { return e[1]; })); i.push([ e.id, '.rmfm-body-hidden{display:none !important}#reading-mode-for-mobile{position:fixed;top:0;left:0;width:100vw;height:100vh;margin:0;padding:0;overflow-y:auto;overflow-x:hidden;font-family:-apple-system,SF UI Text,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif;font-size:16px;line-height:1.8;background-color:#e0e0e4;box-sizing:border-box;z-index:2147483647}#reading-mode-for-mobile *{box-sizing:border-box}#reading-mode-for-mobile > article.rmfm-main{position:relative;width:100vw;max-width:800px;margin:0 auto;padding:36px 72px;background-color:#fff;box-shadow:0 0 72px rgba(0,0,0,0.1);color:#18181c}#reading-mode-for-mobile > article.rmfm-main > .rmfm-title,#reading-mode-for-mobile > article.rmfm-main > .rmfm-content{position:relative}#reading-mode-for-mobile > article.rmfm-main > .rmfm-title > .rmfm-section,#reading-mode-for-mobile > article.rmfm-main > .rmfm-content > .rmfm-section{border-top:3px solid #f0f0f4;padding:18px 0}#reading-mode-for-mobile h1,#reading-mode-for-mobile h2,#reading-mode-for-mobile h3,#reading-mode-for-mobile h4,#reading-mode-for-mobile h5,#reading-mode-for-mobile h6{line-height:2.16;margin:18px 0}#reading-mode-for-mobile h1{font-size:22.4px;font-weight:200;text-align:center}#reading-mode-for-mobile h2{font-size:20.8px;font-weight:200}#reading-mode-for-mobile h3{font-size:19.2px;font-weight:600;color:#505054}#reading-mode-for-mobile h4{font-size:17.6px;font-weight:600;color:#78787c}#reading-mode-for-mobile h5{font-size:17.6px;font-weight:400;color:#a0a0a4}#reading-mode-for-mobile h6{font-size:17.6px;font-weight:200;color:#c8c8cc}#reading-mode-for-mobile p{margin:18px 0;text-indent:2em}#reading-mode-for-mobile hr{height:3px;background-color:#f0f0f4;margin:18px 0}#reading-mode-for-mobile b,#reading-mode-for-mobile strong{color:#000}#reading-mode-for-mobile del{color:#c0c0c4}#reading-mode-for-mobile ul,#reading-mode-for-mobile ol{margin:18px 0 18px 36px}#reading-mode-for-mobile li > ol,#reading-mode-for-mobile li > ul{margin:0 0 0 36px}#reading-mode-for-mobile table{border:2px solid #e0e0e4;border-spacing:0}#reading-mode-for-mobile table tr,#reading-mode-for-mobile table td,#reading-mode-for-mobile table th{border:1px solid #e0e0e4}#reading-mode-for-mobile table td,#reading-mode-for-mobile table th{padding:9px 18px}#reading-mode-for-mobile img,#reading-mode-for-mobile video,#reading-mode-for-mobile embed,#reading-mode-for-mobile svg{max-width:100%}#reading-mode-for-mobile a{color:#f46;text-decoration:none}#reading-mode-for-mobile a:hover{text-decoration:underline}#reading-mode-for-mobile blockquote{background-color:rgba(0,0,32,0.05);border-left:5px solid rgba(0,0,32,0.08);padding:9px 18px;margin:18px 0}#reading-mode-for-mobile pre{margin:36px -72px;padding:18px 0;background-color:#282c34;color:#a8a8ac;white-space:pre-wrap;word-break:break-all}#reading-mode-for-mobile pre code{padding:18px 72px;position:relative;font-family:"Fira Code",monospace,MonoLisa,"source code pro","consolas"}#reading-mode-for-mobile pre code::before{content:\' \';position:absolute;height:100%;left:63px;top:0;z-index:100;border-left:1px solid #88888c}#reading-mode-for-mobile pre code .rmfm-code-line{position:relative}#reading-mode-for-mobile pre code .rmfm-code-line .rmfm-code-line-num{position:absolute;top:0;left:-90px;width:72px;height:100%;background-repeat:no-repeat;background-position:top right}#reading-mode-for-mobile #rmfm-menu{position:fixed;width:100vh;height:28.8px;top:calc(50vh - 14.4px);left:calc(14.4px - 50vh);transform:rotate(90deg)}#reading-mode-for-mobile #rmfm-menu .rmfm-menu-item{display:inline-block;padding:0 9px;cursor:pointer;color:#c0c0c4;font-size:12.8px}#reading-mode-for-mobile #rmfm-menu .rmfm-menu-item:hover{color:#f46}#reading-mode-for-mobile #rmfm-menu .rmfm-menu-hidden{display:none}#reading-mode-for-mobile .rmfm-menu-top,#reading-mode-for-mobile .rmfm-menu-bottom{float:left}#reading-mode-for-mobile .rmfm-menu-bottom{float:right}#reading-mode-for-mobile #rmfm-toc-list{position:fixed;top:0;left:0;z-index:-1;width:400px;max-width:90vw;margin:0;padding:9px 9px 9px 36px;font-size:12.8px}#reading-mode-for-mobile #rmfm-toc-list .rmfm-toc-item{cursor:pointer;list-style-type:disc;overflow-wrap:break-word;word-break:break-all}#reading-mode-for-mobile #rmfm-toc-list .rmfm-toc-item:hover{color:#f46}@media screen and (max-width:800px){#reading-mode-for-mobile > article.rmfm-main{padding:36px 9vw}#reading-mode-for-mobile pre{margin:36px -9vw}#reading-mode-for-mobile pre code{padding:18px -9vw 18px 72px}}', "" ]); const l = i; }, 920: (e, t, o) => { o.d(t, { Z: () => l }); var r = o(645); var n = o.n(r); var i = n()((function(e) { return e[1]; })); i.push([ e.id, "#reading-mode-for-mobile-start-card{width:100vw;height:100vh;position:fixed;bottom:0;left:0;background-color:rgba(0,0,0,0.8);z-index:2147483647}#reading-mode-for-mobile-start-card .start-content{position:absolute;bottom:0;width:90vw;left:5vw;text-align:center;box-sizing:border-box}#reading-mode-for-mobile-start-card .start-content p.rmfm-small-tip{font-size:12.8px;color:#a8a8ac;line-height:1.8;padding:0;margin:9px}#reading-mode-for-mobile-start-card .start-content .start-card{padding:18px 0}#reading-mode-for-mobile-start-card .start-content button{display:block;color:#909094;font-weight:200;line-height:1em;padding:16px;margin:8px auto}#reading-mode-for-mobile-start-card .start-content button#rmfm-show-button{background-color:#3ae;color:#fff;font-size:19.2px;border:1px solid #d0d0d4;border-radius:8px}#reading-mode-for-mobile-start-card .start-content button#rmfm-hide-button{font-size:48px}#reading-mode-for-mobile-start-card .start-content span#rmfm-countdown{font-weight:600;color:#f46}", "" ]); const l = i; }, 645: e => { e.exports = function(e) { var t = []; t.toString = function toString() { return this.map((function(t) { var o = e(t); if (t[2]) return "@media ".concat(t[2], " {").concat(o, "}"); return o; })).join(""); }; t.i = function(e, o, r) { if ("string" === typeof e) e = [ [ null, e, "" ] ]; var n = {}; if (r) for (var i = 0; i < this.length; i++) { var l = this[i][0]; if (null != l) n[l] = true; } for (var a = 0; a < e.length; a++) { var s = [].concat(e[a]); if (r && n[s[0]]) continue; if (o) if (!s[2]) s[2] = o; else s[2] = "".concat(o, " and ").concat(s[2]); t.push(s); } }; return t; }; } }; var t = {}; function __webpack_require__(o) { var r = t[o]; if (void 0 !== r) return r.exports; var n = t[o] = { id: o, exports: {} }; e[o](n, n.exports, __webpack_require__); return n.exports; } (() => { __webpack_require__.n = e => { var t = e && e.__esModule ? () => e["default"] : () => e; __webpack_require__.d(t, { a: t }); return t; }; })(); (() => { __webpack_require__.d = (e, t) => { for (var o in t) if (__webpack_require__.o(t, o) && !__webpack_require__.o(e, o)) Object.defineProperty(e, o, { enumerable: true, get: t[o] }); }; })(); (() => { __webpack_require__.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t); })(); var o = {}; (() => { const e = { "www.jianshu.com": { name: "JianShu", blockModal: true, rules: [ { urlReg: /\/p\/\w+/i, contentGetter: ".main-view .content", contentHandler: e => { e.querySelectorAll("img").forEach((e => { if (!e.src) e.src = e.getAttribute("data-original-src"); })); e.querySelectorAll('div[aria-label="3rd-ad"]').forEach((e => { e.parentNode.removeChild(e); })); } } ] }, "www.zhihu.com": { name: "Zhihu", blockModal: true, rules: [ { urlReg: /\/question\/\d+\/answer\/\d+/i, titleGetter: ".QuestionHeader-title", contentGetter: ".Question-main .QuestionAnswer-content", contentHandler: e => { e.querySelectorAll(`\n .ContentItem-actions,\n .ModalWrap,\n .ModalLoading-content,\n .CommentItemV2-footer,\n .RichContent--unescapable.is-collapsed .ContentItem-rightButton,\n .ContentItem.AnswerItem button.Button--primary`).forEach((e => { e.parentNode.removeChild(e); })); e.querySelectorAll(".CommentItemV2").forEach((e => { const t = document.createElement("br"); e.before(t); })); } }, { urlReg: /\/question\/\d+/i, titleGetter: ".QuestionHeader-title", contentGetter: ".Question-main .List-item", contentHandler: e => { e.querySelectorAll(`\n .ContentItem-actions,\n .ModalWrap,\n .ModalLoading-content,\n .CommentItemV2-footer,\n .RichContent--unescapable.is-collapsed .ContentItem-rightButton,\n .ContentItem.AnswerItem button.Button--primary`).forEach((e => { e.parentNode.removeChild(e); })); e.querySelectorAll(".CommentItemV2").forEach((e => { const t = document.createElement("br"); e.before(t); })); } } ] }, "zhuanlan.zhihu.com": { name: "Zhihu Zhuanlan", blockModal: true, rules: [ { urlReg: /\/p\/\d+/i, titleGetter: "h1.Post-Title", contentGetter: ".Post-RichTextContainer" } ] } }; const t = e; const o = null && [ "EnterPage", "StartCard", "ReadingMode" ]; const r = { redirect: [ "pushState", "replaceState", "popstate" ], sameSite: [ "pushState", "replaceState", "popstate", "alert", "confirm" ] }; const valORnull = e => e ? e : null; const n = { state: { is_debug: 0, auto_reading_mode: 0, log: [], warn: [], el: {}, restore: {}, pos: {}, rule: {}, modal: [ "alert", "confirm" ], toc: [] }, get is_debug() { return this.state.is_debug; }, get auto_reading_mode() { return this.state.auto_reading_mode; }, get modal() { return this.state.modal; }, log(e, t) { if (this.is_debug) this.state.log.push((new Date).toLocaleString() + (e ? " " + e : "") + ": " + ([ "string", "number" ].includes(typeof t) ? t : JSON.stringify(t))); }, warn(e, t) { this.state.warn.push((new Date).toLocaleString() + (e ? " " + e : "") + ": " + ([ "string", "number" ].includes(typeof t) ? t : JSON.stringify(t))); }, exposeState() { if (this.is_debug) this.log("State expose", "Debug: " + this.is_debug); if (this.is_debug) window.rmfmState = this.state; }, setRestore(e, t = null) { if (this.is_debug) this.log("State set Restore", { name: e, method: t }); if (t) { this.state.restore[e] = t; return; } delete this.state.restore[e]; }, getRestore(e) { if (this.is_debug) this.log("State get Restore", { name: e, el: valORnull(this.state.restore[e]) }); return valORnull(this.state.restore[e]); }, restore(e = []) { if (this.is_debug) this.log("State restore", e); if ("string" === typeof e) e = r[e] ? r[e] : []; const t = this.state.restore; for (const o in t) { if (e.includes(o)) continue; this.getRestore(o)(); this.setRestore(o); } }, getKeys(e) { if (this.is_debug) this.log("State get keys", { name: e, keys: Object.keys(this.state[e]) }); return Object.keys(this.state[e]); }, addToc(e) { if (this.is_debug) this.log("State set TOC", e); this.state.toc.push(e); }, getToc() { if (this.is_debug) this.log("State get TOC", this.state.toc); return this.state.toc; }, clearEls() { this.getKeys("el").forEach((e => { if ("el_root" === e) return; delete this.state.el[e]; })); } }; const i = { el: [ "root", "startCard", "readingMode", "main", "title", "content", "menu", "toc", "tocList" ], rule: [ "site", "default", "now" ], pos: [ "toc", "menu" ] }; for (const e in i) for (const t of i[e]) { const o = e + "_" + t; Object.defineProperty(n, o, { get: function() { if (this.is_debug) this.log("Store " + e + " get", o); return this.state[e][o]; }, set: function(t) { if (this.is_debug) this.log("Store " + e + " set", o + " = " + t); this.state[e][o] = t; } }); } n.exposeState(); const l = n; var a = __webpack_require__(920); var s = '
此提示来自于脚本:
移动页面的阅读模式
当前版本号: 0.0.6beta
只是希望能够稍微提高一点在移动端的阅读体验。
此提示会在 秒之后隐藏,刷新页面可以重新显示此提示。
\s*(
\s*)*<\/p>/g, "").replace(/(
\s*){2,}/g, "
");
}));
};
const highlightCode = () => {
const e = l.el_content.querySelectorAll("pre");
if (e) {
e.forEach((e => {
const t = e.querySelector("code");
if ("undefined" !== typeof hljs) hljs.highlightBlock(t); else t.classList.add("hljs");
setLineNumber(t);
}));
l.el_readingMode.querySelector("style").innerHTML = u.Z + "\n" + l.el_readingMode.querySelector("style").innerHTML;
}
};
const generateLineNumber = (e, t) => {
const o = document.createElement("canvas");
const r = o.getContext("2d");
const n = {
font: t.fontSize + " " + (t.fontFamily ? t.fontFamily : window.getComputedStyle(document.body).fontFamily),
textAlign: "right",
fillStyle: "#999999"
};
for (const e in n) r[e] = n[e];
t.width = r.measureText(e).width;
t.height = Number(t.lineHeight.replace("px", ""));
o.width = t.width;
o.height = t.height;
for (const e in n) r[e] = n[e];
const i = t.height / 2 + Number(t.fontSize.replace("px", "")) / 2;
r.fillText(e, t.width, i);
return o.toDataURL("image/png");
};
const setLineNumber = e => {
const t = e ? [ e ] : [];
t.forEach((e => {
const t = window.getComputedStyle(e);
const o = {
fontSize: t.fontSize,
fontFamily: t.fontFamily,
lineHeight: t.lineHeight
};
e.innerHTML = e.innerHTML.split("\n").map(((e, t) => {
const r = t + 1;
const n = generateLineNumber(r, o);
return '