畅读搜狐

删除搜狐所有广告,重建主题内容

目前为 2019-06-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 畅读搜狐
  3. // @author 絕版大叔丶
  4. // @namespace https://github.com/Sdator/MyCode/tree/master/Js/%E6%9A%B4%E5%8A%9B%E7%8C%B4
  5. // @icon https://avatars3.githubusercontent.com/u/17621623?s=40&v=4
  6. // @version 1.1
  7. // @match *://www.sohu.com/a/*
  8. // @description 删除搜狐所有广告,重建主题内容
  9. // @run-at document-end
  10. // ==/UserScript==
  11.  
  12. let css = `
  13. body {
  14. display: flex;
  15. background-color: bisque;
  16. justify-content: center;
  17. align-items: center;
  18. }
  19.  
  20. #diy {
  21. margin: 50px;
  22. width: 1024px;
  23. }
  24. `
  25.  
  26. //css样式
  27. GM_addStyle(css)
  28.  
  29.  
  30. $(() => {
  31. let 元素 = ".text"
  32.  
  33. //兼容另一种特殊页面
  34. let 特殊页面 = $(".article-box.l")
  35. if (特殊页面.length) {
  36. 元素 += ",.article-box.l"
  37. 特殊页面.children(":gt(2)").nextAll().remove()
  38. }
  39.  
  40. // 重建主题
  41. $('.text').appendTo($("body")).wrap($("<div id='diy'></div>"));
  42. // 删除多余标签
  43. $("body *").not('#diy').not($('#diy').find("*")).remove()
  44. })

QingJ © 2025

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