CSDN|简书优化

支持手机端和PC端,屏蔽广告,优化浏览体验,自动跳转简书拦截URL

当前为 2023-09-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CSDN|简书优化
  3. // @icon https://www.csdn.net/favicon.ico
  4. // @namespace https://greasyfork.org/zh-CN/scripts/406136-csdn-简书优化
  5. // @supportURL https://greasyfork.org/zh-CN/scripts/406136-csdn-简书优化/feedback
  6. // @version 2023.9.18
  7. // @description 支持手机端和PC端,屏蔽广告,优化浏览体验,自动跳转简书拦截URL
  8. // @author WhiteSevs
  9. // @match *://*.csdn.net/*
  10. // @match *://*.jianshu.com/*
  11. // @match *://*.jianshu.io/*
  12. // @grant GM_registerMenuCommand
  13. // @grant GM_unregisterMenuCommand
  14. // @grant GM_getValue
  15. // @grant GM_setValue
  16. // @grant GM_deleteValue
  17. // @grant GM_listValues
  18. // @grant GM_info
  19. // @grant unsafeWindow
  20. // @run-at document-start
  21. // @require https://greasyfork.org/scripts/449471-viewer/code/Viewer.js?version=1249086
  22. // @require https://greasyfork.org/scripts/455186-whitesevsutils/code/WhiteSevsUtils.js?version=1253979
  23. // @require https://greasyfork.org/scripts/465772-domutils/code/DOMUtils.js?version=1253312
  24. // ==/UserScript==
  25.  
  26. (function () {
  27. /**
  28. * @type {import("../库/Utils")}
  29. */
  30. const utils = window.Utils.noConflict();
  31. /**
  32. * @type {import("../库/DOMUtils")}
  33. */
  34. const DOMUtils = window.DOMUtils.noConflict();
  35. const log = new utils.Log(GM_info);
  36. log.config({
  37. logMaxCount: 20,
  38. autoClearConsole: true,
  39. });
  40. /**
  41. * 因为在有些页面上,比如:简书,当插入style元素到head中,该页面清除该元素
  42. */
  43. const GM_addStyle = utils.GM_addStyle;
  44. let GM_Menu = null;
  45. /**
  46. * 移除元素(未出现也可以等待出现)
  47. * @param {string} selectorText 元素选择器
  48. */
  49. const waitForElementToRemove = function (selectorText = "") {
  50. utils.waitNode(selectorText).then((dom) => {
  51. dom.forEach((item) => {
  52. item.remove();
  53. });
  54. });
  55. };
  56.  
  57. const Optimization = {
  58. jianshu: {
  59. /**
  60. * 判断是否是简书
  61. */
  62. locationMatch() {
  63. return Boolean(/jianshu.(com|io)/i.test(window.location.origin));
  64. },
  65. PC: {
  66. /**
  67. * 添加屏蔽CSS
  68. */
  69. addCSS() {
  70. GM_addStyle(`
  71. .download-app-guidance,
  72. .call-app-btn,
  73. .collapse-tips,
  74. .note-graceful-button,
  75. .app-open,
  76. .header-wrap,
  77. .recommend-wrap.recommend-ad,
  78. .call-app-Ad-bottom,
  79. #recommended-notes p.top-title span.more,
  80. #homepage .modal,
  81. button.index_call-app-btn,
  82. span.note__flow__download,
  83. .download-guide,
  84. #footer,
  85. .comment-open-app-btn-wrap,
  86. .nav.navbar-nav + div,
  87. .self-flow-ad,
  88. #free-reward-panel,
  89. div[id*='AdFive'],
  90. #index-aside-download-qrbox,
  91. .baidu-app-download-2eIkf_1,
  92. /* 底部的"小礼物走一走,来简书关注我"、赞赏支持和更多精彩内容,就在简书APP */
  93. div[role="main"] > div > section:first-child > div:nth-last-child(2){
  94. display:none !important;
  95. }
  96. body.reader-day-mode.normal-size {
  97. overflow: auto !important;
  98. }
  99. .collapse-free-content{
  100. height:auto !important;
  101. }
  102. .copyright{
  103. color:#000 !important;
  104. }
  105. #note-show .content .show-content-free .collapse-free-content:after{
  106. background-image:none !important;
  107. }
  108. footer > div > div{
  109. justify-content: center;
  110. }
  111. /* 修复底部最后编辑于:。。。在某些套壳浏览器上的错位问题 */
  112. #note-show .content .show-content-free .note-meta-time{
  113. margin-top: 0px !important;
  114. }
  115. `);
  116. },
  117. /**
  118. * 全文居中
  119. */
  120. articleCenter() {
  121. log.success("全文居中");
  122. GM_addStyle(`
  123. div[role=main] aside,
  124. div._3Pnjry{
  125. display: none !important;
  126. }
  127. div._gp-ck{
  128. width: 100% !important;
  129. }`);
  130. waitForElementToRemove("div[role=main] aside");
  131. waitForElementToRemove("div._3Pnjry");
  132. utils.waitNode("div._gp-ck").then((dom) => {
  133. dom.forEach((item) => {
  134. item.style["width"] = "100%";
  135. });
  136. });
  137. },
  138. /**
  139. * 去除剪贴板劫持
  140. */
  141. removeClipboardHijacking() {
  142. log.success("去除剪贴板劫持");
  143. const stopNativePropagation = (event) => {
  144. event.stopPropagation();
  145. };
  146. window.addEventListener("copy", stopNativePropagation, true);
  147. document.addEventListener("copy", stopNativePropagation, true);
  148. },
  149. /**
  150. * 自动展开全文
  151. */
  152. autoExpandFullText() {
  153. utils
  154. .waitNode(`div#homepage div[class*="dialog-"]`)
  155. .then((nodeList) => {
  156. nodeList[0].style["visibility"] = "hidden";
  157. utils.mutationObserver(nodeList[0], {
  158. callback: (mutations) => {
  159. if (mutations.length == 0) {
  160. return;
  161. }
  162. if (mutations[0].target.style["display"] != "none") {
  163. log.success("自动展开全文");
  164. document
  165. .querySelector(
  166. 'div#homepage div[class*="dialog-"] .cancel'
  167. )
  168. ?.click();
  169. }
  170. },
  171. config: {
  172. /* 子节点的变动(新增、删除或者更改) */
  173. childList: false,
  174. /* 属性的变动 */
  175. attributes: true,
  176. /* 节点内容或节点文本的变动 */
  177. characterData: true,
  178. /* 是否将观察器应用于该节点的所有后代节点 */
  179. subtree: true,
  180. },
  181. });
  182. });
  183. },
  184. /**
  185. * 去除简书拦截其它网址的url并自动跳转
  186. */
  187. jumpRedirect() {
  188. if (window.location.pathname === "/go-wild") {
  189. /* 禁止简书拦截跳转 */
  190. window.stop();
  191. let search = window.location.href.replace(
  192. window.location.origin + "/",
  193. ""
  194. );
  195. search = decodeURIComponent(search);
  196. let newURL = search
  197. .replace(/^go-wild\?ac=2&url=/gi, "")
  198. .replace(/^https:\/\/link.zhihu.com\/\?target\=/gi, "");
  199. window.location.href = newURL;
  200. }
  201. },
  202. /**
  203. * 屏蔽相关文章
  204. */
  205. shieldRelatedArticles() {
  206. log.success("屏蔽相关文章");
  207. GM_addStyle(`
  208. div[role="main"] > div > section:nth-child(2){
  209. display: none !important;
  210. }
  211. `);
  212. },
  213. /**
  214. * 屏蔽评论区
  215. */
  216. shieldUserComments() {
  217. log.success("屏蔽评论区");
  218. GM_addStyle(`
  219. div#note-page-comment{
  220. display: none !important;
  221. }
  222. `);
  223. },
  224. /**
  225. * 屏蔽推荐阅读
  226. */
  227. shieldRecommendedReading() {
  228. log.success("屏蔽推荐阅读");
  229. GM_addStyle(`
  230. div[role="main"] > div > section:last-child{
  231. display: none !important;
  232. }
  233. `);
  234. },
  235. run() {
  236. this.addCSS();
  237. this.removeClipboardHijacking();
  238. this.autoExpandFullText();
  239. if (GM_Menu.get("JianShuArticleCenter")) {
  240. this.articleCenter();
  241. }
  242. if (GM_Menu.get("JianShuShieldRelatedArticles")) {
  243. this.shieldRelatedArticles();
  244. }
  245. if (GM_Menu.get("JianShuShieldUserComments")) {
  246. this.shieldUserComments();
  247. }
  248. if (GM_Menu.get("JianShuShieldRecommendedReading")) {
  249. this.shieldRecommendedReading();
  250. }
  251. },
  252. },
  253. Mobile: {
  254. addCSS() {
  255. Optimization.jianshu.PC.addCSS();
  256. },
  257. /**
  258. * 手机-移除底部推荐阅读
  259. */
  260. removeFooterRecommendRead() {
  261. log.success("移除底部推荐阅读");
  262. GM_addStyle(`
  263. #recommended-notes{
  264. display: none !important;
  265. }`);
  266. },
  267. /**
  268. * 处理原型
  269. */
  270. handlePrototype() {
  271. log.success("处理原型添加script标签");
  272. let originalAppendChild = Node.prototype.appendChild;
  273. Node.prototype.appendChild = function (element) {
  274. /* 允许添加的元素localName */
  275. let allowElementLocalNameList = ["img"];
  276. /* 不允许script标签加载包括jianshu.io的js资源,会让简书跳到广告页面 */
  277. if (
  278. element.src &&
  279. !element.src.includes("jianshu.io") &&
  280. !allowElementLocalNameList.includes(element.localName)
  281. ) {
  282. log.success(["禁止添加的元素", element]);
  283. return null;
  284. } else {
  285. return originalAppendChild.call(this, element);
  286. }
  287. };
  288. },
  289. /**
  290. * 屏蔽评论区
  291. */
  292. shieldUserComments() {
  293. log.success("屏蔽评论区");
  294. GM_addStyle(`
  295. #comment-main{
  296. display: none !important;
  297. }
  298. `);
  299. },
  300. run() {
  301. this.handlePrototype();
  302. this.addCSS();
  303. Optimization.jianshu.PC.removeClipboardHijacking();
  304. Optimization.jianshu.PC.autoExpandFullText();
  305. if (GM_Menu.get("JianShuremoveFooterRecommendRead")) {
  306. this.removeFooterRecommendRead();
  307. }
  308. if (GM_Menu.get("JianShuShieldUserComments")) {
  309. this.shieldUserComments();
  310. }
  311. },
  312. },
  313. /**
  314. * 函数入口
  315. */
  316. run() {
  317. this.PC.jumpRedirect();
  318. if (utils.isPhone()) {
  319. log.success("简书-移动端");
  320. this.Mobile.run();
  321. } else {
  322. log.success("简书-桌面端");
  323. this.PC.run();
  324. }
  325. },
  326. },
  327. csdn: {
  328. /**
  329. * 判断是否是CSDN
  330. */
  331. locationMatch() {
  332. return Boolean(/csdn.net/i.test(window.location.origin));
  333. },
  334. PC: {
  335. addCSS() {
  336. GM_addStyle(`
  337. .ecommend-item-box.recommend-recommend-box,
  338. .login-mark,
  339. .opt-box.text-center,
  340. .leftPop,
  341. #csdn-shop-window,
  342. .toolbar-advert,
  343. .hide-article-box,
  344. .user-desc.user-desc-fix,
  345. .recommend-card-box,
  346. .more-article,
  347. .article-show-more,
  348. #csdn-toolbar-profile-nologin,
  349. .guide-rr-first,
  350. #recommend-item-box-tow,
  351. /* 发文章得原力分图片提示 */
  352. div.csdn-toolbar-creative-mp,
  353. /* 阅读终点,创作起航,您可以撰写心得或摘录文章要点写篇博文。 */
  354. #toolBarBox div.write-guide-buttom-box,
  355. /* 觉得还不错? 一键收藏 */
  356. ul.toolbox-list div.tool-active-list,
  357. /* 右边按钮组的最上面的创作话题 */
  358. div.csdn-side-toolbar .activity-swiper-box,
  359. .sidetool-writeguide-box .tip-box{
  360. display: none !important;
  361. }
  362. .comment-list-box{
  363. max-height: none !important;
  364. }
  365. .blog_container_aside,
  366. #nav{
  367. margin-left: -45px;
  368. }
  369. .recommend-right.align-items-stretch.clearfix,.dl_right_fixed{
  370. margin-left: 45px;
  371. }
  372. #content_views pre,
  373. #content_views pre code{
  374. user-select: text !important;
  375. }
  376. #article_content,
  377. .user-article.user-article-hide{
  378. height: auto !important;
  379. overflow: auto !important;
  380. }
  381. `);
  382. },
  383. /**
  384. * 去除剪贴板劫持
  385. */
  386. removeClipboardHijacking() {
  387. log.info("去除剪贴板劫持");
  388. document.querySelector(".article-copyright")?.remove();
  389. if (unsafeWindow.articleType) {
  390. unsafeWindow.articleType = 0;
  391. }
  392. if (
  393. unsafeWindow.csdn &&
  394. unsafeWindow.csdn.copyright &&
  395. unsafeWindow.csdn.copyright.textData
  396. ) {
  397. unsafeWindow.csdn.copyright.textData = "";
  398. }
  399. if (
  400. unsafeWindow.csdn &&
  401. unsafeWindow.csdn.copyright &&
  402. unsafeWindow.csdn.copyright.htmlData
  403. ) {
  404. unsafeWindow.csdn.copyright.htmlData = "";
  405. }
  406. },
  407. /**
  408. * 取消禁止复制
  409. */
  410. unBlockCopy() {
  411. log.info("取消禁止复制");
  412. document.addEventListener("click", function (event) {
  413. let target = event.target;
  414. if (!target.classList.contains("hljs-button")) {
  415. return;
  416. }
  417. utils.preventEvent(event);
  418. /* 需要复制的文本 */
  419. let copyText = target.parentElement.textContent;
  420. utils.setClip(copyText);
  421. log.success("点击复制 复制成功~");
  422. target.setAttribute("data-title", "复制成功");
  423. });
  424. let changeDataTitle = new utils.LockFunction(function (event) {
  425. let target = event.target;
  426. if (!target.localName === "pre") {
  427. return;
  428. }
  429. target
  430. .querySelector(".hljs-button")
  431. ?.setAttribute("data-title", "复制");
  432. });
  433.  
  434. document.addEventListener("mouseenter", changeDataTitle.run, true);
  435. document.addEventListener("mouseleave", changeDataTitle.run, true);
  436. /* 取消Ctrl+C的禁止 */
  437. utils.waitNode("#content_views").then((nodeList) => {
  438. unsafeWindow?.$("#content_views")?.unbind("copy");
  439. nodeList[0].addEventListener("copy", function (event) {
  440. utils.preventEvent(event);
  441. utils.setClip(unsafeWindow.getSelection().toString());
  442. log.success("Ctrl+C 复制成功~");
  443. return false;
  444. });
  445. });
  446. /* 删除所有复制按钮的原有的复制事件 */
  447. document.querySelectorAll(".hljs-button").forEach((item) => {
  448. item.removeAttribute("onclick");
  449. });
  450. },
  451. /**
  452. * 点击代码块自动展开
  453. */
  454. clickPreCodeAutomatically() {
  455. if (!GM_Menu.get("autoExpandContent")) {
  456. return;
  457. }
  458. log.info("点击代码块自动展开");
  459. document.addEventListener("click", function (event) {
  460. let target = event.target;
  461. if (target.localName !== "pre") {
  462. return;
  463. }
  464. target.style.setProperty("height", "auto");
  465. target.querySelector(".hide-preCode-box")?.remove();
  466. });
  467. },
  468. /**
  469. * 恢复评论到正确位置
  470. */
  471. restoreComments() {
  472. /* 第一条评论 */
  473. log.info("恢复评论到正确位置-第一条评论");
  474. utils.waitNode(".first-recommend-box").then((nodeList) => {
  475. let recommendBoxElement = document.querySelector(
  476. ".recommend-box.insert-baidu-box.recommend-box-style"
  477. );
  478. recommendBoxElement.insertBefore(
  479. nodeList[0],
  480. recommendBoxElement.firstChild
  481. );
  482. });
  483. log.info("恢复评论到正确位置-第二条评论");
  484. /* 第二条评论 */
  485. utils.waitNode(".second-recommend-box").then((nodeList) => {
  486. let recommendBoxElement = document.querySelector(
  487. ".recommend-box.insert-baidu-box.recommend-box-style"
  488. );
  489. recommendBoxElement.insertBefore(
  490. nodeList[0],
  491. recommendBoxElement.firstChild
  492. );
  493. });
  494. },
  495. /**
  496. * 标识CSDN下载的链接
  497. */
  498. identityCSDNDownload() {
  499. log.info("标识CSDN下载的链接");
  500. document
  501. .querySelectorAll(
  502. ".recommend-item-box[data-url*='https://download.csdn.net/']"
  503. )
  504. .forEach((item) => {
  505. if (GM_Menu.get("removeCSDNDownloadPC")) {
  506. item.remove();
  507. } else {
  508. item
  509. .querySelector(".content-box")
  510. .style.setProperty("border", "2px solid red");
  511. }
  512. });
  513. },
  514. /**
  515. * 全文居中
  516. */
  517. articleCenter() {
  518. if (!GM_Menu.get("articleCenter")) {
  519. return;
  520. }
  521. log.info("全文居中");
  522. GM_addStyle(`
  523. aside.blog_container_aside{
  524. display:none !important;
  525. }
  526. #mainBox main{
  527. width: inherit !important;
  528. }
  529. `);
  530. GM_addStyle(`
  531. @media (min-width: 1320px) and (max-width:1380px) {
  532. .nodata .container {
  533. width:900px !important
  534. }
  535.  
  536. .nodata .container main {
  537. width: 900px
  538. }
  539. .nodata .container main #pcCommentBox pre >ol.hljs-ln {
  540. width: 490px !important
  541. }
  542. .nodata .container main .articleConDownSource {
  543. width: 500px
  544. }
  545. }
  546. @media screen and (max-width: 1320px) {
  547. .nodata .container {
  548. width:760px !important
  549. }
  550. .nodata .container main {
  551. width: 760px
  552. }
  553. .nodata .container main #pcCommentBox pre >ol.hljs-ln {
  554. width: 490px !important
  555. }
  556. .nodata .container main .toolbox-list .tool-reward {
  557. display: none
  558. }
  559. .nodata .container main .more-toolbox-new .toolbox-left .profile-box .profile-name {
  560. max-width: 128px
  561. }
  562. .nodata .container main .articleConDownSource {
  563. width: 420px
  564. }
  565. }
  566. @media screen and (min-width: 1380px) {
  567. .nodata .container {
  568. width:1010px !important
  569. }
  570. .nodata .container main {
  571. width: 1010px
  572. }
  573. .nodata .container main #pcCommentBox pre >ol.hljs-ln {
  574. width: 490px !important
  575. }
  576. .nodata .container main .articleConDownSource {
  577. width: 560px
  578. }
  579. }
  580. @media (min-width: 1550px) and (max-width:1700px) {
  581. .nodata .container {
  582. width:820px !important
  583. }
  584. .nodata .container main {
  585. width: 820px
  586. }
  587. .nodata .container main #pcCommentBox pre >ol.hljs-ln {
  588. width: 690px !important
  589. }
  590. .nodata .container main .articleConDownSource {
  591. width: 500px
  592. }
  593. }
  594. @media screen and (min-width: 1700px) {
  595. .nodata .container {
  596. width:1010px !important
  597. }
  598. .nodata .container main {
  599. width: 1010px
  600. }
  601. .nodata .container main #pcCommentBox pre >ol.hljs-ln {
  602. width: 690px !important
  603. }
  604. .nodata .container main .articleConDownSource {
  605. width: 560px
  606. }
  607. }
  608. `);
  609. },
  610. /**
  611. * 添加前往评论的按钮,在返回顶部的下面
  612. */
  613. addGotoRecommandButton() {
  614. log.info("添加前往评论的按钮,在返回顶部的上面");
  615. let gotoRecommandNode = document.createElement("a");
  616. gotoRecommandNode.className = "option-box";
  617. gotoRecommandNode.setAttribute("data-type", "gorecommand");
  618. gotoRecommandNode.innerHTML = `<span class="show-txt" style="display:flex;opacity:100;">前往<br>评论</span>`;
  619. gotoRecommandNode.addEventListener("click", function () {
  620. log.info("滚动到评论");
  621. let toolbarBoxElement = document.querySelector("#toolBarBox");
  622. let toolbarBoxOffsetTop =
  623. toolbarBoxElement.getBoundingClientRect().top + window.scrollY;
  624. let csdnToolBarElement = document.querySelector("#csdn-toolbar");
  625. let csdnToolBarStyles = window.getComputedStyle(csdnToolBarElement);
  626. let csdnToolBarHeight =
  627. csdnToolBarElement.clientHeight -
  628. parseFloat(csdnToolBarStyles.paddingTop) -
  629. parseFloat(csdnToolBarStyles.paddingBottom);
  630. unsafeWindow.$("html, body").animate(
  631. {
  632. scrollTop: toolbarBoxOffsetTop - csdnToolBarHeight - 8,
  633. },
  634. 1000
  635. );
  636. });
  637. utils.waitNode(".csdn-side-toolbar").then(() => {
  638. let targetElement = document.querySelector(
  639. ".csdn-side-toolbar a:nth-last-child(2)"
  640. );
  641. targetElement.parentElement.insertBefore(
  642. gotoRecommandNode,
  643. targetElement.nextSibling
  644. );
  645. });
  646. },
  647. /**
  648. * 屏蔽登录弹窗
  649. */
  650. shieldLoginDialog() {
  651. if (GM_Menu.get("shieldLoginDialog")) {
  652. log.info("屏蔽登录弹窗");
  653. window.GM_CSS_GM_shieldLoginDialog = [
  654. GM_addStyle(
  655. `.passport-login-container{display: none !important;}`
  656. ),
  657. ];
  658. }
  659. },
  660. /**
  661. * 自动展开内容块
  662. */
  663. autoExpandContent() {
  664. if (!GM_Menu.get("autoExpandContent")) {
  665. return;
  666. }
  667. log.info("自动展开内容块");
  668. GM_addStyle(`
  669. pre.set-code-hide{
  670. height: auto !important;
  671. }
  672. pre.set-code-hide .hide-preCode-box{
  673. display: none !important;
  674. }
  675. `);
  676. },
  677. /**
  678. * 屏蔽右侧悬浮按钮
  679. */
  680. csdnShieldfloatingButton() {
  681. if (!GM_Menu.get("csdnShieldfloatingButton")) {
  682. return;
  683. }
  684. log.info("屏蔽右侧悬浮按钮");
  685. GM_addStyle(`
  686. div.csdn-side-toolbar{
  687. display: none !important;
  688. }
  689. `);
  690. },
  691. /**
  692. * 屏蔽底部推荐文章
  693. */
  694. csdnShieldBottomRecommendArticle() {
  695. if (!GM_Menu.get("csdnShieldBottomRecommendArticle")) {
  696. return;
  697. }
  698. log.info("屏蔽底部推荐文章");
  699. GM_addStyle(`
  700. main > div.recommend-box {
  701. display: none !important;
  702. }
  703. `);
  704. },
  705. /**
  706. * 屏蔽底部悬浮工具栏
  707. */
  708. csdnShieldBottomFloatingToolbar() {
  709. if (!GM_Menu.get("csdnShieldBottomFloatingToolbar")) {
  710. return;
  711. }
  712. log.info("屏蔽底部悬浮工具栏");
  713. GM_addStyle(`
  714. #toolBarBox {
  715. display: none !important;
  716. }
  717. `);
  718. },
  719. /**
  720. * 显示/隐藏目录
  721. */
  722. showOrHideDirectory() {
  723. if (GM_Menu.get("showOrHideDirectory")) {
  724. log.info("显示目录");
  725. GM_addStyle(`
  726. aside.blog_container_aside{
  727. display: none !important;
  728. }
  729. `);
  730. } else {
  731. log.info("隐藏目录");
  732. GM_addStyle(`
  733. aside.blog_container_aside{
  734. display: block !important;
  735. }
  736. `);
  737. }
  738. },
  739. /**
  740. * 显示/隐藏侧边栏
  741. */
  742. showOrHideSidebar() {
  743. if (GM_Menu.get("showOrHideSidebar")) {
  744. log.info("显示侧边栏");
  745. GM_addStyle(`
  746. #rightAsideConcision{
  747. display: none !important;
  748. }
  749. `);
  750. } else {
  751. log.info("隐藏侧边栏");
  752. GM_addStyle(`
  753. #rightAsideConcision{
  754. display: block !important;
  755. }
  756. `);
  757. }
  758. },
  759. /**
  760. * 去除CSDN拦截其它网址的url并自动跳转
  761. */
  762. jumpRedirect() {
  763. /* https://link.csdn.net/?target=https%3A%2F%2Fjaist.dl.sourceforge.net%2Fproject%2Fportecle%2Fv1.11%2Fportecle-1.11.zip */
  764. if (
  765. window.location.hostname === "link.csdn.net" &&
  766. window.location.search.startsWith("?target")
  767. ) {
  768. /* 禁止CSDN拦截跳转 */
  769. window.stop();
  770. let search = window.location.search.replace(/^\?target=/gi, "");
  771. search = decodeURIComponent(search);
  772. let newURL = search;
  773. log.success(`跳转链接 ${newURL}`);
  774. window.location.href = newURL;
  775. }
  776. },
  777. run() {
  778. this.addCSS();
  779. this.articleCenter();
  780. this.shieldLoginDialog();
  781. this.autoExpandContent();
  782. this.csdnShieldfloatingButton();
  783. this.csdnShieldBottomRecommendArticle();
  784. this.csdnShieldBottomFloatingToolbar();
  785. this.showOrHideDirectory();
  786. this.showOrHideSidebar();
  787. let that = this;
  788. let readyCallBack = function () {
  789. that.removeClipboardHijacking();
  790. that.unBlockCopy();
  791. that.identityCSDNDownload();
  792. that.clickPreCodeAutomatically();
  793. that.restoreComments();
  794. that.addGotoRecommandButton();
  795. };
  796. if (document.readyState !== "loading") {
  797. readyCallBack();
  798. } else {
  799. document.addEventListener("DOMContentLoaded", readyCallBack);
  800. }
  801. },
  802. },
  803. Mobile: {
  804. addCSS() {
  805. GM_addStyle(`
  806. #mainBox{
  807. width: auto;
  808. }
  809. .user-desc.user-desc-fix{
  810. height: auto !important;
  811. overflow: auto !important;
  812. }
  813. #operate,.feed-Sign-span,
  814. .view_comment_box,
  815. .weixin-shadowbox.wap-shadowbox,
  816. .feed-Sign-span,
  817. .user-desc.user-desc-fix,
  818. .comment_read_more_box,
  819. #content_views pre.set-code-hide .hide-preCode-box,
  820. .passport-login-container,
  821. .hljs-button[data-title='登录后复制'],
  822. .article-show-more,
  823. #treeSkill,
  824. div.btn_open_app_prompt_div,
  825. div.readall_box,
  826. div.aside-header-fixed,
  827. div.feed-Sign-weixin,
  828. div.ios-shadowbox{
  829. display:none !important;
  830. }
  831. .component-box .praise {
  832. background: #ff5722;
  833. border-radius: 5px;
  834. padding: 0px 8px;
  835. height: auto;
  836. }
  837. .component-box .praise,.component-box .share {
  838. color: #fff;
  839. }
  840. .component-box a {
  841. display: inline-block;
  842. font-size:xx-small;
  843. }
  844. .component-box {
  845. display: inline;
  846. margin: 0;
  847. position: relative;
  848. white-space:nowrap;
  849. }
  850. .csdn-edu-title{
  851. background: #4d6de1;
  852. border-radius: 5px;
  853. padding: 0px 8px;
  854. height: auto;
  855. color: #fff !important;
  856. }
  857. #comment{
  858. max-height: none !important;
  859. }
  860. #content_views pre,
  861. #content_views pre code{
  862. webkit-touch-callout: text !important;
  863. -webkit-user-select: text !important;
  864. -khtml-user-select: text !important;
  865. -moz-user-select: text !important;
  866. -ms-user-select: text !important;
  867. user-select: text !important;
  868. }
  869. #content_views pre.set-code-hide,
  870. .article_content{
  871. height: 100% !important;
  872. overflow: auto !important;
  873. }`);
  874. GM_addStyle(`
  875. .GM-csdn-dl{
  876. padding: .24rem .32rem;
  877. width: 100%;
  878. justify-content: space-between;
  879. -webkit-box-pack: justify;
  880. border-bottom: 1px solid #F5F6F7!important;
  881. }
  882. .GM-csdn-title{
  883. font-size: .3rem;
  884. color: #222226;
  885. letter-spacing: 0;
  886. line-height: .44rem;
  887. font-weight: 600;
  888. //max-height: .88rem;
  889. word-break: break-all;
  890. overflow: hidden;
  891. display: -webkit-box;
  892. -webkit-box-orient: vertical;
  893. -webkit-line-clamp: 2
  894. }
  895. .GM-csdn-title a{
  896. word-break: break-all;
  897. color: #222226;
  898. font-weight: 600;
  899. }
  900. .GM-csdn-title em,.GM-csdn-content em{
  901. font-style: normal;
  902. color: #fc5531
  903. }
  904. .GM-csdn-content{
  905. //max-width: 5.58rem;
  906. overflow: hidden;
  907. text-overflow: ellipsis;
  908. display: -webkit-box;
  909. -webkit-line-clamp: 1;
  910. -webkit-box-orient: vertical;
  911. color: #555666;
  912. font-size: .24rem;
  913. line-height: .34rem;
  914. max-height: .34rem;
  915. word-break: break-all;
  916. -webkit-box-flex: 1;
  917. -ms-flex: 1;
  918. flex: 1;
  919. margin-top: .16rem;
  920. }
  921. .GM-csdn-img img{
  922. width: 2.18rem;
  923. height: 1.58rem;
  924. //margin-left: .16rem
  925. }
  926. .GM-csdn-Redirect{
  927. color: #fff;
  928. background-color: #f90707;
  929. font-family: sans-serif;
  930. margin: auto 2px;
  931. border: 1px solid #ccc;
  932. border-radius: 4px;
  933. padding: 0px 3px;
  934. font-size: xx-small;
  935. display: inline;
  936. white-space: nowrap;
  937. }`);
  938. },
  939. /**
  940. * 重构底部推荐
  941. */
  942. refactoringRecommendation() {
  943. log.info("重构底部推荐");
  944. function refactoring() {
  945. /* 反复执行的重构函数 */
  946. document.querySelectorAll(".container-fluid").forEach((item) => {
  947. var url = ""; /* 链接 */
  948. var title = ""; /* 标题 */
  949. var content = ""; /* 内容 */
  950. var img = ""; /* 图片 */
  951. var isCSDNDownload = false; /* 判断是否是CSDN资源下载 */
  952. var isCSDNEduDownload = false; /* 判断是否是CSDN-学院资源下载 */
  953. if (item.hasAttribute("data-url")) {
  954. /* 存在真正的URL */
  955. url = item.getAttribute("data-url");
  956. title = item.querySelector(
  957. ".recommend_title div.left"
  958. ).innerHTML;
  959. content = item.querySelector(".text").innerHTML;
  960. if (item.querySelectorAll(".recommend-img").length) {
  961. /* 如果有图片就加进去 */
  962. item.querySelectorAll(".recommend-img").forEach((item2) => {
  963. img += item2.innerHTML;
  964. });
  965. }
  966. } else {
  967. log.info("节点上无data-url");
  968. url = item.querySelector("a[data-type]").getAttribute("href");
  969. title = item.querySelector(
  970. ".recommend_title div.left"
  971. ).innerHTML;
  972. content = item.querySelector(".text").innerHTML;
  973. }
  974. if (GM_Menu.get("showDirect")) {
  975. /* 开启就添加 */
  976. title += `<div class="GM-csdn-Redirect">Redirect</div>`;
  977. }
  978. var _URL_ = new URL(url);
  979. if (
  980. _URL_.host === "download.csdn.net" ||
  981. (_URL_.host === "www.iteye.com" &&
  982. _URL_.pathname.match(/^\/resource/gi))
  983. ) {
  984. /* 该链接为csdn资源下载 */
  985. log.info("该链接为csdn资源下载");
  986. isCSDNDownload = true;
  987. title += `<div class="component-box"><a class="praise" href="javascript:;">CSDN下载</a></div>`;
  988. } else if (_URL_.origin.match(/edu.csdn.net/gi)) {
  989. /* 该链接为csdn学院下载 */
  990. isCSDNEduDownload = true;
  991. log.info("该链接为csdn学院下载");
  992. title += `<div class="component-box"><a class="csdn-edu-title" href="javascript:;">CSDN学院</a></div>`;
  993. }
  994. item.setAttribute("class", "GM-csdn-dl");
  995. item.setAttribute("data-url", url);
  996. item.innerHTML = `<div class="GM-csdn-title"><div class="left">${title}</div></div><div class="GM-csdn-content">${content}</div><div class="GM-csdn-img">${img}</div>`;
  997. item.addEventListener("click", function () {
  998. if (GM_Menu.get("openNewTab")) {
  999. window.open(url, "_blank");
  1000. } else {
  1001. window.location.href = url;
  1002. }
  1003. });
  1004. if (
  1005. (isCSDNDownload || isCSDNEduDownload) &&
  1006. GM_Menu.get("removeCSDNDownloadMobile")
  1007. ) {
  1008. item.remove();
  1009. }
  1010. });
  1011. }
  1012. utils.waitNode("#recommend").then((nodeList) => {
  1013. utils.mutationObserver(nodeList[0], {
  1014. callback: () => {
  1015. setTimeout(() => {
  1016. refactoring();
  1017. }, 300);
  1018. },
  1019. config: { childList: true, subtree: true, attributes: true },
  1020. });
  1021. });
  1022. },
  1023. /**
  1024. * 去除广告
  1025. */
  1026. removeAds() {
  1027. log.info("去除广告");
  1028. /* 登录窗口 */
  1029. waitForElementToRemove(".passport-login-container");
  1030. /* 打开APP */
  1031. waitForElementToRemove(
  1032. ".btn_open_app_prompt_box.detail-open-removed"
  1033. );
  1034. /* 广告 */
  1035. waitForElementToRemove(".add-firstAd");
  1036. /* 打开CSDN APP 小程序看全文 */
  1037. waitForElementToRemove("div.feed-Sign-weixin");
  1038. /* ios版本提示 */
  1039. waitForElementToRemove("div.ios-shadowbox");
  1040. },
  1041. run() {
  1042. this.addCSS();
  1043. let that = this;
  1044. let readyCallBack = function () {
  1045. that.removeAds();
  1046. that.refactoringRecommendation();
  1047. };
  1048. if (document.readyState !== "loading") {
  1049. readyCallBack();
  1050. } else {
  1051. document.addEventListener("DOMContentLoaded", readyCallBack);
  1052. }
  1053. },
  1054. },
  1055. /**
  1056. * 函数入口
  1057. */
  1058. run() {
  1059. Optimization.csdn.PC.jumpRedirect();
  1060. if (utils.isPhone()) {
  1061. log.success("移动端模式");
  1062. this.Mobile.run();
  1063. } else {
  1064. log.success("桌面端模式");
  1065. this.PC.run();
  1066. }
  1067. },
  1068. },
  1069. huaWeiCSDN: {
  1070. /**
  1071. * 判断是否是CSDN
  1072. */
  1073. locationMatch() {
  1074. return Boolean(/huaweicloud.csdn.net/i.test(window.location.origin));
  1075. },
  1076. PC: {
  1077. addCSS() {
  1078. GM_addStyle(`
  1079. /* 底部免费抽xxx奖品广告 */
  1080. div.siderbar-box,
  1081. /* 华为开发者联盟加入社区 */
  1082. div.user-desc.user-desc-fix,
  1083. /* 点击阅读全文 */
  1084. div.article-show-more{
  1085. display: none !important;
  1086. }
  1087.  
  1088. /* 自动展开全文 */
  1089. .main-content .user-article{
  1090. height: auto !important;
  1091. overflow: auto !important;
  1092. }
  1093. `);
  1094. },
  1095. run() {
  1096. this.addCSS();
  1097. this.huaweiCSDNShieldCloudDeveloperTaskChallengeEvent();
  1098. this.huaweiCSDNShieldLeftFloatingButton();
  1099. this.huaweiCSDNBlockRightColumn();
  1100. this.huaweiCSDNBlockRecommendedContentAtTheBottom();
  1101. this.huaweiCSDNShieldTheBottomForMoreRecommendations();
  1102. },
  1103. /**
  1104. * 屏蔽云开发者任务挑战活动
  1105. */
  1106. huaweiCSDNShieldCloudDeveloperTaskChallengeEvent() {
  1107. let GM_cookie = new utils.GM_Cookie();
  1108. GM_cookie.set({ name: "show_join_group_index", value: 1 });
  1109. log.success("屏蔽云开发者任务挑战活动");
  1110. },
  1111. /**
  1112. * 屏蔽左侧悬浮按钮
  1113. */
  1114. huaweiCSDNShieldLeftFloatingButton() {
  1115. if (!GM_Menu.get("huaweiCSDNShieldLeftFloatingButton")) {
  1116. return;
  1117. }
  1118. log.success(
  1119. "屏蔽左侧悬浮按钮,包括当前阅读量、点赞按钮、评论按钮、分享按钮"
  1120. );
  1121. GM_addStyle(`
  1122. div.toolbar-wrapper.article-interact-bar{
  1123. display: none !important;
  1124. }`);
  1125. },
  1126. /**
  1127. * 屏蔽右侧栏
  1128. */
  1129. huaweiCSDNBlockRightColumn() {
  1130. if (!GM_Menu.get("huaweiCSDNBlockRightColumn")) {
  1131. return;
  1132. }
  1133. log.success("屏蔽右侧栏,包括相关产品-活动日历-运营活动-热门标签");
  1134. GM_addStyle(`
  1135. div.page-home-right.dp-aside-right{
  1136. display: none !important;
  1137. }
  1138. `);
  1139. },
  1140. /**
  1141. * 屏蔽底部推荐内容
  1142. */
  1143. huaweiCSDNBlockRecommendedContentAtTheBottom() {
  1144. if (!GM_Menu.get("huaweiCSDNBlockRecommendedContentAtTheBottom")) {
  1145. return;
  1146. }
  1147. log.success("屏蔽底部推荐内容");
  1148. GM_addStyle(`
  1149. div.recommend-card-box{
  1150. display: none !important;
  1151. }`);
  1152. },
  1153. /**
  1154. * 屏蔽底部更多推荐
  1155. */
  1156. huaweiCSDNShieldTheBottomForMoreRecommendations() {
  1157. if (!GM_Menu.get("huaweiCSDNShieldTheBottomForMoreRecommendations")) {
  1158. return;
  1159. }
  1160. log.success("屏蔽底部更多推荐");
  1161. GM_addStyle(`
  1162. div.more-article{
  1163. display: none !important;
  1164. }`);
  1165. },
  1166. },
  1167. },
  1168. };
  1169. if (Optimization.huaWeiCSDN.locationMatch()) {
  1170. GM_Menu = new utils.GM_Menu(
  1171. {
  1172. huaweiCSDNShieldCloudDeveloperTaskChallengeEvent: {
  1173. text: "电脑-屏蔽云开发者任务挑战活动",
  1174. enable: true,
  1175. showText: (_text_, _enable_) => {
  1176. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1177. },
  1178. callback: () => {
  1179. window.location.reload();
  1180. },
  1181. },
  1182. huaweiCSDNShieldLeftFloatingButton: {
  1183. text: "电脑-屏蔽左侧悬浮按钮",
  1184. enable: false,
  1185. title: "包括当前阅读量、点赞按钮、评论按钮、分享按钮",
  1186. showText: (_text_, _enable_) => {
  1187. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1188. },
  1189. callback: () => {
  1190. window.location.reload();
  1191. },
  1192. },
  1193. huaweiCSDNBlockRightColumn: {
  1194. text: "电脑-屏蔽右侧",
  1195. enable: false,
  1196. title: "包括相关产品-活动日历-运营活动-热门标签",
  1197. showText: (_text_, _enable_) => {
  1198. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1199. },
  1200. callback: () => {
  1201. window.location.reload();
  1202. },
  1203. },
  1204. huaweiCSDNBlockRecommendedContentAtTheBottom: {
  1205. text: "电脑-屏蔽底部推荐内容",
  1206. enable: false,
  1207. showText: (_text_, _enable_) => {
  1208. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1209. },
  1210. callback: () => {
  1211. window.location.reload();
  1212. },
  1213. },
  1214. huaweiCSDNShieldTheBottomForMoreRecommendations: {
  1215. text: "电脑-屏蔽底部更多推荐",
  1216. enable: false,
  1217. showText: (_text_, _enable_) => {
  1218. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1219. },
  1220. callback: () => {
  1221. window.location.reload();
  1222. },
  1223. },
  1224. },
  1225. false,
  1226. GM_getValue,
  1227. GM_setValue,
  1228. GM_registerMenuCommand,
  1229. GM_unregisterMenuCommand
  1230. );
  1231. Optimization.huaWeiCSDN.PC.run();
  1232. } else if (Optimization.csdn.locationMatch()) {
  1233. if (utils.isPhone()) {
  1234. GM_Menu = new utils.GM_Menu(
  1235. {
  1236. showDirect: {
  1237. text: "手机-标识处理过的底部推荐文章",
  1238. enable: true,
  1239. showText: (_text_, _enable_) => {
  1240. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1241. },
  1242. callback: () => {
  1243. window.location.reload();
  1244. },
  1245. },
  1246. openNewTab: {
  1247. text: "手机-底部推荐文章新标签页打开",
  1248. enable: true,
  1249. showText: (_text_, _enable_) => {
  1250. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1251. },
  1252. callback: () => {
  1253. window.location.reload();
  1254. },
  1255. },
  1256. removeCSDNDownloadMobile: {
  1257. text: "手机-移除文章底部的CSDN下载",
  1258. enable: false,
  1259. showText: (_text_, _enable_) => {
  1260. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1261. },
  1262. callback: () => {
  1263. window.location.reload();
  1264. },
  1265. },
  1266. },
  1267. false,
  1268. GM_getValue,
  1269. GM_setValue,
  1270. GM_registerMenuCommand,
  1271. GM_unregisterMenuCommand
  1272. );
  1273. } else {
  1274. GM_Menu = new utils.GM_Menu(
  1275. {
  1276. removeCSDNDownloadPC: {
  1277. text: "电脑-屏蔽底部推荐文章的CSDN下载",
  1278. enable: false,
  1279. showText: (_text_, _enable_) => {
  1280. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1281. },
  1282. callback: () => {
  1283. window.location.reload();
  1284. },
  1285. },
  1286. shieldLoginDialog: {
  1287. text: "电脑-屏蔽登录弹窗",
  1288. enable: true,
  1289. showText: (_text_, _enable_) => {
  1290. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1291. },
  1292. callback: (_key_, _enable_) => {
  1293. if (!_enable_) {
  1294. window.GM_CSS_GM_shieldLoginDialog?.forEach((item) => {
  1295. item.remove();
  1296. });
  1297. } else {
  1298. if (typeof window.GM_CSS_GM_shieldLoginDialog !== "undefined") {
  1299. window.GM_CSS_GM_shieldLoginDialog = [
  1300. ...window.GM_CSS_GM_shieldLoginDialog,
  1301. GM_addStyle(
  1302. `.passport-login-container{display: none !important;}`
  1303. ),
  1304. ];
  1305. } else {
  1306. window.GM_CSS_GM_shieldLoginDialog = [
  1307. GM_addStyle(
  1308. `.passport-login-container{display: none !important;}`
  1309. ),
  1310. ];
  1311. }
  1312. }
  1313. },
  1314. },
  1315. csdnShieldfloatingButton: {
  1316. text: "电脑-屏蔽右侧悬浮按钮",
  1317. enable: false,
  1318. showText: (_text_, _enable_) => {
  1319. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1320. },
  1321. callback: () => {
  1322. window.location.reload();
  1323. },
  1324. },
  1325. csdnShieldBottomRecommendArticle: {
  1326. text: "电脑-屏蔽底部推荐文章",
  1327. enable: false,
  1328. showText: (_text_, _enable_) => {
  1329. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1330. },
  1331. callback: () => {
  1332. window.location.reload();
  1333. },
  1334. },
  1335. csdnShieldBottomFloatingToolbar: {
  1336. text: "电脑-屏蔽底部悬浮工具栏",
  1337. enable: false,
  1338. showText: (_text_, _enable_) => {
  1339. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1340. },
  1341. callback: () => {
  1342. window.location.reload();
  1343. },
  1344. },
  1345. articleCenter: {
  1346. text: "电脑-全文居中",
  1347. enable: true,
  1348. showText: (_text_, _enable_) => {
  1349. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1350. },
  1351. callback: () => {
  1352. window.location.reload();
  1353. },
  1354. },
  1355. autoExpandContent: {
  1356. text: "电脑-自动展开内容块",
  1357. enable: false,
  1358. showText: (_text_, _enable_) => {
  1359. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1360. },
  1361. callback: () => {
  1362. window.location.reload();
  1363. },
  1364. },
  1365. showOrHideDirectory: {
  1366. text: "电脑-显示目录",
  1367. enable: false,
  1368. showText: (_text_, _enable_) => {
  1369. return _enable_ ? `⚙ 电脑-隐藏目录` : `⚙ ${_text_}`;
  1370. },
  1371. callback: (_key_, _enable_) => {
  1372. window.location.reload();
  1373. },
  1374. },
  1375. showOrHideSidebar: {
  1376. text: "电脑-显示侧边栏",
  1377. enable: false,
  1378. showText: (_text_, _enable_) => {
  1379. return _enable_ ? `⚙ 电脑-隐藏侧边栏` : `⚙ ${_text_}`;
  1380. },
  1381. callback: (_key_, _enable_) => {
  1382. window.location.reload();
  1383. },
  1384. },
  1385. },
  1386. false,
  1387. GM_getValue,
  1388. GM_setValue,
  1389. GM_registerMenuCommand,
  1390. GM_unregisterMenuCommand
  1391. );
  1392. }
  1393. GM_Menu.add({
  1394. gotoCSDNCKnow: {
  1395. text: "⚙ 前往C知道",
  1396. callback() {
  1397. window.open("https://so.csdn.net/so/ai?", "_blank");
  1398. },
  1399. },
  1400. });
  1401. Optimization.csdn.run();
  1402. } else if (Optimization.jianshu.locationMatch()) {
  1403. if (utils.isPhone()) {
  1404. GM_Menu = new utils.GM_Menu(
  1405. {
  1406. JianShuremoveFooterRecommendRead: {
  1407. text: "手机-移除底部推荐阅读",
  1408. enable: false,
  1409. showText: (_text_, _enable_) => {
  1410. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1411. },
  1412. callback: () => {
  1413. window.location.reload();
  1414. },
  1415. },
  1416. JianShuShieldUserComments: {
  1417. text: "手机-屏蔽评论区",
  1418. showText: (_text_, _enable_) => {
  1419. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1420. },
  1421. callback: () => {
  1422. window.location.reload();
  1423. },
  1424. },
  1425. },
  1426. false,
  1427. GM_getValue,
  1428. GM_setValue,
  1429. GM_registerMenuCommand,
  1430. GM_unregisterMenuCommand
  1431. );
  1432. } else {
  1433. GM_Menu = new utils.GM_Menu(
  1434. {
  1435. JianShuArticleCenter: {
  1436. text: "电脑-全文居中",
  1437. enable: true,
  1438. showText: (_text_, _enable_) => {
  1439. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1440. },
  1441. callback: () => {
  1442. window.location.reload();
  1443. },
  1444. },
  1445. JianShuShieldRelatedArticles: {
  1446. text: "电脑-屏蔽相关文章",
  1447. enable: false,
  1448. showText: (_text_, _enable_) => {
  1449. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1450. },
  1451. callback: () => {
  1452. window.location.reload();
  1453. },
  1454. },
  1455. JianShuShieldUserComments: {
  1456. text: "电脑-屏蔽评论区",
  1457. enable: false,
  1458. showText: (_text_, _enable_) => {
  1459. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1460. },
  1461. callback: () => {
  1462. window.location.reload();
  1463. },
  1464. },
  1465. JianShuShieldRecommendedReading: {
  1466. text: "电脑-屏蔽推荐阅读",
  1467. enable: false,
  1468. showText: (_text_, _enable_) => {
  1469. return (_enable_ ? "✅" : "❌") + " " + _text_;
  1470. },
  1471. callback: () => {
  1472. window.location.reload();
  1473. },
  1474. },
  1475. },
  1476. false,
  1477. GM_getValue,
  1478. GM_setValue,
  1479. GM_registerMenuCommand,
  1480. GM_unregisterMenuCommand
  1481. );
  1482. }
  1483.  
  1484. Optimization.jianshu.run();
  1485. }
  1486. })();