CSDN|简书优化

支持手机端和PC端

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

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