// ==UserScript== // @name Novel Reader // @version 0.0.13 // @description 小说阅读器,特点是仿起点风格的网站样式,支持UU看书,笔趣阁,书趣阁,81中文网 // @author gausszhou@qq.com // @namespace gausszhou // @license MIT // @grant none // @run-at document-start // @icon https://www.gausszhou.top/favicon.ico // @match *://www.uukanshu.com/*.html // @match *://www.shuquge.com/txt/*/*.html // @match *://www.biquge.lu/book/*/*.html // @match *://www.biqugeu.net/*/*.html // @match *://www.ibiquge.net/*/*.html // @match *://www.qbiqu.com/*/*.html // @match *://www.ptwxz.com/html/*/*/*.html // @match *://www.230book.net/book/*/*.html // @match *://www.69shu.com/txt/*/* // @match *://www.81zw.cc/book/*/*.html // @match *://www.81zw.com/book/*/*.html // @match *://www.81zw.me/book/*/*.html // @match *://www.81zw.net/book/*/*.html // @match *://www.kehuan.net.cn/book/*/*.html // @downloadURL none // ==/UserScript== /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 265: /***/ ((module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(601); /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(609); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(991); /* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__); // Imports var ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(27), __webpack_require__.b); var ___CSS_LOADER_URL_IMPORT_1___ = new URL(/* asset import */ __webpack_require__(920), __webpack_require__.b); var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); var ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_0___); var ___CSS_LOADER_URL_REPLACEMENT_1___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_1___); // Module ___CSS_LOADER_EXPORT___.push([module.id, "body{display:none}body.read iframe,body.read .weizhi,body.read .weizhi+div,body.read .at-share-btn,body.read .sao_mobile_box,body.read .addthis-animated,body.read .addthis-smartlayers,body.read .addthis-smartlayers-desktop{display:none !important}body.read{background:url(" + ___CSS_LOADER_URL_REPLACEMENT_0___ + ") repeat;font-size:18px;font-family:\"Microsoft YaHei\", PingFangSC-Regular, HelveticaNeue-Light, \"Helvetica Neue Light\", sans-serif}body.read ._bread{box-sizing:border-box;width:800px;margin:1em auto 1em;display:flex;align-items:center;font:12px/22px PingFangSC-Regular, \"-apple-system\", Simsun}body.read ._bread .separate{color:rgba(0,0,0,0.4)}body.read ._bread a{margin:0 0.5em !important;padding:0 !important;background-color:transparent !important}body.read ._bread a,body.read ._bread b{padding:0;font-weight:400;font-size:12px;color:#1a1a1a !important}body.read ._content{box-sizing:border-box;background:url(" + ___CSS_LOADER_URL_REPLACEMENT_1___ + ") repeat;width:800px;margin:0 auto 1em;padding:2em;color:#262626;font-weight:500;text-indent:2em;text-align:left;border:1px solid #d8d8d8;position:relative}body.read ._content .book-mark{position:absolute;top:0px;right:48px;width:24px;height:40px;background-repeat:no-repeat;background-position:-228px -143.5px;background-size:340px}body.read ._content br{content:\"\";margin:0.5em 0;display:block;font-size:150%}body.read ._content p{word-wrap:wrap;word-break:break-all;margin-top:0.5em;line-height:1.8;text-align:justify}body.read ._content ._content_title{display:flex;align-items:center;text-indent:0;padding:0 0 0.5em;margin:0 0 0.5em;font:24px/32px PingFangSC-Regular, HelveticaNeue-Light, \"Helvetica Neue Light\", \"Microsoft YaHei\", sans-serif}body.read ._content ._content_title span{font-size:12px;padding:0 1em;margin:0}body.read ._nav{box-sizing:border-box;background:url(" + ___CSS_LOADER_URL_REPLACEMENT_1___ + ") repeat;width:800px;margin:1em auto 1em;height:70px;display:flex;align-items:center;border:1px solid #d8d8d8;white-space:nowrap}body.read ._nav a,body.read ._nav span{flex:1;height:100%;display:flex;align-items:center;justify-content:center;text-decoration:none;color:#333 !important;font:18px/70px PingFangSC-Regular, HelveticaNeue-Light, \"Helvetica Neue Light\", \"Microsoft YaHei\", sans-serif}body.read ._nav span{color:#ccc !important}body.read ._nav .separate{width:1px;height:32px;border-right:1px solid #d8d8d8}body.read ._nav a:hover{background:rgba(0,0,0,0.03)}\n", ""]); // Exports /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); /***/ }), /***/ 609: /***/ ((module) => { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ module.exports = function (cssWithMappingToString) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = ""; var needLayer = typeof item[5] !== "undefined"; if (item[4]) { content += "@supports (".concat(item[4], ") {"); } if (item[2]) { content += "@media ".concat(item[2], " {"); } if (needLayer) { content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); } content += cssWithMappingToString(item); if (needLayer) { content += "}"; } if (item[2]) { content += "}"; } if (item[4]) { content += "}"; } return content; }).join(""); }; // import a list of modules into the list list.i = function i(modules, media, dedupe, supports, layer) { if (typeof modules === "string") { modules = [[null, modules, undefined]]; } var alreadyImportedModules = {}; if (dedupe) { for (var k = 0; k < this.length; k++) { var id = this[k][0]; if (id != null) { alreadyImportedModules[id] = true; } } } for (var _k = 0; _k < modules.length; _k++) { var item = [].concat(modules[_k]); if (dedupe && alreadyImportedModules[item[0]]) { continue; } if (typeof layer !== "undefined") { if (typeof item[5] === "undefined") { item[5] = layer; } else { item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); item[5] = layer; } } if (media) { if (!item[2]) { item[2] = media; } else { item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); item[2] = media; } } if (supports) { if (!item[4]) { item[4] = "".concat(supports); } else { item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); item[4] = supports; } } list.push(item); } }; return list; }; /***/ }), /***/ 991: /***/ ((module) => { module.exports = function (url, options) { if (!options) { options = {}; } if (!url) { return url; } url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them if (/^['"].*['"]$/.test(url)) { url = url.slice(1, -1); } if (options.hash) { url += options.hash; } // Should url be wrapped? // See https://drafts.csswg.org/css-values-3/#urls if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) { return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\""); } return url; }; /***/ }), /***/ 601: /***/ ((module) => { module.exports = function (i) { return i[1]; }; /***/ }), /***/ 62: /***/ ((module) => { var stylesInDOM = []; function getIndexByIdentifier(identifier) { var result = -1; for (var i = 0; i < stylesInDOM.length; i++) { if (stylesInDOM[i].identifier === identifier) { result = i; break; } } return result; } function modulesToDom(list, options) { var idCountMap = {}; var identifiers = []; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var count = idCountMap[id] || 0; var identifier = "".concat(id, " ").concat(count); idCountMap[id] = count + 1; var indexByIdentifier = getIndexByIdentifier(identifier); var obj = { css: item[1], media: item[2], sourceMap: item[3], supports: item[4], layer: item[5] }; if (indexByIdentifier !== -1) { stylesInDOM[indexByIdentifier].references++; stylesInDOM[indexByIdentifier].updater(obj); } else { var updater = addElementStyle(obj, options); options.byIndex = i; stylesInDOM.splice(i, 0, { identifier: identifier, updater: updater, references: 1 }); } identifiers.push(identifier); } return identifiers; } function addElementStyle(obj, options) { var api = options.domAPI(options); api.update(obj); var updater = function updater(newObj) { if (newObj) { if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { return; } api.update(obj = newObj); } else { api.remove(); } }; return updater; } module.exports = function (list, options) { options = options || {}; list = list || []; var lastIdentifiers = modulesToDom(list, options); return function update(newList) { newList = newList || []; for (var i = 0; i < lastIdentifiers.length; i++) { var identifier = lastIdentifiers[i]; var index = getIndexByIdentifier(identifier); stylesInDOM[index].references--; } var newLastIdentifiers = modulesToDom(newList, options); for (var _i = 0; _i < lastIdentifiers.length; _i++) { var _identifier = lastIdentifiers[_i]; var _index = getIndexByIdentifier(_identifier); if (stylesInDOM[_index].references === 0) { stylesInDOM[_index].updater(); stylesInDOM.splice(_index, 1); } } lastIdentifiers = newLastIdentifiers; }; }; /***/ }), /***/ 793: /***/ ((module) => { var memo = {}; /* istanbul ignore next */ function getTarget(target) { if (typeof memo[target] === "undefined") { var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch (e) { // istanbul ignore next styleTarget = null; } } memo[target] = styleTarget; } return memo[target]; } /* istanbul ignore next */ function insertBySelector(insert, style) { var target = getTarget(insert); if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); } target.appendChild(style); } module.exports = insertBySelector; /***/ }), /***/ 173: /***/ ((module) => { /* istanbul ignore next */ function insertStyleElement(options) { var element = document.createElement("style"); options.setAttributes(element, options.attributes); options.insert(element, options.options); return element; } module.exports = insertStyleElement; /***/ }), /***/ 892: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* istanbul ignore next */ function setAttributesWithoutAttributes(styleElement) { var nonce = true ? __webpack_require__.nc : 0; if (nonce) { styleElement.setAttribute("nonce", nonce); } } module.exports = setAttributesWithoutAttributes; /***/ }), /***/ 36: /***/ ((module) => { /* istanbul ignore next */ function apply(styleElement, options, obj) { var css = ""; if (obj.supports) { css += "@supports (".concat(obj.supports, ") {"); } if (obj.media) { css += "@media ".concat(obj.media, " {"); } var needLayer = typeof obj.layer !== "undefined"; if (needLayer) { css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); } css += obj.css; if (needLayer) { css += "}"; } if (obj.media) { css += "}"; } if (obj.supports) { css += "}"; } var sourceMap = obj.sourceMap; if (sourceMap && typeof btoa !== "undefined") { css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); } // For old IE /* istanbul ignore if */ options.styleTagTransform(css, styleElement, options.options); } function removeStyleElement(styleElement) { // istanbul ignore if if (styleElement.parentNode === null) { return false; } styleElement.parentNode.removeChild(styleElement); } /* istanbul ignore next */ function domAPI(options) { var styleElement = options.insertStyleElement(options); return { update: function update(obj) { apply(styleElement, options, obj); }, remove: function remove() { removeStyleElement(styleElement); } }; } module.exports = domAPI; /***/ }), /***/ 464: /***/ ((module) => { /* istanbul ignore next */ function styleTagTransform(css, styleElement) { if (styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while (styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } module.exports = styleTagTransform; /***/ }), /***/ 920: /***/ ((module) => { module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAgMAAABjUWAiAAAACVBMVEX28ef48+n69esoK7jYAAAB4UlEQVQozw2OsW4bQQxEhwLXkDrysGdEqRRgVShfQQq8wOr2jD0jSpXCLvwXbtKfADlFqgSwC/9ljqweZgYzQFnb/QGepYhA9jzmTc1WaSEtQpbFgjWATI00ZZtIckXx8q2Oe5yEByBy+RHOTcM+VVTadULsvxvRC/q8WTwgcWGD+Mnaqa0oy2gw2pKFzK+PzEsus5hP9AHojKslVynLlioVTBEN8cjDNnZoR1uMGTiZAAN47HxMtEkGUE9b8HWzkqNX5Lpk0yVziAJOs46rK1pG/xNuXLjz95fSDoJE5IqG23MAYPtWoeWPvfVtIV/Ng9oH3W0gGMPIOqd4MK4QZ55dV61gOb8Zxp7I9qayaGxp6Q91cmC0ZRdBwEQVHWzSAanlZwVWc9yljeTCeaHjBVvlPSLeyeBUT2rPdJegQI103jVS3uYkyIx1il6mslMDedZuOkwzolsagvPuQAfp7cYg7k9V1NOxfq64PNSvMdwONV4VYEmqlbpZy5OAakRKkjPnL4CBv5/OZRgoWHBmNbxB0LgB1I4vXFj93UoF2/0TPEsWwV9EhbIiTPqYoTHYoMn3enTDjmrFeDTIzaL1bUC/PBIMuF+vSSYSaxoVt90EO3Gu1zrMuMRGUk7Ffv3L+A931Gsb/yBoIgAAAABJRU5ErkJggg=="; /***/ }), /***/ 27: /***/ ((module) => { module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAgMAAABjUWAiAAAADFBMVEXr5djn4dTp49bt59rT6LKxAAACnElEQVQozw3NUUwScRzA8d8R6MF8YMIx8uk47hDSJbj14IPzOGc7jPLvwTGg5uAYDbe2tt56cLtznvEnS6yDqCcEaWi91DvrbLJZz7b1aFtz1aO+2OZWvn+/+4CHeB6BMYaqBLfjPNRY6RFT2JJYby+uAk4WUTrtlmJ4hgPYb2q1XGDQjaK8pgJHvqNaAX+KyuIkDXpgQinb46nOulnn4b5laUHTxLfseeArAoNOeJlOIjdoal0n1FA7tKFv5roK+YaHOqP3P0XyKHPHY+MhTRe5uCZnKhtJKw2eSrSoBDPLtpZuNcFNJcFyiCMxOaaHIfXz1e8HQbWLySrBQ4x0x1qlhnHlnz2HQEC6TNb0gTHXa7IKhcaHqkE015hk9whA0YeWiLIXf7Fa2CZo3DjqjB4tTuF8jIcbfcEx5z/w4sXpQhXW+ju0cqh7icTFmRMaG+v6CIvTjcSpHcH8JEsF3EPh3fRthYdVLLgI2fWXm85/pGFE4l046s70L+yKCcirGFR+jbpy3kMmiCGHrSezVONsn1RBixncyk2PcVWk7DlgxHo8iZwDyq5uAUD854dZhdIFYzKoQig2haUKi1lVufz2RZUZPZ41n/hrOQB6h0Hhg8I367FNoEHgeM/KY7szSeQwD8q2WE3HM35ZLl0K1MJiOtHIkBclRQUwZnyOWcNsRQQgVLj1PSqkjF9DsoOSaSg3iinKzvfmgsNFFfpP/2T3GLGvL4fHEfwIX1sVvXcPqLztehWGcfn9nI2U9nTfCgJPe/jFPLZwgVEzimBgAm0VIyK2tt1cE/AzQdLK+SxLSQ4aDCZnnId94OG2S1XwvnTbNk/ZnhyRCQT+sZM6z9g6LXL1BOBe+zJySiFkHAINCtnQokbCJ/apCv0foqPiZVfhpywAAAAASUVORK5CYII="; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ id: moduleId, /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ /******/ (() => { /******/ __webpack_require__.b = document.baseURI || self.location.href; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 143: 0 /******/ }; /******/ /******/ // no chunk on demand loading /******/ /******/ // no prefetching /******/ /******/ // no preloaded /******/ /******/ // no HMR /******/ /******/ // no HMR manifest /******/ /******/ // no on chunks loaded /******/ /******/ // no jsonp function /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js var injectStylesIntoStyleTag = __webpack_require__(62); var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag); // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/styleDomAPI.js var styleDomAPI = __webpack_require__(36); var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI); // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/insertBySelector.js var insertBySelector = __webpack_require__(793); var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector); // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js var setAttributesWithoutAttributes = __webpack_require__(892); var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes); // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/insertStyleElement.js var insertStyleElement = __webpack_require__(173); var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement); // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/styleTagTransform.js var styleTagTransform = __webpack_require__(464); var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform); // EXTERNAL MODULE: ../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./src/assets/styles/index.scss var styles = __webpack_require__(265); ;// CONCATENATED MODULE: ./src/assets/styles/index.scss var options = {}; options.styleTagTransform = (styleTagTransform_default()); options.setAttributes = (setAttributesWithoutAttributes_default()); options.insert = insertBySelector_default().bind(null, "head"); options.domAPI = (styleDomAPI_default()); options.insertStyleElement = (insertStyleElement_default()); var update = injectStylesIntoStyleTag_default()(styles/* default */.Z, options); /* harmony default export */ const assets_styles = (styles/* default */.Z && styles/* default.locals */.Z.locals ? styles/* default.locals */.Z.locals : undefined); ;// CONCATENATED MODULE: ./src/components/ui.js var dq = document.querySelector.bind(document); function UI() { this.init(); } UI.prototype.init = function () { console.log("欢迎使用小说整治插件"); }; UI.prototype.mounted = function () { this.body = document.body; // create Element this.new_bread_el = document.createElement("div"); this.new_bread_el.className = "_bread"; this.new_content_el = document.createElement("div"); this.new_content_el.className = "_content"; this.new_title_el = document.createElement("div"); this.new_title_el.className = "_content_title"; this.new_nav_el = document.createElement("div"); this.new_nav_el.className = "_nav"; }; // 网站策略判定 判定入口 UI.prototype.judge = function () { try { if (dq(".bread_728x90")) { this.kehuanNet(); return false; } if (dq(".zhengwan_top")) { this.uukanshu(); return false; } if (dq(".page_chapter")) { this.shuquge(); return false; } if (dq(".modbg")) { this.shuba(); return false; } if (dq("#content.fonts_mesne")) { this.ptwxz(); return false; } this.biquge(); } catch (error) { alert(error); } }; // 各个网站的策略 UI.prototype.kehuanNet = function () { this.body.classList.add("kehuan"); this.old_bread_el = dq("#container .topnav h2"); this.old_title_el = dq("#container > h1"); this.old_content_el = dq("#container .text"); this.nav_prev = dq(".next a:nth-child(1)"); this.nav_menu = dq(".next a:nth-child(2)"); this.nav_next = dq(".next a:nth-child(3)"); this.nav_space = ""; this.ads = [".ad_content"]; this.process(); }; UI.prototype.uukanshu = function () { this.body.classList.add("uukanshu"); this.old_bread_el = dq(".srcbox"); this.old_title_el = dq(".h1title #timu"); this.old_content_el = dq("#contentbox"); this.nav_prev = dq(".fanye #prev"); this.nav_menu = dq(".fanye #htmlmulu"); this.nav_next = dq(".fanye #next"); this.nav_space = ""; this.ads = [".ad_content"]; this.process(); }; UI.prototype.shuquge = function () { this.body.classList.add("shuquge"); this.old_bread_el = dq(".path .p"); this.old_title_el = dq(".content h1"); // title this.old_content_el = dq("#content"); this.nav_prev = dq(".page_chapter li:nth-child(1) a"); this.nav_menu = dq(".page_chapter li:nth-child(2) a"); this.nav_next = dq(".page_chapter li:nth-child(3) a"); this.nav_space = dq(".page_chapter li:nth-child(4) a"); this.ads = [".header", "div.box_con > div.bookname div.lm", ".info > .link", ".footer"]; this.process(); }; UI.prototype.shuba = function () { this.body.classList.add("shuba"); this.old_bread_el = dq(".bread"); this.old_title_el = dq("h1.hide720"); // title this.old_content_el = dq(".txtnav"); this.nav_prev = dq(".page1 a:nth-child(1)"); this.nav_menu = dq(".page1 a:nth-child(3)"); this.nav_next = dq(".page1 a:nth-child(4)"); this.nav_space_1 = dq(".page1 a:nth-child(5)"); this.ads = [".hide720"]; this.process(); }; UI.prototype.ptwxz = function () { this.body.classList.add("ptwxz"); this.old_bread_el = null; this.old_title_el = dq("#main #content h1"); // title this.old_content_el = dq("#main #content"); this.nav_prev = dq(".toplink a:nth-child(1)"); this.nav_menu = dq(".toplink a:nth-child(2)"); this.nav_next = dq(".toplink a:nth-child(3)"); this.nav_space_1 = dq(".toplink a:nth-child(4)"); this.nav_space_2 = dq(".toplink a:nth-child(5)"); this.ads = ["#footer", ".header", "#listtj", ".box_con + script + div"]; this.process(); }; UI.prototype.biquge = function () { this.body.classList.add("biquge"); this.old_bread_el = dq(".con_top"); this.old_title_el = dq(".content_read .bookname h1"); // title this.old_content_el = dq(".content_read #content"); this.nav_prev = dq(".bottem2 a:nth-child(1)"); this.nav_menu = dq(".bottem2 a:nth-child(2)"); this.nav_next = dq(".bottem2 a:nth-child(3)"); this.nav_space_1 = dq(".bottem2 a:nth-child(4)"); this.nav_space_2 = dq(".bottem2 a:nth-child(5)"); this.ads = ["#footer", ".header", "#listtj", ".box_con + script + div"]; this.process(); }; // 开始处理 入口 UI.prototype.process = function () { if (this.old_content_el) { this.mode = "read"; this.processRead(); this.body.classList.add("read"); } this.processRemoveAD(); }; // 处理页面 UI.prototype.processRead = function () { this.processReadBread(); this.processReadContent(); this.processReadNav(); this.body.innerHTML = ""; this.body.appendChild(this.new_bread_el); this.body.appendChild(this.new_content_el); this.body.appendChild(this.new_nav_el); var p_list = document.querySelectorAll("._content > p"); p_list.forEach(function (p) { p.innerHTML = p.innerHTML.trim(); }); }; // 去除广告 UI.prototype.processRemoveAD = function () { if (this.ads.length) { console.log(this.ads.length); this.ads.forEach(function (selector) { var ad = dq(selector); console.log(ad); if (ad) ad.parentElement.removeChild(ad); }); } }; // 处理面包屑 UI.prototype.processReadBread = function () { var _this = this; this.breadCrumbs = this.old_bread_el && this.old_bread_el.getElementsByTagName("a"); if (this.breadCrumbs && this.breadCrumbs.length) { Array.from(this.breadCrumbs).forEach(function (item, index) { if (index < 3) _this.new_bread_el.appendChild(item); if (index < 2) { var separate = document.createElement("span"); separate.className += "separate"; separate.innerText = ">"; _this.new_bread_el.appendChild(separate); } }); } }; // 处理正文 UI.prototype.processReadContent = function () { var _this$new_content_el$, _this$new_content_el$2; this.new_title_el.innerHTML = this.old_title_el.innerHTML; var txt = this.new_title_el.outerHTML + this.old_content_el.innerHTML; this.new_content_el.innerHTML = removeTextADS(txt); (_this$new_content_el$ = this.new_content_el.querySelector("h1")) === null || _this$new_content_el$ === void 0 ? void 0 : _this$new_content_el$.remove(); (_this$new_content_el$2 = this.new_content_el.querySelector("table")) === null || _this$new_content_el$2 === void 0 ? void 0 : _this$new_content_el$2.remove(); Array.from(this.new_content_el.querySelectorAll("a")).forEach(function (el) { return el.remove(); }); // var mark = document.createElement("div"); mark.className += "book-mark"; this.new_content_el.appendChild(mark); }; // 去除正文中的广告 function removeTextADS(txt) { var ads = [/https?(.+)html/g, /wa?(.+)com/g, /八一中文网(.+)com/g, /请记住(.+)域名:/g, /