CSDN极致去广告

CSDN去广告(除了文章其他全去)

  1. // ==UserScript==
  2. // @name CSDN极致去广告
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.21
  5. // @description CSDN去广告(除了文章其他全去)
  6. // @author Azero
  7. // @match http*://blog.csdn.net/*/article/details/*
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. //添加watch功能
  16. if (!Object.prototype.watch) {
  17. Object.defineProperty(Object.prototype, "watch", {
  18. enumerable: false
  19. , configurable: true
  20. , writable: false
  21. , value: function (prop, handler) {
  22. var
  23. oldval = this[prop]
  24. , newval = oldval
  25. , getter = function () {
  26. return newval;
  27. }
  28. , setter = function (val) {
  29. oldval = newval;
  30. return newval = handler.call(this, prop, oldval, val);
  31. }
  32. ;
  33. if (delete this[prop]) { // can't watch constants
  34. Object.defineProperty(this, prop, {
  35. get: getter
  36. , set: setter
  37. , enumerable: true
  38. , configurable: true
  39. });
  40. }
  41. }
  42. });
  43. }
  44. //变量值锁定
  45. function staticValue(name,val) {
  46. unsafeWindow.watch(name,function(id, old, cur) {
  47. return val;
  48. });
  49. }
  50. unsafeWindow.currentUserName = "azero"
  51. staticValue("currentUserName","azero");
  52.  
  53. //页面加载完成监听事件
  54. // document.addEventListener ("DOMContentLoaded", DOM_ContentReady);
  55. unsafeWindow.addEventListener ("load", pageFullyLoaded);
  56. //加载完成后运行
  57. function pageFullyLoaded () {
  58. if (GM_getValue("csdnNotifi",true)==true)
  59. {
  60. window.alert("请点击网页空白处");
  61. $('body')[0].addEventListener("click", function () {
  62. if(!confirm("CSDN极致去广告脚本已更新\n为解决csdn反广告问题\n本脚本需要配合abp类插件并添加过滤列表\n请查看项目主页获取教程\n是否再次提示(取消即不再提示,确认将打开项目主页)"))
  63. GM_setValue("csdnNotifi",false);
  64. else
  65. window.open('https://github.com/Azero-NG/csdnRemoveAd/blob/master/abp%E6%B7%BB%E5%8A%A0%E8%87%AA%E5%AE%9A%E4%B9%89%E8%BF%87%E6%BB%A4%E5%99%A8.md');
  66. GM_setValue("csdnNotifi",false);
  67. });
  68.  
  69. }
  70. else
  71. {
  72. //阅读全文
  73. $('#article_content').removeAttr("style");
  74. $('.hide-article-box').remove();
  75. //移除左侧
  76. $('aside').remove();
  77. //下方广告
  78. $('.pulllog-box').remove();
  79. $('.p4course_target').remove();
  80. //下部推荐
  81. $('.recommend-box').remove();
  82. $('.t0').remove();
  83. //上方工具栏
  84. $('#csdn-toolbar').remove();
  85. //右侧菜单
  86. $('.tool-box').remove();
  87. //右侧推荐
  88. $('.recommend-right').remove();
  89. //vip免广告 按钮
  90. $('.meau-gotop-box').remove();
  91. //未登录(不可用)提示
  92. $('.unlogin-box').remove();
  93. //评论上方广告
  94. $('#dmp_ad_58').remove();
  95. //去版权
  96. $('.article-copyright').remove();
  97. //右侧第四栏
  98. $('.fourth_column').remove();
  99. //评论自动展开
  100. $('#btnMoreComment').click();
  101. //居中
  102. $("main").css("float","none");
  103. $("main").css("margin","auto");
  104. //去除剪切板劫持
  105. csdn.copyright.init("", "", "");
  106. }
  107. }
  108.  
  109. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址