CSDN优化

去广告,净化剪切板,自动展开全文,免登录

  1. // ==UserScript==
  2. // @name CSDN优化
  3. // @namespace http://happyers.top
  4. // @version 0.1
  5. // @description 去广告,净化剪切板,自动展开全文,免登录
  6. // @author HAPPY
  7. // @match https://blog.csdn.net/*
  8. // @match http://blog.csdn.net/*
  9. // @grant none
  10. // @icon https://csdnimg.cn/public/favicon.ico
  11. // ==/UserScript==
  12.  
  13.  
  14. var sideInterval = 500; //设置多少时间(ms)后去除广告
  15.  
  16.  
  17. function expand(){
  18. var ok = false;
  19. var e = $('.hide-article-box');
  20. if(e.length > 0){
  21. ok = true;
  22. e.remove();
  23. $('#article_content').removeAttr('style');
  24. }
  25. if (document.getElementsByClassName("comment-list-box")[0]){
  26. document.getElementsByClassName("comment-list-box")[0].removeAttribute("style");
  27. } //自动展开评论
  28. }
  29.  
  30. function remove_ad(){
  31. var element = document.querySelector("#asideFooter > div:nth-child(1)");
  32. element.parentNode.removeChild(element);
  33.  
  34. setTimeout(function () {
  35. var hot = document.getElementsByClassName("type_hot_word");
  36. var recommend = document.getElementsByClassName("recommend-ad-box");
  37. for (var i = (hot.length - 1); i >= 0; i--) {
  38. hot[i].remove();
  39. }
  40. for (var j = (recommend.length - 1); j >= 0; j--) {
  41. recommend[j].remove();
  42. }
  43. if (document.getElementsByClassName("fourth_column")[0]) {
  44. document.getElementsByClassName("fourth_column")[0].remove();
  45. }
  46. }, sideInterval);//去除底部推荐中的广告
  47. }
  48.  
  49. (function() {
  50. remove_ad();//去广告
  51. csdn.copyright.init("", "", ""); //去除剪贴板劫持
  52. localStorage.setItem("anonymousUserLimit", ""); // 免登陆
  53. expand();// 自动展开全文
  54. })();