CSDN优化

CSDN阅读优化

当前为 2018-11-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CSDN优化
  3. // @description CSDN阅读优化
  4. // @namespace Violentmonkey Scripts
  5. // @match *://*.blog.csdn.net/*/article/details/*
  6. // @grant none
  7. // @version 1.0
  8. // ==/UserScript==
  9. function hide(dom) {
  10. if (!dom) {
  11. return
  12. }
  13. if (dom instanceof NodeList) {
  14. dom.forEach(function(item, index) {
  15. item.style.display = 'none'
  16. })
  17. }
  18. if (dom instanceof Node) {
  19. dom.style.display = 'none'
  20. }
  21. }
  22.  
  23. // 去除查看更多登陆限制
  24. hide(document.querySelector('.hide-article-box'))
  25. document.querySelector('#article_content').style.height = 'auto'
  26. document.querySelector('#article_content').style.overflow = 'auto'
  27.  
  28. // 底栏
  29. hide(document.querySelector('.pulllog-box'))
  30.  
  31. // 去除广告
  32. hide(document.querySelectorAll('.recommend-ad-box'))
  33. hide(document.querySelector('#adContent'))
  34. hide(document.querySelector('._360_interactive'))
  35. hide(document.querySelector('.fourth_column'))
  36. document.querySelectorAll('main>*').forEach(function(item, index) {
  37. var idStr = item.getAttribute('id') || ''
  38. if (idStr.indexOf('_ad') != -1) {
  39. hide(item)
  40. }
  41. })
  42. document.querySelectorAll('aside>*').forEach(function(item, index) {
  43. var classStr = item.className || ''
  44. var idStr = item.getAttribute('id') || ''
  45. if (classStr.indexOf('csdn-tracking-statistics') != -1) {
  46. hide(item)
  47. } else if (idStr == 'asideFooter') {
  48. if (item.children.length == 2) {
  49. hide(item.children[0])
  50. }
  51. }
  52. })

QingJ © 2025

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