博客整治

帮助你获得一致的博客阅读体验,我不要你觉得,我就要我觉得,专杀CSDN

目前為 2022-03-30 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 博客整治
  3. // @version 0.0.9
  4. // @description 帮助你获得一致的博客阅读体验,我不要你觉得,我就要我觉得,专杀CSDN
  5. // @author gausszhou@qq.com
  6. // @namespace gausszhou
  7. // @grant none
  8. // @run-at document-start
  9. // @icon https://www.gausszhou.top/favicon.ico
  10. // @license MIT
  11. // @include *://*.csdn.net/*
  12. // @include *://csdn.net/*
  13. // @supportURL https://github.com/gausszhou/user-scripts/tree/master/packages/readblog
  14. // @homepageURL https://github.com/gausszhou/user-scripts/tree/master/packages/readblog
  15. // ==/UserScript==
  16.  
  17. /******/ (() => { // webpackBootstrap
  18. /******/ "use strict";
  19. /******/ var __webpack_modules__ = ({
  20.  
  21. /***/ 265:
  22. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  23.  
  24. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  25. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  26. /* harmony export */ });
  27. /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(601);
  28. /* 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__);
  29. /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(609);
  30. /* 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__);
  31. // Imports
  32.  
  33.  
  34. 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()));
  35. // Module
  36. ___CSS_LOADER_EXPORT___.push([module.id, "body{display:none}.csdn .blog-footer-bottom{display:none !important}.csdn .user-profile-head .user-profile-head-banner{height:2rem !important}.csdn.menu .csdn-side-toolbar,.csdn.menu .user-spm-list,.csdn.menu .user-influence-list,.csdn.menu .user-achievement,.csdn.menu #asideProfile,.csdn.menu #asideNewComments{display:none !important}.csdn.article #asideProfile,.csdn.article #asideCategory,.csdn.article #asideNewComments,.csdn.article #asideNewNps,.csdn.article #asideArchive,.csdn.article #asideHotArticle,.csdn.article #asideSearchArticle,.csdn.article #asideCustom,.csdn.article #asidedirectory,.csdn.article #btnMoreComment,.csdn.article .recommend-box,.csdn.article .recommend-right_aside .toolbar-advert{display:none !important}.csdn.article .main_father{max-width:800px;margin:0 auto}.csdn.article .blog-content-box{margin-top:0}.csdn.article .template-box{margin-bottom:1em}.csdn.article blockquote{margin:0.5em !important;padding:1em !important;border-left:5px solid #005282 !important;background-color:#f4f4f4 !important;color:#1b1b1b !important}\n", ""]);
  37. // Exports
  38. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
  39.  
  40.  
  41. /***/ }),
  42.  
  43. /***/ 609:
  44. /***/ ((module) => {
  45.  
  46.  
  47.  
  48. /*
  49. MIT License http://www.opensource.org/licenses/mit-license.php
  50. Author Tobias Koppers @sokra
  51. */
  52. module.exports = function (cssWithMappingToString) {
  53. var list = []; // return the list of modules as css string
  54.  
  55. list.toString = function toString() {
  56. return this.map(function (item) {
  57. var content = "";
  58. var needLayer = typeof item[5] !== "undefined";
  59.  
  60. if (item[4]) {
  61. content += "@supports (".concat(item[4], ") {");
  62. }
  63.  
  64. if (item[2]) {
  65. content += "@media ".concat(item[2], " {");
  66. }
  67.  
  68. if (needLayer) {
  69. content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
  70. }
  71.  
  72. content += cssWithMappingToString(item);
  73.  
  74. if (needLayer) {
  75. content += "}";
  76. }
  77.  
  78. if (item[2]) {
  79. content += "}";
  80. }
  81.  
  82. if (item[4]) {
  83. content += "}";
  84. }
  85.  
  86. return content;
  87. }).join("");
  88. }; // import a list of modules into the list
  89.  
  90.  
  91. list.i = function i(modules, media, dedupe, supports, layer) {
  92. if (typeof modules === "string") {
  93. modules = [[null, modules, undefined]];
  94. }
  95.  
  96. var alreadyImportedModules = {};
  97.  
  98. if (dedupe) {
  99. for (var k = 0; k < this.length; k++) {
  100. var id = this[k][0];
  101.  
  102. if (id != null) {
  103. alreadyImportedModules[id] = true;
  104. }
  105. }
  106. }
  107.  
  108. for (var _k = 0; _k < modules.length; _k++) {
  109. var item = [].concat(modules[_k]);
  110.  
  111. if (dedupe && alreadyImportedModules[item[0]]) {
  112. continue;
  113. }
  114.  
  115. if (typeof layer !== "undefined") {
  116. if (typeof item[5] === "undefined") {
  117. item[5] = layer;
  118. } else {
  119. item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
  120. item[5] = layer;
  121. }
  122. }
  123.  
  124. if (media) {
  125. if (!item[2]) {
  126. item[2] = media;
  127. } else {
  128. item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
  129. item[2] = media;
  130. }
  131. }
  132.  
  133. if (supports) {
  134. if (!item[4]) {
  135. item[4] = "".concat(supports);
  136. } else {
  137. item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
  138. item[4] = supports;
  139. }
  140. }
  141.  
  142. list.push(item);
  143. }
  144. };
  145.  
  146. return list;
  147. };
  148.  
  149. /***/ }),
  150.  
  151. /***/ 601:
  152. /***/ ((module) => {
  153.  
  154.  
  155.  
  156. module.exports = function (i) {
  157. return i[1];
  158. };
  159.  
  160. /***/ }),
  161.  
  162. /***/ 62:
  163. /***/ ((module) => {
  164.  
  165.  
  166.  
  167. var stylesInDOM = [];
  168.  
  169. function getIndexByIdentifier(identifier) {
  170. var result = -1;
  171.  
  172. for (var i = 0; i < stylesInDOM.length; i++) {
  173. if (stylesInDOM[i].identifier === identifier) {
  174. result = i;
  175. break;
  176. }
  177. }
  178.  
  179. return result;
  180. }
  181.  
  182. function modulesToDom(list, options) {
  183. var idCountMap = {};
  184. var identifiers = [];
  185.  
  186. for (var i = 0; i < list.length; i++) {
  187. var item = list[i];
  188. var id = options.base ? item[0] + options.base : item[0];
  189. var count = idCountMap[id] || 0;
  190. var identifier = "".concat(id, " ").concat(count);
  191. idCountMap[id] = count + 1;
  192. var indexByIdentifier = getIndexByIdentifier(identifier);
  193. var obj = {
  194. css: item[1],
  195. media: item[2],
  196. sourceMap: item[3],
  197. supports: item[4],
  198. layer: item[5]
  199. };
  200.  
  201. if (indexByIdentifier !== -1) {
  202. stylesInDOM[indexByIdentifier].references++;
  203. stylesInDOM[indexByIdentifier].updater(obj);
  204. } else {
  205. var updater = addElementStyle(obj, options);
  206. options.byIndex = i;
  207. stylesInDOM.splice(i, 0, {
  208. identifier: identifier,
  209. updater: updater,
  210. references: 1
  211. });
  212. }
  213.  
  214. identifiers.push(identifier);
  215. }
  216.  
  217. return identifiers;
  218. }
  219.  
  220. function addElementStyle(obj, options) {
  221. var api = options.domAPI(options);
  222. api.update(obj);
  223.  
  224. var updater = function updater(newObj) {
  225. if (newObj) {
  226. if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
  227. return;
  228. }
  229.  
  230. api.update(obj = newObj);
  231. } else {
  232. api.remove();
  233. }
  234. };
  235.  
  236. return updater;
  237. }
  238.  
  239. module.exports = function (list, options) {
  240. options = options || {};
  241. list = list || [];
  242. var lastIdentifiers = modulesToDom(list, options);
  243. return function update(newList) {
  244. newList = newList || [];
  245.  
  246. for (var i = 0; i < lastIdentifiers.length; i++) {
  247. var identifier = lastIdentifiers[i];
  248. var index = getIndexByIdentifier(identifier);
  249. stylesInDOM[index].references--;
  250. }
  251.  
  252. var newLastIdentifiers = modulesToDom(newList, options);
  253.  
  254. for (var _i = 0; _i < lastIdentifiers.length; _i++) {
  255. var _identifier = lastIdentifiers[_i];
  256.  
  257. var _index = getIndexByIdentifier(_identifier);
  258.  
  259. if (stylesInDOM[_index].references === 0) {
  260. stylesInDOM[_index].updater();
  261.  
  262. stylesInDOM.splice(_index, 1);
  263. }
  264. }
  265.  
  266. lastIdentifiers = newLastIdentifiers;
  267. };
  268. };
  269.  
  270. /***/ }),
  271.  
  272. /***/ 793:
  273. /***/ ((module) => {
  274.  
  275.  
  276.  
  277. var memo = {};
  278. /* istanbul ignore next */
  279.  
  280. function getTarget(target) {
  281. if (typeof memo[target] === "undefined") {
  282. var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
  283.  
  284. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  285. try {
  286. // This will throw an exception if access to iframe is blocked
  287. // due to cross-origin restrictions
  288. styleTarget = styleTarget.contentDocument.head;
  289. } catch (e) {
  290. // istanbul ignore next
  291. styleTarget = null;
  292. }
  293. }
  294.  
  295. memo[target] = styleTarget;
  296. }
  297.  
  298. return memo[target];
  299. }
  300. /* istanbul ignore next */
  301.  
  302.  
  303. function insertBySelector(insert, style) {
  304. var target = getTarget(insert);
  305.  
  306. if (!target) {
  307. throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  308. }
  309.  
  310. target.appendChild(style);
  311. }
  312.  
  313. module.exports = insertBySelector;
  314.  
  315. /***/ }),
  316.  
  317. /***/ 173:
  318. /***/ ((module) => {
  319.  
  320.  
  321.  
  322. /* istanbul ignore next */
  323. function insertStyleElement(options) {
  324. var element = document.createElement("style");
  325. options.setAttributes(element, options.attributes);
  326. options.insert(element, options.options);
  327. return element;
  328. }
  329.  
  330. module.exports = insertStyleElement;
  331.  
  332. /***/ }),
  333.  
  334. /***/ 892:
  335. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  336.  
  337.  
  338.  
  339. /* istanbul ignore next */
  340. function setAttributesWithoutAttributes(styleElement) {
  341. var nonce = true ? __webpack_require__.nc : 0;
  342.  
  343. if (nonce) {
  344. styleElement.setAttribute("nonce", nonce);
  345. }
  346. }
  347.  
  348. module.exports = setAttributesWithoutAttributes;
  349.  
  350. /***/ }),
  351.  
  352. /***/ 36:
  353. /***/ ((module) => {
  354.  
  355.  
  356.  
  357. /* istanbul ignore next */
  358. function apply(styleElement, options, obj) {
  359. var css = "";
  360.  
  361. if (obj.supports) {
  362. css += "@supports (".concat(obj.supports, ") {");
  363. }
  364.  
  365. if (obj.media) {
  366. css += "@media ".concat(obj.media, " {");
  367. }
  368.  
  369. var needLayer = typeof obj.layer !== "undefined";
  370.  
  371. if (needLayer) {
  372. css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
  373. }
  374.  
  375. css += obj.css;
  376.  
  377. if (needLayer) {
  378. css += "}";
  379. }
  380.  
  381. if (obj.media) {
  382. css += "}";
  383. }
  384.  
  385. if (obj.supports) {
  386. css += "}";
  387. }
  388.  
  389. var sourceMap = obj.sourceMap;
  390.  
  391. if (sourceMap && typeof btoa !== "undefined") {
  392. css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
  393. } // For old IE
  394.  
  395. /* istanbul ignore if */
  396.  
  397.  
  398. options.styleTagTransform(css, styleElement, options.options);
  399. }
  400.  
  401. function removeStyleElement(styleElement) {
  402. // istanbul ignore if
  403. if (styleElement.parentNode === null) {
  404. return false;
  405. }
  406.  
  407. styleElement.parentNode.removeChild(styleElement);
  408. }
  409. /* istanbul ignore next */
  410.  
  411.  
  412. function domAPI(options) {
  413. var styleElement = options.insertStyleElement(options);
  414. return {
  415. update: function update(obj) {
  416. apply(styleElement, options, obj);
  417. },
  418. remove: function remove() {
  419. removeStyleElement(styleElement);
  420. }
  421. };
  422. }
  423.  
  424. module.exports = domAPI;
  425.  
  426. /***/ }),
  427.  
  428. /***/ 464:
  429. /***/ ((module) => {
  430.  
  431.  
  432.  
  433. /* istanbul ignore next */
  434. function styleTagTransform(css, styleElement) {
  435. if (styleElement.styleSheet) {
  436. styleElement.styleSheet.cssText = css;
  437. } else {
  438. while (styleElement.firstChild) {
  439. styleElement.removeChild(styleElement.firstChild);
  440. }
  441.  
  442. styleElement.appendChild(document.createTextNode(css));
  443. }
  444. }
  445.  
  446. module.exports = styleTagTransform;
  447.  
  448. /***/ })
  449.  
  450. /******/ });
  451. /************************************************************************/
  452. /******/ // The module cache
  453. /******/ var __webpack_module_cache__ = {};
  454. /******/
  455. /******/ // The require function
  456. /******/ function __webpack_require__(moduleId) {
  457. /******/ // Check if module is in cache
  458. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  459. /******/ if (cachedModule !== undefined) {
  460. /******/ return cachedModule.exports;
  461. /******/ }
  462. /******/ // Create a new module (and put it into the cache)
  463. /******/ var module = __webpack_module_cache__[moduleId] = {
  464. /******/ id: moduleId,
  465. /******/ // no module.loaded needed
  466. /******/ exports: {}
  467. /******/ };
  468. /******/
  469. /******/ // Execute the module function
  470. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  471. /******/
  472. /******/ // Return the exports of the module
  473. /******/ return module.exports;
  474. /******/ }
  475. /******/
  476. /************************************************************************/
  477. /******/ /* webpack/runtime/compat get default export */
  478. /******/ (() => {
  479. /******/ // getDefaultExport function for compatibility with non-harmony modules
  480. /******/ __webpack_require__.n = (module) => {
  481. /******/ var getter = module && module.__esModule ?
  482. /******/ () => (module['default']) :
  483. /******/ () => (module);
  484. /******/ __webpack_require__.d(getter, { a: getter });
  485. /******/ return getter;
  486. /******/ };
  487. /******/ })();
  488. /******/
  489. /******/ /* webpack/runtime/define property getters */
  490. /******/ (() => {
  491. /******/ // define getter functions for harmony exports
  492. /******/ __webpack_require__.d = (exports, definition) => {
  493. /******/ for(var key in definition) {
  494. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  495. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  496. /******/ }
  497. /******/ }
  498. /******/ };
  499. /******/ })();
  500. /******/
  501. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  502. /******/ (() => {
  503. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  504. /******/ })();
  505. /******/
  506. /************************************************************************/
  507. var __webpack_exports__ = {};
  508. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  509. (() => {
  510.  
  511. // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
  512. var injectStylesIntoStyleTag = __webpack_require__(62);
  513. var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
  514. // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/styleDomAPI.js
  515. var styleDomAPI = __webpack_require__(36);
  516. var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
  517. // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/insertBySelector.js
  518. var insertBySelector = __webpack_require__(793);
  519. var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
  520. // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
  521. var setAttributesWithoutAttributes = __webpack_require__(892);
  522. var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
  523. // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/insertStyleElement.js
  524. var insertStyleElement = __webpack_require__(173);
  525. var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
  526. // EXTERNAL MODULE: ../../node_modules/style-loader/dist/runtime/styleTagTransform.js
  527. var styleTagTransform = __webpack_require__(464);
  528. var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
  529. // EXTERNAL MODULE: ../../node_modules/css-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js!./src/assets/styles/index.scss
  530. var styles = __webpack_require__(265);
  531. ;// CONCATENATED MODULE: ./src/assets/styles/index.scss
  532.  
  533.  
  534. var options = {};
  535.  
  536. options.styleTagTransform = (styleTagTransform_default());
  537. options.setAttributes = (setAttributesWithoutAttributes_default());
  538.  
  539. options.insert = insertBySelector_default().bind(null, "head");
  540. options.domAPI = (styleDomAPI_default());
  541. options.insertStyleElement = (insertStyleElement_default());
  542.  
  543. var update = injectStylesIntoStyleTag_default()(styles/* default */.Z, options);
  544.  
  545.  
  546.  
  547.  
  548. /* harmony default export */ const assets_styles = (styles/* default */.Z && styles/* default.locals */.Z.locals ? styles/* default.locals */.Z.locals : undefined);
  549.  
  550. ;// CONCATENATED MODULE: ./src/components/ui.js
  551. let dq = document.querySelector.bind(document);
  552.  
  553. function UI() {
  554. this.init();
  555. }
  556.  
  557. UI.prototype.init = function () {
  558. console.log("欢迎使用博客整治插件");
  559. };
  560.  
  561. UI.prototype.mounted = function () {
  562. this.body = document.body;
  563. };
  564.  
  565. UI.prototype.processRemoveAD = function () {
  566. if (this.ads && this.ads.length) {
  567. console.log(this.ads.length);
  568. this.ads.forEach((selector) => {
  569. let ad = dq(selector);
  570. console.log(ad);
  571. if (ad) ad.parentElement.removeChild(ad);
  572. });
  573. }
  574. };
  575.  
  576. UI.prototype.process = function () {
  577. this.processRemoveAD();
  578. this.mode = "home";
  579. if (this.blog_content) {
  580. this.mode = "article";
  581. } else {
  582. this.mode = "menu";
  583. }
  584. this.body.classList.add(this.mode);
  585. };
  586.  
  587. UI.prototype.csdn = function () {
  588. this.body.classList.add("csdn");
  589. if (window.location.href.includes("category")) {
  590. this.body.classList.add("category");
  591. }
  592. this.blog_content = dq("#article_content");
  593. if (this.blog_content) {
  594. this.blog_content.classList.add("markdown-body");
  595. }
  596. this.ads = [".csdn-side-toolbar", "#asideHotArticle", "#asideArchive"];
  597. this.process();
  598. this.processCSDN();
  599. };
  600.  
  601.  
  602. UI.prototype.processCSDN = function () {
  603. window.onload = function () {
  604. // 去除剪贴板劫持
  605. csdn.copyright.textData = "";
  606. try {
  607. Object.defineProperty(window, "articleType", {
  608. value: 0,
  609. writable: false,
  610. configurable: false
  611. });
  612. $("#csdn-toolbar").css("border-bottom", "2px solid #409eff");
  613. } catch (err) {}
  614. // 修复无法复制
  615. $("pre").css("user-select", "auto");
  616. $("code").css("user-select", "auto");
  617. $("blockquote").css("user-select", "auto");
  618. // 免登录(不可用)复制
  619. $(".hljs-button").removeClass("signin");
  620. $(".hljs-button").addClass("copy-button");
  621. $(".hljs-button").attr("onclick", "hljs.copyCode(event)");
  622. $(".hljs-button").attr("data-title", "免登录(不可用)复制");
  623. setInterval(() => {
  624. $(".hljs-button").attr("data-title", "免登录(不可用)复制");
  625. $(".passport-login-container").remove();
  626. }, 1000 / 60);
  627. };
  628. };
  629.  
  630. /* harmony default export */ const ui = (UI);
  631.  
  632. ;// CONCATENATED MODULE: ./src/main.js
  633.  
  634.  
  635.  
  636. let main_ui = new ui();
  637. (function () {
  638. main_ui.mounted();
  639. let hostname = location.hostname;
  640. switch (hostname) {
  641. case "blog.csdn.net":
  642. main_ui.csdn();
  643. break;
  644. default:
  645. main_ui.csdn();
  646. break;
  647. }
  648. document.body.style.display = "block";
  649. })();
  650.  
  651. })();
  652.  
  653. /******/ })()
  654. ;

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址