CSDN|简书优化

支持手机端和PC端

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

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