Greasy Fork is available in English.

Fuck CSDN

去除CSDN BBS&BLOG&DOWNLOAD&WWW ADP检测/广告/展开全文限制/复制小尾巴/离线网页限制/其它

Fra 03.01.2019. Se den seneste versjonen.

  1. // ==UserScript==
  2. // @namespace Eternal
  3. // @name Fuck CSDN
  4. // @version 1.5
  5. // @description 去除CSDN BBS&BLOG&DOWNLOAD&WWW ADP检测/广告/展开全文限制/复制小尾巴/离线网页限制/其它
  6. // @author 流星暴雨
  7. // @grant none
  8. // @match *blog.csdn.net/*
  9. // @match *bbs.csdn.net/*
  10. // @match *download.csdn.net/*
  11. // @match *www.csdn.net/*
  12. // @run-at document-body
  13. // @homepageURL https://greatest.deepsurf.us/scripts/374950
  14. // @supportURL https://greatest.deepsurf.us/scripts/374950
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. 'use strict';
  19. var extension = true; //如为真则开启拓展功能 去除 联系方式/赚零钱/传资源
  20.  
  21. var addTimer = function (isTrue, code, time) {
  22. var i = time == -1 ? undefined : (time ? time : 10000) / 10;
  23. var mySetInterval = window.setInterval_ ? setInterval_ : setInterval;
  24. var timer = mySetInterval(function () {
  25. i--;
  26. if (i < 0 || eval(isTrue)) {
  27. clearInterval(timer);
  28. eval(code);
  29. }
  30. }, 10);
  31. }
  32.  
  33. var addRMTimer = function (ele, time, code) {
  34. addTimer(`$("${ele}").size() > 0`, `
  35. setTimeout(function () {
  36. "${code}" && eval("${code}");
  37. $("${ele}").remove();
  38. }, 50)`, time)
  39. }
  40.  
  41. var hook = function () {
  42. window.setInterval_ = setInterval;
  43. var mysetInterval = function (fun, time) {
  44. if ((fun + '').match("check-adblock-time")) {
  45. return null;
  46. } else {
  47. return setInterval_(fun, time);
  48. }
  49. }
  50. setInterval = mysetInterval;
  51. document.body.insertBefore_ = document.body.insertBefore;
  52. var myinsertBefore = function (ele, box) {
  53. if (ele.innerHTML.match("ADP") || ele.innerHTML.match("广告")) {
  54. return document.body;
  55. } else {
  56. return document.body.insertBefore_(ele, box);
  57. }
  58. };
  59. document.body.insertBefore = myinsertBefore;
  60. }
  61.  
  62. if (location.host.match("blog")) {
  63. $(function () {
  64. $("#article_content").css("height", '');
  65. $(".hide-article-box").remove();
  66. $(".fourth_column").remove();
  67. $(".pulllog-box").remove();
  68. $(".box-shadow").remove();
  69. $(".aside-box > div[data-track-click]").parent().remove();
  70. $(".BAIDU_DUP_fp_wrapper").remove();
  71. $(".adsbygoogle").parent().remove();
  72. $("#commentBox").prev().remove();
  73. $(".recommend-ad-box").remove();
  74. $("#adContent").remove();
  75. $("div[id*='kp_box']").remove();
  76.  
  77. csdn.copyright && (csdn.copyright.init = function () {});
  78.  
  79. $("img[onerror]").remove();
  80.  
  81. if (extension) {
  82. $(".gitChat").remove();
  83. $(".persion_article").empty();
  84. }
  85. });
  86. addRMTimer(".right-item[class*='ads']");
  87. addRMTimer("#asideFooter > .aside-box:has('iframe')");
  88. addRMTimer("div[class*='box-box']:has('iframe'):contains('关闭')");
  89.  
  90. hook();
  91. } else if (location.host.match("bbs")) {
  92. $(function () {
  93. $(".post_body > div[scrolling=no]").remove();
  94. $(".bbs_feed_ad_box").remove();
  95. $(".post_body > div").remove();
  96. $(".pulllog-box").remove();
  97. $("#adContent").remove();
  98. $("div[id*='kp_box']").remove();
  99.  
  100. if (extension) {
  101. $(".gitChat").remove();
  102. $(".footer_box").empty();
  103. $(".footer_box").css("visibility", "hidden");
  104. }
  105.  
  106. addRMTimer(".hide_topic_box", undefined, "$('#bbs_detail_wrap').css('max-height', '')");
  107. });
  108. } else if (location.host.match("download")) {
  109. addTimer("$", `
  110. $(".check-adblock-bg").parent().remove();
  111. $(function () {
  112. $(".dl_mar").remove();
  113. $(".right_bottom").remove();
  114. $(".hot_arti_list > div").remove();
  115. $("#adContent").remove();
  116. $("#album_detail_wrap > div:not(.dl_more)").remove();
  117. $(".dl_edu").remove();
  118. $("div[id*='kp_box']").remove();
  119.  
  120. if (extension) {
  121. $(".gitChat").remove();
  122. $(".fixed_dl").remove();
  123. }
  124. });
  125. `);
  126.  
  127. hook();
  128.  
  129. addTimer("document.body.insertBefore_ == undefined", `
  130. document.body.insertBefore_ = document.body.insertBefore;
  131. var myinsertBefore = function (ele, box) {
  132. if (ele.innerHTML.match("ADP") || ele.innerHTML.match("广告")) {
  133. return document.body;
  134. } else {
  135. return document.body.insertBefore_(ele, box);
  136. }
  137. };
  138. document.body.insertBefore = myinsertBefore;
  139. `);
  140. } else if (location.host.match("www")) {
  141. $(function () {
  142. $(".banner-ad-box").remove();
  143. $(".slide-outer").remove();
  144. $(".indexSuperise").remove();
  145. $("div[id*='kp_box']").remove();
  146.  
  147. addRMTimer("#adContent");
  148.  
  149. if (extension) {
  150. $(".gitChat").remove();
  151. $(".persion_article").empty();
  152. }
  153. });
  154. }
  155.  
  156. console.log("Fuck CSDN!")
  157. })();