CSDN|简书优化

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

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

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