Circle 阅读助手脚本版

让网页赏心悦目、让阅读回归初心。Circle 阅读助手提供更隐私、更轻松、更舒适的阅读体验。

// ==UserScript==
// @name         Circle 阅读助手脚本版
// @namespace    https://ranhe.xyz/
// @version      0.0.1
// @description  让网页赏心悦目、让阅读回归初心。Circle 阅读助手提供更隐私、更轻松、更舒适的阅读体验。
// @author       wenguang.fe@gmail.com
// @match        https://*/*
// @match        http://*/*
// @license MIT
// @noframes
// ==/UserScript==

(() => {
	"use strict";

	function e(e) {
		return e && e.nodeType && 1 === e.nodeType
	}

	function t(e) {
		if (!c(e)) return !1;
		var t = e.nodeValue.trim();
		return t.length <= 0 || /^[\s\xA0]+$/.test(t)
	}

	function n(e, t) {
		return Object.prototype.toString.call(e) === "[object ".concat(t, "]")
	}

	function r(e) {
		return n(e, "Undefined")
	}

	function i(e) {
		return n(e, "Number")
	}

	function a(e) {
		return n(e, "String")
	}

	function o(e) {
		return n(e, "Function")
	}

	function l(e) {
		return n(e, "Array")
	}

	function c(e) {
		return n(e, "Text")
	}

	function u(e, t) {
		return e && e.tagName && e.tagName.toLowerCase() === t
	}

	function s(e) {
		e && e.parentElement && e.parentElement.removeChild(e)
	}

	function d(e) {
		return a(e) ? e.toLowerCase() : ""
	}

	function f(e, t) {
		var n = document.createElement(e);
		return h(t, (function(e, t) {
			g(n, t, e)
		})), n
	}

	function h(e, t) {
		if (!r(e) && o(t)) {
			var n = 0;
			if (e.forEach) {
				var i = e.length;
				if (i <= 0) return;
				for (; n < i && !t(e[n], n);) n++
			} else {
				var a = Object.keys(e),
					l = a.length;
				if (l <= 0) return;
				for (; n < l && !t(e[a[n]], a[n]);) n++
			}
		}
	}

	function v(e, t) {
		return e[t] ? e[t] : e.style && e.style[t] ? e.style[t] : window.getComputedStyle ? window.getComputedStyle(e, null)[t] : e.currentStyle ? e.currentStyle[t] : void 0
	}

	function m(e, t, n) {
		if (e && a(t) && !r(n)) {
			var o = i(n) && !["zIndex", "opacity"].includes(t) ? "".concat(n, "px") : n;
			e.style[t] = o
		}
	}

	function p(e, t) {
		if (e) return a(t) ? e.getAttribute(t) : Array.prototype.slice.call(e.attributes)
			.reduce((function(e, t) {
				return "".concat(e, " ")
					.concat(t.nodeValue)
			}), "")
	}

	function g(e, t, n) {
		if (e && e.setAttribute && a(t) && !r(n)) {
			var o = i(n) && !["zIndex", "opacity"].includes(t) ? "".concat(n, "px") : n;
			switch (t) {
				case "innerHTML":
				case "innerText":
				case "className":
				case "textContent":
					e[t] = o;
					break;
				case "style":
					h(n, (function(t, n) {
						m(e, n, t)
					}));
					break;
				default:
					e.setAttribute(t, o)
			}
		}
	}

	function y(e, t) {
		if (e)
			if (a(t)) e.removeAttribute(t);
			else {
				var n = [];
				h(e.attributes, (function(e) {
					var r = e.nodeName;
					o(t) && t(r) && n.push(r)
				})), h(n, (function(t) {
					e.removeAttribute(t)
				}))
			}
	}

	function b(e) {
		var t = e.getElementsByTagName("a"),
			n = 0;
		h(t, (function(e) {
			n += S(e)
				.length
		}));
		var r = S(e)
			.length;
		return n / (r <= 0 ? 1 : r)
	}

	function E(t) {
		if (!e(t)) return !1;
		if (["br", "hr", "img", "body"].includes(d(t.tagName))) return !0;
		var n = t.getBoundingClientRect();
		return !(n.height <= 0 || n.width <= 0) && ("0" !== v(t, "opacity") && "hidden" !== v(t, "visibility"))
	}

	function S(t) {
		if (!t) return "";
		var n = "";
		a(t) ? n = t : c(t) ? n = t.nodeValue : e(t) && (n = t.textContent);
		var r = (n || "")
			.trim();
		return r.length > 0 ? r.replace(/^&nbsp;+|&nbsp;+$/g, "") : ""
	}

	function w(e) {
		if (e && e.getBoundingClientRect) {
			if (e._rect) return e._rect;
			var t = window.scrollX,
				n = window.scrollY,
				r = e.getBoundingClientRect();
			return t <= 0 && n <= 0 ? (e._rect = r, e._rect) : (e._rect = {
				top: r.top + n,
				right: r.right - t,
				bottom: r.bottom - n,
				left: r.left + t,
				width: r.width,
				height: r.height
			}, e._rect)
		}
	}

	function C(e, t, n) {
		for (var r, i = document.createNodeIterator(e, NodeFilter.SHOW_TEXT, {
			acceptNode: function(e) {
				return t(e) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
			}
		}); r = i.nextNode();) n(r)
	}

	function x(e) {
		return !a(e) || e.trim()
			.length <= 0 ? 0 : /[\u4e00-\u9fa5]/.test(e) ? e.length : e.split(" ")
			.length
	}

	function N(e) {
		var t = "";
		h(e.attributes, (function(e) {
			var n = e.nodeName;
			if (!["class", "role", "src", "alt"].includes(n) && !/thumbnail/i.test(n)) {
				var r = "".concat(e.nodeValue);
				return (r.startsWith("http") || /src|url|origin/i.test(n)) && r.split("/")
					.length > 1 && r.length > 10 ? (t = r.split(/\s/)
						.shift(), !0) : void 0
			}
		}));
		var n = t || e.src;
		if (n && !n.endsWith("svg")) return n;
		var r = "".concat(window.getComputedStyle(e)
				.backgroundImage)
			.replace(/url\("(.*?)"\)/, "$1");
		return a(r) && "none" !== r && r.split("/")
			.length > 1 ? r : ""
	}

	function L(e) {
		for (var t = []; e;) {
			var n = e.id;
			if (n) {
				t.unshift("#".concat(n));
				break
			}
			var r = e.tagName.toLocaleLowerCase();
			if ("body" === r || "html" === r) {
				t.unshift(r);
				break
			}
			for (var i = 1, a = e.previousElementSibling; a;) i++, a = a.previousElementSibling;
			t.unshift("".concat(r, ":nth-child(")
				.concat(i, ")")), e = e.parentElement
		}
		return t.join(" > ")
	}

	function k(n) {
		var r = 0;
		return h(n.childNodes, (function(n) {
			!e(n) && t(n) || r++
		})), r
	}
	var A = ["div"],
		T = ["div", "span", "p"],
		q = ["i", "em"],
		j = /^on|^data|^id$|^style$|placeholder|spellcheck|contenteditable/,
		O = ["size", "face", "color"],
		_ = ['[id*="comment"]', '[class*="comment"]'],
		B = ['[id*="Modal"]', '[class*="Modal"]', '[id*="modal"]', '[class*="modal"]'],
		W = ["h1", "h2", "h3", "h4", "h5", "h6"],
		z = ["border", "hspace", "vspace", "align"],
		P = ["noscript", "form", "input", "textarea", "button", "style", "script", "link", "ins", "iframe", "canvas", "footer", "aside"],
		M = ["b", "strong", "h1", "h2", "h3", "h4", "h5", "h6", "th"];

	function V(e, t, n) {
		var r = f(t),
			i = e.mirrorElement;
		for (i && (r.mirrorElement = i); e.firstChild;) r.appendChild(e.firstChild);
		return !n && h(e.attributes, (function(e) {
			var t = e.nodeName,
				n = e.nodeValue;
			n && g(r, t, n)
		})), e.parentElement.replaceChild(r, e), r
	}

	function R(e) {
		var t = f("dom");
		t.innerHTML = e.innerHTML;
		var n = t.children;
		if (1 === n.length && u(n[0], "img")) return n[0].src
	}

	function I(t, n) {
		for (var r = t; r && (c(r) || e(r) && ["a", "span"].includes(r.nodeName.toLowerCase()));) r = n(r)
	}

	function F(e, t, n) {
		h(t, (function(t) {
			var r = n[t];
			r && "normal" !== r && m(e, t, r)
		}))
	}

	function H(e) {
		var t = e.src;
		t && t.startsWith("data") && e.classList.add("base64");
		var n = e.naturalWidth,
			r = e.naturalHeight;
		n <= 0 || r <= 0 || (e.classList.remove("tiny", "large"), n < 78 && r < 78 ? e.classList.add("tiny") : e.classList.add("large"))
	}

	function $(e) {
		h(e.querySelectorAll("div, ol, ul, li, section"), (function(e) {
			k(e) <= 0 && s(e)
		})), h(e.querySelectorAll("ul, ol"), (function(e) {
			e.querySelectorAll("*")
				.length > e.innerText.replace(/\n/gi, "")
				.length && s(e)
		}));
		for (var n = e.firstChild, r = function() {
			if (!c(n)) return n = n.nextSibling, "continue";
			var e = S(n);
			if (x(e) <= 0) return n = n.nextSibling, "continue";
			var t = f("p"),
				r = f("span");
			return r.textContent = e, t.appendChild(r), I(n.previousSibling, (function(e) {
				return t.insertBefore(e, r), e.previousSibling
			})), n.parentElement.replaceChild(t, n), (n = t.nextSibling) ? (I(n, (function(e) {
				return t.appendChild(e), n = t.nextSibling
			})), n ? void(n = n.nextSibling) : "break") : "break"
		}; n;) {
			var i = r();
			if ("continue" !== i && "break" === i) break
		}
		var a = e.querySelectorAll("br");
		a.length >= 2 && h(a, (function(e) {
			var n = function(e) {
					for (var n = e.nextSibling; n && c(n) && t(n);) n = n.nextSibling;
					return n
				}(e),
				r = function(e) {
					for (var n = e.previousSibling; n && c(n) && t(n);) n = n.previousSibling;
					return n
				}(e);
			(n || r) && (c(r) || c(n)) || s(e)
		})), h(e.querySelectorAll("p"), (function(e) {
			var t = e.getElementsByTagName("br");
			if (!(t.length <= 1)) {
				var n = [],
					r = e.parentElement,
					i = e.nextSibling;
				h(t, (function(e) {
					if (e) {
						var t = e.nextSibling;
						if (t) {
							for (var a, o = f("p"); t && !u(t, "br");) a = t.nextSibling, o.appendChild(t), t = a;
							i ? r.insertBefore(o, i) : r.appendChild(o), n.push(e)
						}
					}
				})), h(n, s)
			}
		})), h(e.querySelectorAll("p, span, li"), (function(e) {
			var t = e.childNodes;
			if (t.length <= 0) s(e);
			else if (1 === t.length && u(t[0], "br")) s(e);
			else {
				var n = t[0];
				if (c(n)) {
					var r = n.nodeValue;
					r.length > 0 && /^\s+/.test(r) && (n.nodeValue = r.trim())
				}
			}
		})), h(e.querySelectorAll("pre"), (function(e) {
			var t = e.parentElement;
			if (t && u(t, "td") && !t.classList.contains("gutter")) {
				var n = t.closest("table");
				if (n) {
					var r = n.querySelectorAll("tr");
					if (1 === r.length)
						if (!(r[0].querySelectorAll("td")
							.length > 2)) {
							var i = n.parentElement;
							i && i.replaceChild(e, n)
						}
				}
			}
		})), h(e.querySelectorAll(".flex"), (function(e) {
			var t = e.querySelectorAll("pre");
			t.length <= 0 || h(t, (function(e) {
				var t = e.parentElement;
				t.classList.contains("zone-width") || t.classList.add("zone-width")
			}))
		})), T.forEach((function(t) {
			h(e.querySelectorAll(t), (function(e) {
				e.childNodes.length <= 0 && s(e)
			}))
		}))
	}

	function D(t, n, r) {
		! function(t) {
			h(t.querySelectorAll(P.join(",")), s), h(t.querySelectorAll(B.join(",")), (function(e) {
				e.mirrorElement && !E(e) && s(e)
			}));
			var n = [];
			if (h(t.querySelectorAll(_.join(",")), (function(e) {
				if (u(e, "div")) {
					var t = e.mirrorElement;
					if (t) {
						var r = t.getBoundingClientRect();
						r.width <= 0 || r.height <= 200 || n.push(e)
					}
				}
			})), n.length > 0) {
				for (var r = n[0]; r.parentElement !== t;) r = r.parentElement;
				r !== t && s(r)
			}
			h(t.querySelectorAll("li"), (function(e) {
				var t = e.querySelectorAll("div"),
					n = e.querySelectorAll("img");
				t.length > 0 && n.length > 0 && b(e) > .8 && s(e)
			})), h(t.querySelectorAll("font"), (function(e) {
				y(e, (function(e) {
					return O.includes(e)
				}))
			})), h(t.querySelectorAll("img"), (function(t) {
				if (y(t, (function(e) {
					return z.includes(e)
				})), t.addEventListener("error", (function() {
					s(t)
				})), t.complete && H(t), t.addEventListener("load", (function() {
					H(t)
				})), t && t.mirrorElement) {
					var n = t.mirrorElement,
						r = n.nextSibling,
						i = n.previousSibling,
						a = "";
					if (i && u(i, "noscript")) {
						var o = R(i);
						o && (a = o)
					} else if (r && u(r, "noscript")) {
						var l = R(r);
						l && (a = l)
					} else {
						var c = n.closest("figure");
						if (c && e(c)) {
							var d = c.querySelectorAll("noscript");
							if (1 === d.length) {
								var f = R(d[0]);
								f && (a = f)
							}
						}
					}!a && (a = N(n)), a && p(t, "src") !== a ? g(t, "src", a) : n.addEventListener("load", (function() {
						g(t, "src", n.src)
					})), !p(t, "src") && s(t)
				}
			}))
		}(t),
		function(e, t, n) {
			var r = 0,
				i = 0,
				o = 0,
				l = 0;

			function c(e) {
				r && (r += e), i && (i += e), o && (o += e), l && (l += e)
			}
			for (var u = e, d = [], f = w(e.mirrorElement || e); u;) {
				var v = void 0,
					g = u.mirrorElement;
				if (g) {
					var E = u.nodeName.toLowerCase(),
						C = window.getComputedStyle(g),
						x = C.float,
						N = C.display;
					if ("none" !== N && "0" !== C.opacity || "img" !== E && "hidden" === C.visibility && (v = u), !v) {
						var L = S(u),
							k = ["目录", "大纲"];
						n && k.push(n), t && k.push(t), k.includes(L) && (v = u)
					}
					if (u !== e) {
						if (!v) {
							y(u, (function(e) {
								return j.test(e)
							}));
							var T = u.className;
							T && (a(T) && ("td" === E && "gutter" === T || T.indexOf("crayon-") >= 0) || u.removeAttribute("class"))
						}
						if (!v) {
							var O = C.clear;
							O && "both" === O && u.classList.add("both");
							var _ = window.getComputedStyle(g, ":after")
								.clear;
							_ && "both" === _ && u.classList.add("both")
						}
					}
					if (!v && u !== e) {
						if ("div" === E) {
							var B = g.querySelectorAll("blockquote, dl, div, ol, p, pre, table, ul");
							if (!(r || x && "none" !== x) && B.length <= 0) {
								var z = V(u, "p");
								E = "p", u = z, g = z.mirrorElement
							} else "inline-block" === N && u.classList.add("inline-block")
						} else E.includes("-") && E.indexOf("inner") <= -1 && ["block", "inline-block", "flex", "inline-flex"].includes(N) && u.classList.add(N);
						A.includes(E) && g.querySelectorAll("img")
							.length > 0 && ["flex", "inline-flex"].includes(N) && (u.classList.add(N), F(u, ["align-items", "justify-content"], C))
					}
					if (!v) {
						var P = w(g);
						"img" !== E && u !== e && (!r && x && "none" !== x && (P.height >= 130 || g.childElementCount > 0) && (r = 1), !o && C.fontStyle && "normal" !== C.fontStyle && (u !== e && !q.includes(E) && (u.style.fontStyle = C.fontStyle), o = 1), !l && C.fontWeight && "normal" !== C.fontWeight && C.fontWeight > 400 && (u !== e && !M.includes(E) && (u.style.fontWeight = C.fontWeight), l = 1));
						var R = C.width || P.width;
						r && 1 === r && (P.width === f.width ? u.classList.add("full-width") : g.querySelectorAll("img")
							.length > 0 && (x && "none" !== x && !W.includes(E) && u.classList.add(x), !W.includes(E) && R && "auto" !== R && parseFloat(R) > 10 && m(u, "maxWidth", R)));
						var I = void 0;
						switch (E) {
							case "svg":
								"absolute" === C.position && R && "auto" !== R && parseFloat(R) < 80 && (v = u);
								break;
							case "table":
								!i && (i = 1);
								break;
							case "img":
								r && x && "none" !== x && m(u, "float", x), !i && R && "auto" !== R && parseFloat(R) > 10 && !g.classList.contains("lazy") && m(u, "maxWidth", R), F(u, ["border-radius"], C);
								break;
							case "a":
								if ((I = p(u, "href")) && I.length && ("#" === I[0] || "javascript:" === I.substring(0, 11)))
									if (b(u.parentElement) > .8) v = u;
									else {
										var H = u.mirrorElement,
											$ = V(u, "span", !0);
										$.mirrorElement = H, E = "span", u = $
									}
						}
					}
				}
				var D = u.firstElementChild;
				if (D) u = D, c(1);
				else {
					for (var K = void 0; u !== e && !(K = u.nextElementSibling);) u = u.parentElement, c(-1);
					if (u === e) {
						v && s(v);
						break
					}
					u = K, 1 === r && (r = 0), 1 === i && (i = 0), 1 === o && (o = 0), 1 === l && (l = 0)
				}
				v && d.push(v)
			}
			h(d, s)
		}(t, n, r), $(t)
	}

	function K(e) {
		for (var t = e, n = e.cloneNode(!0); t;) {
			n.mirrorElement = t;
			var r = t.firstElementChild;
			if (r) t = r, n = n.firstElementChild;
			else {
				for (var i = void 0; t !== e && !(i = t.nextElementSibling);) t = t.parentElement, n = n.parentElement;
				if (t === e) break;
				t = i, n = n.nextElementSibling
			}
		}
		return n
	}

	function U(t) {
		var n = t.url,
			r = t.cover,
			i = t.time,
			o = t.title,
			l = t.article;
		h(l.querySelectorAll("div,p"), (function(e) {
			e.childNodes.length <= 0 && s(e)
		}));
		for (var d, v = l; e(d = v) && 1 === k(d);) {
			var m = v.firstElementChild;
			e(m) && (v = m)
		}
		if (u(v, "div")) y(v);
		else {
			var p = f("div");
			p.mirrorElement = v.mirrorElement,
				function(e, t) {
					for (var n, r = e.firstChild; r;) n = r.nextSibling, r = t(r) ? null : n
				}(v, (function(e) {
					p.appendChild(e)
				})), v = p
		}
		y(v, (function() {
			return !0
		}));
		var g = v.firstChild;
		if (e(r)) {
			var b = N(r);
			if (a(b) && !b.startsWith("data:")) {
				var E = f("div", {
						className: "cover"
					}),
					w = f("img", {
						src: N(r)
					});
				w.addEventListener("load", (function() {
					this.naturalWidth / this.naturalHeight > 4 && s(E)
				})), w.addEventListener("error", (function() {
					s(E)
				})), E.appendChild(w), v.insertBefore(E, g)
			}
		}
		var C = f("h1", {
				className: "title"
			}),
			x = f("a", {
				href: n,
				target: "_blank"
			});
		C.appendChild(x), v.insertBefore(C, g);
		var L = o || document.title;
		return a(L) && L.length > 0 ? x.innerText = L : function(e, t, n) {
			var r = e.ownerDocument;
			if (r) {
				var i = r.querySelector("head > title");
				if (i) {
					var a = new MutationObserver((function(e) {
						if (e && !(e.length < 1)) {
							var n = e[0].addedNodes;
							if (n && !(n.length < 1)) {
								var r = n[0];
								if (r && c(r)) {
									var i = S(r);
									i && i.length > 0 && (a.disconnect(), t && t(i))
								}
							}
						}
					}));
					a.observe(i, {
						childList: !0
					}), setTimeout((function() {
						a.disconnect(), n && n()
					}), 3e3)
				}
			}
		}(v, (function(e) {
			x.innerText = e
		}), (function() {
			S(x) <= 0 && s(C)
		})), a(i) && i.length > 0 && v.insertBefore(f("p", {
			className: "time",
			innerText: i
		}), g), v
	}

	function X(e, t) {
		var n = Object.keys(e);
		if (Object.getOwnPropertySymbols) {
			var r = Object.getOwnPropertySymbols(e);
			t && (r = r.filter((function(t) {
				return Object.getOwnPropertyDescriptor(e, t)
					.enumerable
			}))), n.push.apply(n, r)
		}
		return n
	}

	function Y(e) {
		for (var t = 1; t < arguments.length; t++) {
			var n = null != arguments[t] ? arguments[t] : {};
			t % 2 ? X(Object(n), !0)
				.forEach((function(t) {
					J(e, t, n[t])
				})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : X(Object(n))
				.forEach((function(t) {
					Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t))
				}))
		}
		return e
	}

	function J(e, t, n) {
		return t in e ? Object.defineProperty(e, t, {
			value: n,
			enumerable: !0,
			configurable: !0,
			writable: !0
		}) : e[t] = n, e
	}

	function Z(e, t) {
		for (var n = 0; n < t.length; n++) {
			var r = t[n];
			r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
		}
	}
	var G = function() {
		function e(t) {
			! function(e, t) {
				if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
			}(this, e);
			var n = this;
			n.node = t, n.scrollTop = 0, n.running = !1, n._render = !1, n.timer = null, n.count = 0, n.keys = [];
			var r = f("div");
			r.appendChild(f("style", {
				textContent: "\n        html.circle-html{\n          --circle-track-width:8px;\n          --circle-track:#e2e2e2;\n          --circle-thumb: #9e9e9e;\n          --circle-radius: 4px;\n\n          margin: 0px !important;\n          padding: 0px !important;\n          overflow: auto !important;\n          background: #fff !important;\n          max-width: initial !important;\n        }\n        html.circle-html>body.circle-hidden{\n          width:100% !important;\n          height:100% !important;\n          opacity:0 !important;\n          pointer-events:none !important;\n          position:fixed !important;\n          top:0px !important;\n          left:0px !important;\n        }import { maxZindex } from '../../../circle/core/dom';\n\n      "
			}));
			var i = r.attachShadow({
				mode: "open"
			});
			n.stylesheet = f("style", {
				textContent: `[class*=ant-]::-ms-clear,[class*=ant-] input::-ms-clear,[class*=ant-] input::-ms-reveal,[class^=ant-]::-ms-clear,[class^=ant-] input::-ms-clear,[class^=ant-] input::-ms-reveal{display:none}body,html{width:100%;height:100%}input::-ms-clear,input::-ms-reveal{display:none}*,:after,:before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:rgba(0,0,0,0)}@-ms-viewport{width:device-width}body{margin:0;color:rgba(0,0,0,.85);font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variant:tabular-nums;line-height:1.5715;background-color:#fff;font-feature-settings:"tnum"}[tabindex="-1"]:focus{outline:none!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5em;color:rgba(0,0,0,.85);font-weight:500}p{margin-top:0;margin-bottom:1em}abbr[data-original-title],abbr[title]{text-decoration:underline;text-decoration:underline dotted;border-bottom:0;cursor:help}address{margin-bottom:1em;font-style:normal;line-height:inherit}input[type=number],input[type=password],input[type=text],textarea{-webkit-appearance:none}dl,ol,ul{margin-top:0;margin-bottom:1em}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:500}dd{margin-bottom:.5em;margin-left:0}blockquote{margin:0 0 1em}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#1890ff;text-decoration:none;background-color:transparent;outline:none;cursor:pointer;transition:color .3s;-webkit-text-decoration-skip:objects}a:hover{color:#40a9ff}a:active{color:#096dd9}a:active,a:focus,a:hover{text-decoration:none;outline:0}a[disabled]{color:rgba(0,0,0,.25);cursor:not-allowed}code,kbd,pre,samp{font-size:1em;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace}pre{margin-top:0;margin-bottom:1em;overflow:auto}figure{margin:0 0 1em}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}[role=button],a,area,button,input:not([type=range]),label,select,summary,textarea{touch-action:manipulation}table{border-collapse:collapse}caption{padding-top:.75em;padding-bottom:.3em;color:rgba(0,0,0,.45);text-align:left;caption-side:bottom}button,input,optgroup,select,textarea{margin:0;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;margin:0;padding:0;border:0}legend{display:block;width:100%;max-width:100%;margin-bottom:.5em;padding:0;color:inherit;font-size:1.5em;line-height:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item}template{display:none}[hidden]{display:none!important}mark{padding:.2em;background-color:#feffe6}::selection{color:#fff;background:#1890ff}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}.root{--font:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--size:20px;--width:800px;--space:0;--lineheight:1.8;--weight:400;--blockspace:32px;--indent:0em;--titlealign:left;--align:left;--imageleft:auto;--imageright:auto;--imagehide:block;--margin:80px;--padding:80px;--columncount:2;--columngap:60px;--title1:2em;--title1weight:500;--title2:1.6em;--title2weight:500;--title3:1.2em;--title3weight:500;--title4:1em;--title4weight:500;--title5:1em;--title5weight:500;--title6:1em;--title6weight:500;--color:#1b1b1b;--link:#416ed2;--hover:#305ab7;--visited:#305ab7;--select:#1b1b1b;--selectbg:#bbd6fc;--bg-r:237;--bg-g:237;--bg-b:237;--bg:#ededed;--canvas:#fff}.root code,.root tt{border-radius:3px;padding:0 5px;margin:0 5px}.root pre{padding:.6em .8em;word-wrap:break-word;border-radius:3px}.root pre code{display:inline;margin:0;padding:0;background:0 0;border:0}.root kbd{margin:0 .2em;padding:.15em .4em .1em;font-size:90%;border-bottom-width:2px;border-radius:3px}.root blockquote{padding:.1em 1em;opacity:.85}.root blockquote>:first-child{margin-top:0}.root blockquote>:last-child{margin-bottom:0}.root blockquote p{margin:0}.root hr{clear:both;margin:15px 0;height:0;overflow:hidden;border:none;background:transparent;padding:0}.root table{width:100%;max-width:100%;border:1px solid transparent;border-collapse:collapse}.root figure{overflow:auto}.root figure>figcaption,.root figure>img,.root figure>pre,.root figure>table{margin:0!important}.root tr td,.root tr th{padding:6px 13px}.root tr td p,.root tr th p{margin:0}.root img,.root video{max-width:100%;height:auto}.root embed{max-width:100%}.root li div,.root li p{margin:0}.root mark{padding:0;margin:0;color:initial;background-color:initial}.root svg{width:20px;height:20px}.root :focus{outline:none}.root [role=separator]:after{content:"";display:block;clear:both;margin:25px 0;height:0;overflow:hidden;border:none;background:transparent;padding:0}.root [role=separator]:last-child:after{display:none}.root .line{display:block}.root .left{float:left;margin-right:12px}.root .right{float:right;margin-left:12px}.root .both{clear:both}.root .full-width{width:100%;max-width:100%!important}.root .noise{display:none}.root .block{display:block}.root .inline-block{display:inline-block}.root .flex{display:flex}.root .inline-flex{display:inline-flex}.root .zone-width{min-width:0}.root{color:var(--color);background:var(--bg)}.root code,.root tt{border:1px solid rgba(var(--bg-r),var(--bg-g),var(--bg-b),.6);background:rgba(var(--bg-r),var(--bg-g),var(--bg-b),.4)}.root pre{background:rgba(var(--bg-r),var(--bg-g),var(--bg-b),.5)}.root kbd{border:1px solid rgba(var(--bg-r),var(--bg-g),var(--bg-b),1)}.root blockquote{border-left:4px solid rgba(var(--bg-r),var(--bg-g),var(--bg-b),1)}.root hr{border-bottom:1px solid rgba(var(--bg-r),var(--bg-g),var(--bg-b),1)}.root table th:hover,.root table tr:hover{background:rgba(var(--bg-r),var(--bg-g),var(--bg-b),.6)}.root table tr{border-bottom:1px solid rgba(var(--bg-r),var(--bg-g),var(--bg-b),.6)}.root table thead tr:first-child{background:rgba(var(--bg-r),var(--bg-g),var(--bg-b),.4)}.root h1,.root h2,.root h3,.root h4,.root h5,.root h6{color:var(--color)}.root a{color:var(--link)}.root a:hover{color:var(--hover)}.root a:active,.root a:visited{color:var(--visited)}.root .hightlight-block,.root ::selection{color:var(--select);background-color:var(--selectbg)}.root .hightlight-block a{color:var(--select)}.root .hightlight{text-decoration:underline}.root .title a{color:var(--color)}.root .title a:hover{color:var(--link)}.root .footer{color:var(--color)}.root.paper .page,.root.solid{background:var(--canvas)}.root{margin:0;padding:1px;display:none;text-shadow:none;font-weight:400;line-height:1.5715;font-size:var(--size);font-variant:tabular-nums;font-feature-settings:"tnum";font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.root h1{font-size:var(--title1);font-weight:var(--title1weight)}.root h2{font-size:var(--title2);font-weight:var(--title2weight)}.root h3{font-size:var(--title3);font-weight:var(--title3weight)}.root h4{font-size:var(--title4);font-weight:var(--title4weight)}.root h5{font-size:var(--title5);font-weight:var(--title5weight)}.root h6{font-size:var(--title6);font-weight:var(--title6weight)}.root blockquote,.root code,.root h1,.root h2,.root h3,.root h4,.root h5,.root h6,.root ol,.root pre,.root ul{text-indent:0}.root .block,.root blockquote,.root dl,.root figcaption,.root li,.root ol,.root p,.root pre,.root section,.root table,.root ul{margin:var(--blockspace) 0}.root .flex .block,.root .flex blockquote,.root .flex dl,.root .flex figcaption,.root .flex ol,.root .flex p,.root .flex pre,.root .flex section,.root .flex table,.root .flex ul,.root .inline-flex .block,.root .inline-flex blockquote,.root .inline-flex dl,.root .inline-flex figcaption,.root .inline-flex ol,.root .inline-flex p,.root .inline-flex pre,.root .inline-flex section,.root .inline-flex table,.root .inline-flex ul{margin:0}.root .flex>*,.root .inline-flex>*{margin-left:10px!important;margin-right:10px!important}.root .flex>:first-child,.root .inline-flex>:first-child{margin-left:0!important}.root .flex>:last-child,.root .inline-flex>:last-child{margin-right:0!important}.root .container{min-height:610px;max-width:var(--width);margin:var(--margin) auto}.root .page{margin-bottom:20px;word-break:break-word;font-size:var(--size);font-family:var(--font);line-height:var(--lineheight);text-indent:var(--indent);letter-spacing:var(--space);font-weight:var(--weight);text-align:var(--align);border-bottom:1px solid var(--color)}.root .page>:first-child{margin-top:0}.root .page>:last-child{margin-bottom:0}.root .page:last-child{margin-bottom:0;border-bottom-width:0}.root .page:after,.root .page:before{content:"";display:block;clear:both;height:0}.root .page img{width:100%;display:var(--imagehide)}.root .page img.large{margin:var(--blockspace) var(--imageright) var(--blockspace) var(--imageleft)!important}.root .page img.base64,.root .page img.tiny{width:auto}.root .page .cover{margin-bottom:16px}.root .page .cover img{margin:0!important;width:100%}.root .page .title{text-indent:0;text-align:var(--titlealign);margin-bottom:var(--blockspace)}.root .page .time{opacity:.6;margin-top:-2%}.root .footer{text-align:center;opacity:.4;font-size:15px;padding:0 0 20px}.root .footer .link{list-style:none;display:flex;justify-content:center;margin:6px 0;padding:0}.root .footer .link li{margin:0 5px}.root .footer .link li a{color:var(--color)}.root.paper .page{padding:var(--padding);border-bottom-width:0;box-shadow:0 0 6px rgba(0,0,0,.15)}.root.paper .page .cover{max-width:calc(100% + 160px);margin:-80px -80px 16px}@media screen and (max-width:600px){.root .container{margin:20px 16px}.root.paper .page{padding:20px}.root.paper .cover{max-width:calc(100% + 40px);margin:-20px -20px 20px}}.entry{opacity:.8;top:10px;right:20px;width:25px;height:25px;cursor:pointer;z-index:99999;position:fixed;border:4px solid #63ab67;border-radius:50%;transition:all .2s}.entry:hover{opacity:1}.entry-close{border:0;opacity:.5}.entry-close:after,.entry-close:before{top:12px;left:0;position:absolute;content:"";width:24px;height:3px;background:#020202}.entry-close:before{transform:rotate(45deg)}.entry-close:after{transform:rotate(-45deg)}`
			}), i.appendChild(n.stylesheet), n.root = f("div", {
				className: "root paper"
			}), n.container = f("div", {
				className: "container"
			}), n.root.appendChild(n.container);
			var a, o = ((a = f("div", {
					className: "footer notranslate"
				}))
				.appendChild(f("ul", {
					className: "link",
					innerHTML: '\n      <li><a target="_blank" href="https://ranhe.xyz/circle-script">获取新版脚本</a></li>\n      <li><a target="_blank" href="https://ranhe.xyz/circle-install/">下载基础版</a></li>\n      <li><a target="_blank" href="http://circlereader.com/">下载专业版</a></li>\n      <li><a target="_blank" href="https://ranhe.xyz/donate/">捐赠支持 ❤️</a></li>\n    '
				})), a.appendChild(f("div", {
					className: "copyright",
					innerText: "脚本 Circle 阅读助手排版,版权归 ".concat(location.hostname, " 所有")
				})), a);
			n.root.appendChild(o), n.entry = f("div", {
				className: "entry"
			}), i.appendChild(n.entry), i.appendChild(n.root), document.documentElement.appendChild(r)
		}
		var t, n, r;
		return t = e, (n = [{
			key: "start",
			value: function() {
				var e = this;
				e.running ? e.destory() : e.render()
			}
		}, {
			key: "bootstrap",
			value: function() {
				var e = this,
					t = function() {
						var e = document._zindex;
						if (i(e)) return e;
						var t = 0;
						return h(document.body.querySelectorAll("*"), (function(e) {
							var n = Number.parseInt(document.defaultView.getComputedStyle(e, null)
								.getPropertyValue("z-index"), 10);
							n > t && (t = n)
						})), t <= 0 ? void 0 : (t++, document._zindex = t, t)
					}();
				t && (e.entry.style.zindex = t), e.entry.addEventListener("click", (function() {
					e.start()
				})), document.addEventListener("keydown", (function(t) {
					var n = document.activeElement;
					if (!n || u(n, "body")) {
						if (o(window.getSelection)) {
							var r = window.getSelection();
							if ("Range" === r.type && c(r.focusNode)) return
						}
						var i = function(e) {
							var t = (e.key || "")
								.trim()
								.length > 0 ? e.key : e.code;
							if (t && !["alt", "control", "meta", "shift"].includes(d(t))) {
								var n = [t];
								if (e.altKey && n.unshift("alt"), e.ctrlKey && n.unshift("ctrl"), e.metaKey && n.unshift("meta"), !(n.length <= 0)) return n.join("+")
									.replace(/?/g, "?")
									.replace(/Escape/g, "escape")
							}
						}(t);
						if (i && e.keys.push(i), e.count++, 1 === e.count) e.timer = setTimeout((function() {
							e.count = 0, e.keys.length <= 0 || ("escape" === e.keys.join(" ") && e.destory(), e.keys = [])
						}), 500);
						else if (2 === e.count) {
							if (e.timer && clearTimeout(e.timer), e.count = 0, e.keys.length <= 0) return;
							"a a" === e.keys.join(" ") && e.start(), e.keys = []
						}
					}
				}))
			}
		}, {
			key: "render",
			value: function() {
				var e = this;
				if (!e.running) {
					if (e.running = !0, e.scrollTop = window.pageYOffset, !e._render) {
						e._render = !0;
						var t = U(Y(Y({}, e.node), {}, {
							article: K(e.node.article),
							title: S(e.node.title)
						}));
						t.classList.add("page"), e.container.appendChild(t), D(t)
					}
					e.entry.classList.add("entry-close"), document.body.classList.add("circle-hidden"), document.documentElement.classList.add("circle-html"), e.root.style.display = "block"
				}
			}
		}, {
			key: "destory",
			value: function() {
				var e = this;
				if (e.running) {
					e.running = !1, e.entry.classList.remove("entry-close"), document.body.classList.remove("circle-hidden"), document.documentElement.classList.remove("circle-html"), e.root.style.display = "none";
					var t = e.scrollTop;
					window.scrollTo({
						left: 0,
						top: t || 0,
						behavior: "instant"
					}), e.scrollTop = 0
				}
			}
		}]) && Z(t.prototype, n), r && Z(t, r), Object.defineProperty(t, "prototype", {
			writable: !1
		}), e
	}();
	var Q = /pubdate|publish|dateline/i,
		ee = /(20\d{2}([.\-/|年月\s]{1,3}\d{1,2}){2}日?(\s?\d{2}:\d{2}(:\d{2})?)?)|(\d{1,5}\s?(分钟|小时|天)前)/gi;

	function te(e, t) {
		for (var n = e, r = t(n); !r && n;) r = t(n = n.parentElement);
		return r
	}

	function ne(t, n, r) {
		var i;
		if (t.head && h(t.head.getElementsByTagName("meta"), (function(e) {
			var t = p(e, "content");
			if (t && /\d+/.test(t)) {
				var n = p(e, "name"),
					r = p(e, "property");
				Q.test(n) && Q.test(r) && (i = t)
			}
		})), i) return i;
		if (e(r)) {
			var a = te(r, (function(e) {
				return e.nextElementSibling
			}));
			if (a === n) return;
			var o = S(a)
				.match(ee);
			if (l(o)) return o[0]
		} else {
			var c = S(te(n, (function(e) {
					return e.previousElementSibling
				})))
				.match(ee);
			if (l(c)) return c[0]
		}
	}
	var re, ie, ae = ["h1", "h2"],
		oe = ["h1", "h2", "h3", '[id*="title"]', '[id*="Title"]', '[class*="title"]', '[class*="Title"]', '[id*="headline"]', '[class*="headline"]'];

	function le(e, t) {
		if (!E(e)) return !0;
		var n = w(e),
			r = Math.abs(t.left - n.left),
			a = t.top - n.top;
		if (r > 100 || a > 600 || a < -60) return !0;
		var o = S(e);
		if (x(o) > 100 || x(o) <= 4) return !0;
		var l = window.getComputedStyle(e),
			c = parseInt(l.fontSize);
		return (i(c) ? c : 12) <= 12 || e.getElementsByTagName("a")
			.length > 1
	}

	function ce(t, n) {
		if (a(re)) {
			var r = t.querySelector(re);
			if (e(r)) return r;
			re = null
		}
		var i = [],
			o = w(n);
		if (h(t.body.querySelectorAll(ae.join(",")), (function(e) {
			le(e, o) || i.push(e)
		})), 1 === i.length && e(i[0])) return re = L(i[0]), i[0];
		var c = t.title;
		if (c) {
			var u, s = 0;
			if (i = [], h(t.body.querySelectorAll(oe.join(",")), (function(e) {
				if (!le(e, o)) {
					i.push(e);
					var t = S(e),
						n = function(e, t) {
							if (!a(e) || !a(t) || e.length < 0 || t.length < 0) return "";
							if (e.length > t.length) {
								var n = e;
								e = t, t = n
							}
							for (var r = e.length, i = r; i > 0; i--)
								for (var o = 0; o < r - i; o++) {
									var l = e.substr(o, i + 1);
									if (t.indexOf(l) >= 0) return l
								}
							return ""
						}(c, t)
						.length;
					n < 3 || s < n && (s = n, u = e)
				}
			})), e(u)) return re = L(u), u;
			if (1 === i.length) return re = L(i[0]), i[0];
			if (s = 0, h(i, (function(e) {
				var t = Number.parseInt(document.defaultView.getComputedStyle(e, null)
					.getPropertyValue("font-size"), 10);
				t > s && (s = t, u = e)
			})), e(u)) return re = L(u), u;
			var d = function(e) {
				for (var t = 0, n = [], r = e; t < 2 && r;) {
					var i = r.previousElementSibling;
					if (i) E(i) && (n.push(i), t++), r = i;
					else {
						var a = r.parentElement;
						if (!a) break;
						var o = a.previousElementSibling;
						if (!o) break;
						E(o) && (n.push(o), t++), r = o
					}
				}
				if (!(n.length <= 0)) {
					var l = [];
					return h(n, (function(e) {
						C(e, (function(e) {
							if (E(e.parentElement)) return !0
						}), (function(e) {
							var t = e.parentElement;
							!l.includes(t) && l.push(t)
						}))
					})), l
				}
			}();
			if (l(d)) return s = 0, h(d, (function(e) {
				if (!le(e, o)) {
					var t = Number.parseInt(document.defaultView.getComputedStyle(e, null)
						.getPropertyValue("font-size"), 10);
					t > s && (s = t, u = e)
				}
			})), e(u) ? (re = L(u), u) : void 0
		}
	}
	var ue, se = /span|p/i,
		de = /body|hentry|main/i,
		fe = /div|article|body|main|td/i,
		he = /article|body|post|content|entry/i,
		ve = /:|。|;|,|,|\.|\?|、|“|“/,
		me = /comment|meta|replies|reply|footer|footnote|noise/,
		pe = ["table"],
		ge = ["a", "style", "script", "button"],
		ye = ["h2", "h3", "h4", "h5", "h6", "td", "pre", "em", "strong"],
		be = ["feed", "menu", "menubar", "dialog", "alert", "alertdialog", "navigation", "complementary"];

	function Ee(e, t, n) {
		h(function(e) {
			for (var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 3, n = arguments.length > 2 ? arguments[2] : void 0, r = 0, i = e.parentElement, a = []; i && !u(i, "html") && !(o(n) && n(i, r) && (a.push(i), ++r >= t));) i = i.parentElement;
			return a
		}(e, 4, (function(e, t) {
			return t <= 0 ? fe.test(e.nodeName) || he.test("".concat(e.className, " ")
				.concat(e.id)) : !se.test(e.nodeName)
		})), (function(e, r) {
			if (!be.includes(p(e, "role"))) {
				var a = "".concat(e.className, " ")
					.concat(e.id);
				if (!me.test(a)) {
					var o = "".concat(e.tagName, " ")
						.concat(a);
					he.test(o) && (t += r <= 0 ? 10 : 2), de.test(o) && (t += r <= 0 ? 5 : 1), !i(e.score) && (e.score = 0), e.score += t / (r < 2 ? r + 2 : 3 * r), n && n(e)
				}
			}
		}))
	}

	function Se(e) {
		var t = 0;
		return h(e, (function(e) {
			e.childNodes.length > 0 && t++
		})), 1 === t
	}

	function we(e) {
		var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
			n = e.id;
		if (n) return "#".concat(n);
		if (u(e, "body")) return "body";
		var r = "> ".concat(d(e.tagName));
		t <= 1 && e.classList.length > 0 && (r += ".".concat(Array.prototype.slice.call(e.classList)
			.join(".")));
		var i = e.parentElement;
		return i ? we(i, t + 1) + " " + r : r
	}

	function Ce(t, n) {
		if (!e(t)) return t;
		var r = we(t);
		if (!r || !/\.|#/.test(r)) return t;
		var i = r.split(">");
		if (i.length > 0 && !/\.|#/.test(i.pop())) return t;
		var a = [];
		try {
			a = n.querySelectorAll(r)
		} catch (e) {}
		if (a.length <= 2) return t;
		var o = function(e, t) {
			for (; e; e = e.parentElement)
				if (e.contains(t)) return e
		}(a[0], a[1]);
		return e(o) ? (o.mirrorParent = !0, o) : t
	}

	function xe(t) {
		var n;
		if (a(ue)) {
			if (e(n = t.querySelector(ue))) return n;
			ue = null
		}
		var r, i = 0;
		t.body && h(t.body.querySelectorAll("img"), (function(e) {
			var t = function(e) {
				var t = 0;
				if (!E(e)) return t;
				var n = e.width,
					r = e.height,
					i = e.naturalWidth,
					a = e.naturalHeight;
				return n > 500 && r > 300 && i > 800 && a > 500 && (t += (i > a ? i : a) / 500), t
			}(e);
			t <= 0 || (i++, Ee(e, t))
		}));
		var o = [];
		if (t.body && C(t.body, (function(e) {
			var t = e.parentElement;
			if (E(t)) {
				var n = d(t.nodeName);
				if (!ge.includes(n)) {
					var r = S(e);
					if (!(r.split(ve)
						.length <= 2)) {
						var i = x(r);
						if (ye.includes(n) && i > 4) return !0;
						if (!(i < 10)) return !0
					}
				}
			}
		}), (function(e) {
			o.push(function(e) {
				for (var t = e; t;) {
					var n = t.parentElement;
					if (!(u(n, "span") || n.childElementCount <= 0 || Se(n.children))) break;
					t = n
				}
				return t
			}(e))
		})), o.length <= 2 && h(t.body.querySelectorAll("p"), (function(e) {
			if (E(e)) {
				var t = d(e.nodeName);
				if (!ge.includes(t)) {
					var n = S(e);
					if (!(n.split(ve)
						.length <= 2)) x(n) < 10 || o.push(e)
				}
			}
		})), !(o.length <= 0)) {
			var l = [];
			h(o, (function(e) {
				var t = function(e) {
					var t = 1,
						n = S(e);
					t += n.split(ve)
						.length, t += Math.min(Math.floor(x(n) / 100), 3);
					var r = (c(e) ? e.parentElement : e)
						.nodeName.toLowerCase();
					return pe.includes(r) && (t += 1), ye.includes(r) && (t += 2), e.score = t, e.score
				}(e);
				t <= 0 || (i++, Ee(e, t, (function(e) {
					!l.includes(e) && l.push(e)
				})))
			}));
			var s = l.sort((function(e, t) {
				return e.score - t.score
			}));
			n = s.pop();
			var f = s.pop();
			if (e(f) && !he.test("".concat(n.tagName, " ")
				.concat(n.className)) && he.test("".concat(f.tagName, " ")
				.concat(f.className)) && (n = f), e(n)) {
				r = n.score;
				var v = x(S(n));
				if (!(!n || r < 30 || i < (v > 200 ? 1 : 3) || v < 100))
					if (n.querySelectorAll("*")
						.length <= 0 && v > 5e3) n.classList.add("noise");
					else {
						var m = w(n);
						if (m.width * m.height < 172e3) n.classList.add("noise");
						else {
							var p = n.parentElement;
							if (p) {
								var g = w(p);
								if (t.documentElement.offsetWidth > 800 && (m.width < 300 || g.width < 300)) n.classList.add("noise");
								else {
									if (n.getElementsByTagName("div")
										.length < 2) {
										var y = Ce(n, t);
										return ue = L(y), y
									}
									if (!(n.getElementsByTagName("a")
										.length > 16 && b(n) > .35)) {
										var N = Ce(n, t);
										return ue = L(N), N
									}
								}
							} else n.classList.add("noise")
						}
					}
			}
		}
	}

	function Ne(t, n) {
		if (!e(n)) return !0;
		if (/article|post|content/i.test("".concat(n.className, " ")
			.concat(n.id))) return !0;
		if (n.contains(t)) return !0;
		var r = w(t),
			i = w(n);
		return Math.abs(i.top - (r.top + r.height / 2)) < 600 || void 0
	}

	function Le(t, n) {
		var r = ce(t, n),
			i = function(t, n) {
				var r;
				if (a(ie)) {
					if (e(r = t.querySelector(ie))) return r;
					ie = null
				}
				var i = t.body.getElementsByTagName("img");
				if (!(i.length <= 0)) {
					var o = n.getBoundingClientRect(),
						l = o.top,
						c = [];
					if (h(i, (function(e) {
						if (E(e)) {
							var t = e.getBoundingClientRect();
							t.top >= l || t.width / t.height < 5 && t.width > .8 * o.width && c.push(e)
						}
					})), !(c.length <= 0)) return r = c.pop(), ie = L(r), r
				}
			}(t, n),
			o = t.URL.startsWith("http") ? t.URL : location.href;
		if (!e(r)) return {
			url: o,
			cover: i,
			article: n,
			time: ne(t, n),
			title: t.title ? t.title.replace(/(.*)[|\-\\/>»] .*/gi, "$1") : ""
		};
		var l = w(r),
			c = w(n);
		if (Math.abs(c.left - l.left) >= c.width) return {
			url: o,
			cover: i,
			article: n,
			time: ne(t, n),
			title: t.title ? t.title.replace(/(.*)[|\-\\/>»] .*/gi, "$1") : ""
		};
		for (var s = n; !Ne(r, s) && !u(s, "body");) s = s.parentElement;
		return {
			url: o,
			title: r,
			cover: i,
			article: s,
			time: ne(t, n, r)
		}
	}
	var ke = 0;

	function Ae(t, n, r) {
		! function(e) {
			e && e.body && h(e.body.querySelectorAll(['[id*="more"]', '[class*="more"]'].join(",")), (function(e) {
				var t = e;
				if (u(e, "a") || (t = e.querySelector("a")), u(t, "a") && /阅读全文|readmore/.test(t.innerText)) {
					var n = t.href;
					n && !n.startsWith("javascript") || t && t.click && t.click()
				}
			}))
		}(t);
		var i = function(t, n) {
			var r = xe(t);
			if (e(r)) {
				var i = w(r);
				if (!("nextpage" !== n && i.top > 1800)) return r;
				r.classList.add("noise")
			}
		}(t, r);
		e(i) ? (ke = 0, n(Le(t, i))) : setTimeout((function() {
			ke < 5 ? (ke++, Ae(t, n, r)) : (ke = 0, n())
		}), 500)
	}! function(e) {
		var t;

		function n(r) {
			r && r.type && "readystatechange" == r.type && "complete" != document.readyState || (t && clearTimeout(t), document.removeEventListener("DOMContentLoaded", n, !1), document.removeEventListener("readystatechange", n, !1), e())
		}
		"complete" !== document.readyState ? (document.addEventListener("DOMContentLoaded", n, !1), document.addEventListener("readystatechange", n, !1), function e() {
			t && clearTimeout(t), t = setTimeout((function() {
				document.body ? n() : e()
			}), 4e3)
		}()) : e()
	}((function() {
		Ae(document, (function(e) {
			r(e) || new G(e)
				.bootstrap()
		}))
	}))
})();