Greasy Fork镜像 支持简体中文。

极致净化 360 文档页

完美阅读体验,去除广告、推荐等一系列和阅读无关的内容

  1. // ==UserScript==
  2. // @name 极致净化 360 文档页
  3. // @namespace https://evgo2017.com/purify-page
  4. // @version 0.11
  5. // @description 完美阅读体验,去除广告、推荐等一系列和阅读无关的内容
  6. // @author evgo2017
  7. // @license GNU GPLv2
  8. // @match http://www.360doc.com/content/*
  9. // @icon http://www.360doc.com/favicon.ico
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. const maxRetryCount = 5; // 最大重试次数
  17.  
  18. // 移除区域
  19. remove('顶部导航', `.header`)
  20. remove('顶部浮窗导航', `.atfixednav`)
  21. remove('左侧微信扫一扫关注', `#floatqrcode_1`)
  22. remove('右侧导航', `#divad5`, { remove: (dom) => { if (dom) { dom.innerHTML = '' } } })
  23. remove('右侧导航', `.user_info`)
  24. remove('右侧导航', `.his_her`)
  25. remove('右侧导航', `#outerdivifartad1`)
  26. remove('右侧导航', `#recommendArt`)
  27. remove('右侧导航', `#recommendArtHot`)
  28. remove('右侧导航', `#recommendArtOrg`)
  29. remove('上一篇下一篇', `.zcomdiv`, { repeat: true })
  30. remove('用户公约', `#plgyDIV`)
  31. remove('底部推荐', `#divyoulikeadtitle`, { repeat: true, remove: (dom) => { if (dom) { dom.innerHTML = ''; } } })
  32. remove('底部推荐', `.ul-similar`, { repeat: true, remove: (dom) => { if (dom) { dom.innerHTML = ''; } } })
  33. remove('微信扫一扫', `#floatqrcode_2`)
  34. remove('顶部空白', `#arttopbdad`)
  35. remove('回到顶部', `#goTop2`)
  36.  
  37. // 最大化阅读区域
  38. setTimeout(() => {
  39. $('.Question-mainColumn').style.minWidth = '1000px'
  40.  
  41. const style = document.createElement('style')
  42. style.innerHTML = `.AnswerItem-authorInfo{ max-width: 100% }`
  43. $('head').appendChild(style);
  44. }, 1000)
  45.  
  46. // Helper
  47. function removes(label, selector, userOption = {}, count = 1) {
  48. const option = Object.assign({ repeat: false }, userOption)
  49. const doms = document.querySelectorAll(selector)
  50. if (doms.length > 0) {
  51. for (let i = 0, len = doms.length; i < len; i++) {
  52. doms[i].remove()
  53. console.log(`${label},%c已移除%c。(第 ${count} 次处理)`, "color: red; font-weight: bold", "color: black")
  54. }
  55. if (option.repeat) {
  56. setTimeout(() => { remove(label, selector, option, count + 1) }, 1000)
  57. }
  58. } else {
  59. if (count < maxRetryCount) {
  60. console.log(`${label},未找到。(第 ${count} 次处理)`)
  61. setTimeout(() => { removes(label, selector, option, count + 1) }, 1000)
  62. } else {
  63. console.log(`${label},%c停止查找%c。(第 ${count} 次处理)`, "color: orange; font-weight: bold", "color: black")
  64. }
  65. }
  66. }
  67. function remove(label, selector, userOption = {}, count = 1) {
  68. const option = Object.assign({ repeat: false, getDom: (dom) => dom, remove: (dom) => dom.remove() }, userOption)
  69. const dom = option.getDom($(selector))
  70. if (dom) {
  71. option.remove(dom)
  72. console.log(`${label},%c已移除%c。(第 ${count} 次处理)`, "color: red; font-weight: bold", "color: black")
  73. if (option.repeat) {
  74. setTimeout(() => { remove(label, selector, option, count + 1) }, 1000)
  75. }
  76. } else {
  77. if (count < maxRetryCount) {
  78. console.log(`${label},未找到。(第 ${count} 次处理)`)
  79. setTimeout(() => { remove(label, selector, option, count + 1) }, 1000)
  80. } else {
  81. console.log(`${label},%c停止查找%c。(第 ${count} 次处理)`, "color: orange; font-weight: bold", "color: black")
  82. }
  83. }
  84. }
  85. function $ (selector) {
  86. return document.querySelector(selector)
  87. }
  88. })();

QingJ © 2025

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