CSDN|简书优化

支持手机端和PC端

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

  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.6.2
  7. // @description 支持手机端和PC端
  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://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.4.1/jquery.min.js
  22. // @require https://greasyfork.org/scripts/449471-viewer/code/Viewer.js
  23. // @require https://greasyfork.org/scripts/455186-whitesevsutils/code/WhiteSevsUtils.js
  24. // ==/UserScript==
  25.  
  26. (function () {
  27. let log = new Utils.Log(GM_info);
  28. function waitForElementToRemove(_query_ = "") {
  29. /* 移除元素(未出现也可以等待出现) */
  30. Utils.waitNode(_query_).then((dom) => {
  31. dom.forEach((item) => {
  32. $(item).remove();
  33. });
  34. });
  35. }
  36. /**
  37. * 因为在有些页面上,比如:简书,当插入style元素到head中,该页面清除该元素
  38. * @param {String} styleText
  39. * @returns
  40. */
  41. let GM_addStyle = Utils.GM_addStyle;
  42. function JianShu() {
  43. /* 简书 */
  44. function isJianShu() {
  45. /* 判断是否是 简书 */
  46. return Boolean(/jianshu.(com|io)/i.test(window.location.origin));
  47. }
  48. function articleCenter() {
  49. /* 全文居中 */
  50. const articleCenterCSS = `
  51. div[role=main] aside,
  52. div._3Pnjry{
  53. display: none !important;
  54. }
  55. div._gp-ck{
  56. width: 100% !important;
  57. }
  58. `;
  59. GM_addStyle(articleCenterCSS);
  60. waitForElementToRemove("div[role=main] aside");
  61. waitForElementToRemove("div._3Pnjry");
  62. Utils.waitNode("div._gp-ck").then((dom) => {
  63. dom.forEach((item) => {
  64. item.style["width"] = "100%";
  65. });
  66. });
  67. }
  68. function JianShuremoveFooterRecommendRead() {
  69. /* 手机-移除底部推荐阅读 */
  70. GM_addStyle(`
  71. #recommended-notes{
  72. display: none !important;
  73. }
  74. `);
  75. }
  76. function PC() {
  77. log.info("当前为PC和移动端混合处理");
  78. var JianShuCSS = `
  79. .download-app-guidance,
  80. .call-app-btn,
  81. .collapse-tips,
  82. .note-graceful-button,
  83. .app-open,
  84. .header-wrap,
  85. .recommend-wrap.recommend-ad,
  86. .call-app-Ad-bottom,
  87. #recommended-notes p.top-title span.more,
  88. #homepage .modal,
  89. button.index_call-app-btn,
  90. span.note__flow__download,
  91. .download-guide,
  92. #footer,
  93. .comment-open-app-btn-wrap,
  94. .nav.navbar-nav + div,
  95. .self-flow-ad,
  96. #free-reward-panel,
  97. div[id*='AdFive']{
  98. display:none !important;
  99. }
  100. body.reader-day-mode.normal-size {
  101. overflow: auto !important;
  102. }
  103. .collapse-free-content{
  104. height:auto !important;
  105. }
  106. .copyright{
  107. color:#000 !important;
  108. }
  109. #note-show .content .show-content-free .collapse-free-content:after{
  110. background-image:none !important;
  111. }
  112. footer > div > div{
  113. justify-content: center;
  114. }
  115. `;
  116. let JianShuCSSNode = GM_addStyle(JianShuCSS);
  117. log.info("添加css");
  118. log.info(JianShuCSSNode);
  119. Utils.waitNode('div#homepage div[class*="dialog-"]').then((nodeList) => {
  120. nodeList[0].style["visibility"] = "hidden";
  121. Utils.mutationObserver(nodeList[0], {
  122. callback: (mutations) => {
  123. if (mutations.length == 0) {
  124. return;
  125. }
  126. if (mutations[0].target.style["display"] != "none") {
  127. document
  128. .querySelector('div#homepage div[class*="dialog-"] .cancel')
  129. ?.click();
  130. }
  131. },
  132. config: {
  133. /* 子节点的变动(新增、删除或者更改) */
  134. childList: false,
  135. /* 属性的变动 */
  136. attributes: true,
  137. /* 节点内容或节点文本的变动 */
  138. characterData: true,
  139. /* 是否将观察器应用于该节点的所有后代节点 */
  140. subtree: true,
  141. },
  142. });
  143. });
  144.  
  145. if (GM_Menu.get("JianShuArticleCenter")) {
  146. articleCenter();
  147. }
  148. if (GM_Menu.get("JianShuremoveFooterRecommendRead")) {
  149. JianShuremoveFooterRecommendRead();
  150. }
  151. }
  152. if (isJianShu()) {
  153. if (window.location.pathname === "/go-wild") {
  154. /* 禁止简书拦截跳转 */
  155. let search = window.location.href.replace(
  156. window.location.origin + "/",
  157. ""
  158. );
  159. search = decodeURIComponent(search);
  160. let newURL = search
  161. .replace(/^go-wild\?ac=2&url=/gi, "")
  162. .replace(/^https:\/\/link.zhihu.com\/\?target\=/gi, "");
  163. window.location.href = newURL;
  164. }
  165. PC();
  166. }
  167. }
  168. function CSDN() {
  169. /* csdn-移动端 */
  170. function isCSDN() {
  171. /* 判断是否是 CSDN */
  172. return Boolean(/csdn.net/i.test(window.location.origin));
  173. }
  174. function Mobile() {
  175. /* 移动端 */
  176. log.info("执行");
  177. const css = `
  178. #mainBox{
  179. width: auto;
  180. }
  181. .user-desc.user-desc-fix{
  182. height: auto !important;
  183. overflow: auto !important;
  184. }
  185. #operate,.feed-Sign-span,
  186. .view_comment_box,
  187. .weixin-shadowbox.wap-shadowbox,
  188. .feed-Sign-span,
  189. .user-desc.user-desc-fix,
  190. .comment_read_more_box,
  191. #content_views pre.set-code-hide .hide-preCode-box,
  192. .passport-login-container,
  193. .hljs-button[data-title='登录后复制'],
  194. .article-show-more,
  195. #treeSkill,
  196. div.btn_open_app_prompt_div,
  197. div.readall_box,
  198. div.aside-header-fixed{
  199. display:none !important;
  200. }
  201. .GM-csdn-dl{
  202. padding: .24rem .32rem;
  203. width: 100%;
  204. justify-content: space-between;
  205. -webkit-box-pack: justify;
  206. border-bottom: 1px solid #F5F6F7!important;
  207. }
  208. .GM-csdn-title{
  209. font-size: .3rem;
  210. color: #222226;
  211. letter-spacing: 0;
  212. line-height: .44rem;
  213. font-weight: 600;
  214. //max-height: .88rem;
  215. word-break: break-all;
  216. overflow: hidden;
  217. display: -webkit-box;
  218. -webkit-box-orient: vertical;
  219. -webkit-line-clamp: 2
  220. }
  221. .GM-csdn-title a{
  222. word-break: break-all;
  223. color: #222226;
  224. font-weight: 600;
  225. }
  226. .GM-csdn-title em,.GM-csdn-content em{
  227. font-style: normal;
  228. color: #fc5531
  229. }
  230. .GM-csdn-content{
  231. //max-width: 5.58rem;
  232. overflow: hidden;
  233. text-overflow: ellipsis;
  234. display: -webkit-box;
  235. -webkit-line-clamp: 1;
  236. -webkit-box-orient: vertical;
  237. color: #555666;
  238. font-size: .24rem;
  239. line-height: .34rem;
  240. max-height: .34rem;
  241. word-break: break-all;
  242. -webkit-box-flex: 1;
  243. -ms-flex: 1;
  244. flex: 1;
  245. margin-top: .16rem;
  246. }
  247. .GM-csdn-img img{
  248. width: 2.18rem;
  249. height: 1.58rem;
  250. //margin-left: .16rem
  251. }
  252. .GM-csdn-Redirect{
  253. color: #fff;
  254. background-color: #f90707;
  255. font-family: sans-serif;
  256. margin: auto 2px;
  257. border: 1px solid #ccc;
  258. border-radius: 4px;
  259. padding: 0px 3px;
  260. font-size: xx-small;
  261. display: inline;
  262. white-space: nowrap;
  263. }
  264. .component-box .praise {
  265. background: #ff5722;
  266. border-radius: 5px;
  267. padding: 0px 8px;
  268. height: auto;
  269. }
  270. .component-box .praise,.component-box .share {
  271. color: #fff;
  272. }
  273. .component-box a {
  274. display: inline-block;
  275. font-size:xx-small;
  276. }
  277. .component-box {
  278. display: inline;
  279. margin: 0;
  280. position: relative;
  281. white-space:nowrap;
  282. }
  283. .csdn-edu-title{
  284. background: #4d6de1;
  285. border-radius: 5px;
  286. padding: 0px 8px;
  287. height: auto;
  288. color: #fff !important;
  289. }
  290. #comment{
  291. max-height: none !important;
  292. }
  293. #content_views pre,
  294. #content_views pre code{
  295. webkit-touch-callout: text !important;
  296. -webkit-user-select: text !important;
  297. -khtml-user-select: text !important;
  298. -moz-user-select: text !important;
  299. -ms-user-select: text !important;
  300. user-select: text !important;
  301. }
  302. #content_views pre.set-code-hide,
  303. .article_content{
  304. height: 100% !important;
  305. overflow: auto !important;
  306. }
  307. `;
  308. GM_addStyle(css);
  309. function refactoringRecommendation() {
  310. /* 重构底部推荐 */
  311. log.info("重构底部推荐");
  312. function refactoring() {
  313. /* 反复执行的重构函数 */
  314. $(".container-fluid").each((index, item) => {
  315. item = $(item);
  316. var url = ""; /* 链接 */
  317. var title = ""; /* 标题 */
  318. var content = ""; /* 内容 */
  319. var img = ""; /* 图片 */
  320. var isCSDNDownload = false; /* 判断是否是CSDN资源下载 */
  321. var isCSDNEduDownload = false; /* 判断是否是CSDN-学院资源下载 */
  322. if (item.attr("data-url")) {
  323. /* 存在真正的URL */
  324. url = item.attr("data-url");
  325. title = item.find(".recommend_title div.left").html();
  326. content = item.find(".text").html();
  327. if (item.find(".recommend-img").length) {
  328. /* 如果有图片就加进去 */
  329. item.find(".recommend-img").each((_index_, _item_) => {
  330. img += $(_item_).html();
  331. });
  332. }
  333. } else {
  334. log.info("节点上无data-url");
  335. url = item.find("a[data-type]").attr("href");
  336. title = item.find(".recommend_title div.left").html();
  337. content = item.find(".text").html();
  338. }
  339. if (GM_Menu.get("showDirect")) {
  340. /* 开启就添加 */
  341. title += `<div class="GM-csdn-Redirect">Redirect</div>`;
  342. }
  343. var _URL_ = new URL(url);
  344. if (
  345. _URL_.host === "download.csdn.net" ||
  346. (_URL_.host === "www.iteye.com" &&
  347. _URL_.pathname.match(/^\/resource/gi))
  348. ) {
  349. /* 该链接为csdn资源下载 */
  350. log.info("该链接为csdn资源下载");
  351. isCSDNDownload = true;
  352. title += `<div class="component-box"><a class="praise" href="javascript:;">CSDN下载</a></div>`;
  353. } else if (_URL_.origin.match(/edu.csdn.net/gi)) {
  354. /* 该链接为csdn学院下载 */
  355. isCSDNEduDownload = true;
  356. log.info("该链接为csdn学院下载");
  357. title += `<div class="component-box"><a class="csdn-edu-title" href="javascript:;">CSDN学院</a></div>`;
  358. }
  359. item.attr("class", "GM-csdn-dl");
  360. item.attr("data-url", url);
  361. item.html(
  362. `<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>`
  363. );
  364. if (
  365. (isCSDNDownload || isCSDNEduDownload) &&
  366. GM_Menu.get("removeCSDNDownloadMobile")
  367. ) {
  368. item.remove();
  369. }
  370. /* $("#recommend")
  371. .find(".recommend_list")
  372. .before($("#first_recommend_list").find("dl").parent().html()); */
  373. });
  374. }
  375. Utils.waitNode("#recommend").then((nodeList) => {
  376. Utils.mutationObserver(nodeList[0], {
  377. callback: () => {
  378. setTimeout(() => {
  379. refactoring();
  380. }, 300);
  381. },
  382. config: { childList: true, subtree: true, attributes: true },
  383. });
  384. });
  385.  
  386. gmRecommendClickEvent();
  387. }
  388.  
  389. function gmRecommendClickEvent() {
  390. /* 设置底部推荐点击跳转事件 */
  391. log.info("设置底部推荐点击跳转事件");
  392. $(document).on("click", ".GM-csdn-dl", function () {
  393. let url = $(this).attr("data-url");
  394. if (GM_Menu.get("openNewTab")) {
  395. window.open(url, "_blank");
  396. } else {
  397. window.location.href = url;
  398. }
  399. });
  400. }
  401.  
  402. function removeAds() {
  403. /* 去除广告 */
  404. log.info("去除广告");
  405. waitForElementToRemove(".passport-login-container");
  406. waitForElementToRemove(".btn_open_app_prompt_box.detail-open-removed");
  407. waitForElementToRemove(".add-firstAd");
  408. }
  409.  
  410. $(document).ready(function () {
  411. removeAds();
  412. refactoringRecommendation();
  413. });
  414. }
  415. function PC() {
  416. /* 桌面端 */
  417. log.info("执行");
  418. const css = `
  419. .ecommend-item-box.recommend-recommend-box,
  420. .login-mark,
  421. .opt-box.text-center,
  422. .leftPop,
  423. #csdn-shop-window,
  424. .toolbar-advert,
  425. .hide-article-box,
  426. .user-desc.user-desc-fix,
  427. .recommend-card-box,
  428. .more-article,
  429. .article-show-more,
  430. #csdn-toolbar-profile-nologin,
  431. .guide-rr-first,
  432. #recommend-item-box-tow{
  433. display: none !important;
  434. }
  435. .comment-list-box{
  436. max-height: none !important;
  437. }
  438. .blog_container_aside,
  439. #nav{
  440. margin-left: -45px;
  441. }
  442. .recommend-right.align-items-stretch.clearfix,.dl_right_fixed{
  443. margin-left: 45px;
  444. }
  445. #content_views pre,
  446. #content_views pre code{
  447. user-select: text !important;
  448. }
  449. #article_content,
  450. .user-article.user-article-hide{
  451. height: auto !important;
  452. overflow: auto !important;
  453. }
  454. `;
  455. function removeClipboardHijacking() {
  456. /* 去除剪贴板劫持 */
  457. log.info("去除剪贴板劫持");
  458. $(".article-copyright")?.remove();
  459. if (unsafeWindow.articleType) {
  460. unsafeWindow.articleType = 0;
  461. }
  462. if (
  463. unsafeWindow.csdn &&
  464. unsafeWindow.csdn.copyright &&
  465. unsafeWindow.csdn.copyright.textData
  466. ) {
  467. unsafeWindow.csdn.copyright.textData = "";
  468. }
  469. if (
  470. unsafeWindow.csdn &&
  471. unsafeWindow.csdn.copyright &&
  472. unsafeWindow.csdn.copyright.htmlData
  473. ) {
  474. unsafeWindow.csdn.copyright.htmlData = "";
  475. }
  476. }
  477. function unBlockCopy() {
  478. /* 取消禁止复制 */
  479. log.info("取消禁止复制");
  480. $(document).on("click", ".hljs-button.signin", function () {
  481. /* 复制按钮 */
  482. let btnNode = $(this);
  483. /* 需要复制的文本 */
  484. let copyText = btnNode.parent().text();
  485. Utils.setClip(copyText);
  486. btnNode.attr("data-title", "复制成功");
  487. });
  488. $(document).on("mouseenter mouseleave", "pre", function () {
  489. this.querySelector(".hljs-button.signin")?.setAttribute(
  490. "data-title",
  491. "复制"
  492. );
  493. });
  494. }
  495. function clickPreCodeAutomatically() {
  496. /* 点击代码块自动展开 */
  497. if (!GM_Menu.get("autoExpandContent")) {
  498. return;
  499. }
  500. log.info("点击代码块自动展开");
  501. $(document).on("click", "pre", function () {
  502. let obj = $(this);
  503. obj.css("height", "auto");
  504. obj.find(".hide-preCode-box")?.remove();
  505. });
  506. }
  507. function restoreComments() {
  508. /* 恢复评论到正确位置 */
  509. /* 第一条评论 */
  510. log.info("恢复评论到正确位置-第一条评论");
  511. Utils.waitNode(".first-recommend-box").then((dom) => {
  512. $(".recommend-box.insert-baidu-box.recommend-box-style").prepend(
  513. $(dom)
  514. );
  515. });
  516. log.info("恢复评论到正确位置-第二条评论");
  517. /* 第二条评论 */
  518. Utils.waitNode(".second-recommend-box").then((dom) => {
  519. $(".recommend-box.insert-baidu-box.recommend-box-style").prepend(
  520. $(dom)
  521. );
  522. });
  523. }
  524. function identityCSDNDownload() {
  525. /* 标识CSDN下载的链接 */
  526. log.info("标识CSDN下载的链接");
  527. $(".recommend-item-box[data-url*='https://download.csdn.net/']").each(
  528. (index, item) => {
  529. if (GM_Menu.get("removeCSDNDownloadPC")) {
  530. item.remove();
  531. } else {
  532. $(item).find(".content-box").css("border", "2px solid red");
  533. }
  534. }
  535. );
  536. }
  537.  
  538. function articleCenter() {
  539. /* 全文居中 */
  540. if (!GM_Menu.get("articleCenter")) {
  541. return;
  542. }
  543. log.info("全文居中");
  544. GM_addStyle(
  545. `aside.blog_container_aside{
  546. display:none !important;
  547. }
  548. #mainBox main{
  549. width: inherit !important;
  550. }
  551. `
  552. );
  553. }
  554. function addGotoRecommandButton() {
  555. /* 添加前往评论的按钮,在返回顶部的下面 */
  556. log.info("添加前往评论的按钮,在返回顶部的下面");
  557. const btnElement = $(`
  558. <a class="option-box" data-type="gorecommand">
  559. <span class="show-txt" style="display:flex;opacity:100;">前往<br>评论</span>
  560. </a>
  561. `);
  562. $(document).on(
  563. "click",
  564. '.option-box[data-type="gorecommand"]',
  565. function () {
  566. log.info("滚动到评论");
  567. $("html, body").animate(
  568. {
  569. scrollTop:
  570. $("#toolBarBox").offset().top -
  571. $("#csdn-toolbar").height() -
  572. 8,
  573. },
  574. 1000
  575. );
  576. }
  577. );
  578. Utils.waitNode(".csdn-side-toolbar").then((dom) => {
  579. $(dom).append(btnElement);
  580. });
  581. }
  582. function shieldLoginDialog() {
  583. /* 屏蔽登录弹窗 */
  584. if (GM_Menu.get("shieldLoginDialog")) {
  585. log.info("屏蔽登录弹窗");
  586. window.GM_CSS_GM_shieldLoginDialog = [
  587. GM_addStyle(`.passport-login-container{display: none !important;}`),
  588. ];
  589. }
  590. }
  591. function autoExpandContent() {
  592. /* 自动展开内容块 */
  593. if (!GM_Menu.get("autoExpandContent")) {
  594. return;
  595. }
  596. log.info("自动展开内容块");
  597. GM_addStyle(`
  598. pre.set-code-hide{
  599. height: auto !important;
  600. }
  601. pre.set-code-hide .hide-preCode-box{
  602. display: none !important;
  603. }
  604. `);
  605. }
  606. GM_addStyle(css);
  607. articleCenter();
  608. shieldLoginDialog();
  609. autoExpandContent();
  610. $(document).ready(function () {
  611. removeClipboardHijacking();
  612. unBlockCopy();
  613. identityCSDNDownload();
  614. clickPreCodeAutomatically();
  615. restoreComments();
  616. addGotoRecommandButton();
  617. });
  618. }
  619.  
  620. if (isCSDN()) {
  621. if (window.location.host === "link.csdn.net") {
  622. /* 禁止CSDN拦截跳转 */
  623. let search = window.location.href.replace(
  624. window.location.origin + "/",
  625. ""
  626. );
  627. search = decodeURIComponent(search);
  628. let newURL = search
  629. .replace(/^\?target\=/gi, "")
  630. .replace(/^https:\/\/link.zhihu.com\/\?target\=/gi, "");
  631. window.location.href = newURL;
  632. }
  633. if (Utils.isPhone()) {
  634. Mobile(); /* 移动端 */
  635. } else {
  636. PC(); /* 桌面端 */
  637. }
  638. }
  639. }
  640. if (Boolean(/csdn.net/i.test(window.location.origin))) {
  641. var GM_Menu = new Utils.GM_Menu(
  642. {
  643. removeCSDNDownloadPC: {
  644. text: "电脑-移除文章底部的CSDN下载",
  645. enable: false,
  646. showText: (_text_, _enable_) => {
  647. return (_enable_ ? "✅" : "❌") + " " + _text_;
  648. },
  649. callback: () => {
  650. window.location.reload();
  651. },
  652. },
  653. articleCenter: {
  654. text: "电脑-全文居中",
  655. enable: true,
  656. showText: (_text_, _enable_) => {
  657. return (_enable_ ? "✅" : "❌") + " " + _text_;
  658. },
  659. callback: () => {
  660. window.location.reload();
  661. },
  662. },
  663. shieldLoginDialog: {
  664. text: "电脑-屏蔽登录弹窗",
  665. enable: true,
  666. showText: (_text_, _enable_) => {
  667. return (_enable_ ? "✅" : "❌") + " " + _text_;
  668. },
  669. callback: (_key_, _enable_) => {
  670. if (!_enable_) {
  671. window.GM_CSS_GM_shieldLoginDialog.forEach((item) => {
  672. item.remove();
  673. });
  674. } else {
  675. if (typeof window.GM_CSS_GM_shieldLoginDialog !== "undefined") {
  676. window.GM_CSS_GM_shieldLoginDialog = [
  677. ...window.GM_CSS_GM_shieldLoginDialog,
  678. GM_addStyle(
  679. `.passport-login-container{display: none !important;}`
  680. ),
  681. ];
  682. } else {
  683. window.GM_CSS_GM_shieldLoginDialog = [
  684. GM_addStyle(
  685. `.passport-login-container{display: none !important;}`
  686. ),
  687. ];
  688. }
  689. }
  690. },
  691. },
  692. autoExpandContent: {
  693. text: "电脑-自动展开内容块",
  694. enable: false,
  695. showText: (_text_, _enable_) => {
  696. return (_enable_ ? "✅" : "❌") + " " + _text_;
  697. },
  698. callback: () => {
  699. window.location.reload();
  700. },
  701. },
  702. showDirect: {
  703. text: "手机-标识处理过的底部推荐文章",
  704. enable: true,
  705. showText: (_text_, _enable_) => {
  706. return (_enable_ ? "✅" : "❌") + " " + _text_;
  707. },
  708. callback: () => {
  709. window.location.reload();
  710. },
  711. },
  712. openNewTab: {
  713. text: "手机-底部推荐文章新标签页打开",
  714. enable: true,
  715. showText: (_text_, _enable_) => {
  716. return (_enable_ ? "✅" : "❌") + " " + _text_;
  717. },
  718. callback: () => {
  719. window.location.reload();
  720. },
  721. },
  722. removeCSDNDownloadMobile: {
  723. text: "手机-移除文章底部的CSDN下载",
  724. enable: false,
  725. showText: (_text_, _enable_) => {
  726. return (_enable_ ? "✅" : "❌") + " " + _text_;
  727. },
  728. callback: () => {
  729. window.location.reload();
  730. },
  731. },
  732. },
  733. false,
  734. GM_getValue,
  735. GM_setValue,
  736. GM_registerMenuCommand,
  737. GM_unregisterMenuCommand
  738. );
  739. } else if (Boolean(/jianshu.(com|io)/i.test(window.location.origin))) {
  740. var GM_Menu = new Utils.GM_Menu(
  741. {
  742. JianShuArticleCenter: {
  743. text: "电脑-全文居中",
  744. enable: true,
  745. showText: (_text_, _enable_) => {
  746. return (_enable_ ? "✅" : "❌") + " " + _text_;
  747. },
  748. callback: () => {
  749. window.location.reload();
  750. },
  751. },
  752. JianShuremoveFooterRecommendRead: {
  753. text: "手机-移除底部推荐阅读",
  754. enable: false,
  755. showText: (_text_, _enable_) => {
  756. return (_enable_ ? "✅" : "❌") + " " + _text_;
  757. },
  758. callback: () => {
  759. window.location.reload();
  760. },
  761. },
  762. },
  763. false,
  764. GM_getValue,
  765. GM_setValue,
  766. GM_registerMenuCommand,
  767. GM_unregisterMenuCommand
  768. );
  769. }
  770.  
  771. JianShu();
  772. CSDN();
  773. })();