屏蔽优化

对部分网站进行屏蔽广告与优化布局使其更顺眼

目前为 2024-03-14 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 屏蔽优化
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.toutiao.com/*
  5. // @match https://*.justeasy.cn/*
  6. // @match https://fanyi.baidu.com/*
  7. // @match https://www.bimiacg4.net/bangumi/*
  8. // @match https://www.bimiacg5.net/bangumi/*
  9. // @match https://www.hanjukankan.com/movie/*
  10. // @match https://www.thanju.com/detail/*
  11. // @grant none
  12. // @version 0.0.25
  13. // @author YeSilin
  14. // @license MIT
  15. // @grant GM_addStyle
  16. // @description 对部分网站进行屏蔽广告与优化布局使其更顺眼
  17. // ==/UserScript==
  18.  
  19.  
  20.  
  21. (function () {
  22. 'use strict';
  23.  
  24.  
  25. // 今日头条优化
  26. if (window.location.origin === "https://www.toutiao.com") {
  27.  
  28. // 屏蔽今日头条置顶文章
  29. let css = `
  30. .feed-card-wrapper.feed-card-article-wrapper.sticky-cell{
  31. display: none;
  32. }`; GM_addStyle(css)
  33.  
  34. // 修复今日头条个人主页兼容 DarkReader
  35. if (window.location.href.indexOf("https://www.toutiao.com/c/user/token/") > -1) {
  36. // 删掉默认的白色背景
  37. // document.getElementsByClassName('profile-container')[0].style.background = "none";
  38. document.querySelector(".profile-container").style.background = "none";
  39. // 修改搜索框的背景颜色,即使改了也会被 DarkReader 修改成其他值以符合他的主题
  40. document.querySelector(".search>input").style.backgroundColor = "#eee";
  41. return
  42. }
  43.  
  44. // 优化今日头条文章自动打开评论
  45. if (window.location.href.indexOf("https://www.toutiao.com/article/") > -1) {
  46. let id = setInterval(function () {
  47. let element = document.querySelector("div.detail-interaction-comment")
  48. // 如果找到元素就清除定时器
  49. if (element) {
  50. clearInterval(id) // 清除定时器
  51. element.click()
  52. }
  53. }, 1000) // 每秒查询一次
  54. return
  55. }
  56.  
  57. // 优化今日头条视频自动打开评论
  58. if (window.location.href.indexOf("https://www.toutiao.com/video/") > -1) {
  59. let id = setInterval(function () {
  60. let element = document.querySelector(".video-action-button.comment")
  61. // 如果找到元素就清除定时器
  62. if (element) {
  63. clearInterval(id) // 清除定时器
  64. element.click()
  65. }
  66. }, 1000) // 每秒查询一次
  67. return
  68. }
  69. }
  70.  
  71.  
  72.  
  73. // 建E网优化
  74. if (window.location.origin === "https://www.justeasy.cn") {
  75. // 屏蔽建E网鼠标经过灰色案例背景 .tietu_commont_list .tietu_masonry .item .commont_pic a::before
  76. let css = `
  77. .commont_list_main .item_list_1 .list .hove_bg{
  78. background: none;
  79. } `; GM_addStyle(css)
  80.  
  81. // 屏蔽搜索栏广告
  82. $(".shuangjie_index").remove();
  83.  
  84. // 屏蔽右侧菜单栏广告
  85. $(".four_icon.four_icon_right").remove();
  86. $(".new_recharge_adv").remove();
  87. $(".new_right_fixed_adv.none").remove();
  88. $("#recharge_vip_flex").remove();
  89. $("#recharge_xin_flex").remove();
  90. let index_new_right_fixed = $(".index_new_right_fixed .new_right_options ul li ")
  91. // index_new_right_fixed[0].remove();
  92. index_new_right_fixed[2].remove();
  93. index_new_right_fixed[3].remove();
  94.  
  95. // 屏蔽底部开工广告
  96. $(".kiagong_small_flex").remove();
  97. $(".kiagong_big_flex").remove();
  98.  
  99. // 屏蔽详情页广告
  100. $(".newModel_reach").remove();
  101. $("#advert_3928").remove();
  102. return
  103. }
  104.  
  105.  
  106. // 百度翻译优化
  107. if (window.location.origin === "https://fanyi.baidu.com") {
  108.  
  109. let css = `
  110. // 屏蔽左侧广告
  111. #app-read{
  112. display: none !important;
  113. }
  114.  
  115. // 屏蔽右侧广告
  116. #transOtherRight{
  117. display: none !important;
  118. }`;
  119. GM_addStyle(css)
  120.  
  121. // 屏蔽顶部开通会员广告
  122. document.querySelector("#nav_bar_vip_btn").remove()
  123.  
  124. // 屏蔽右侧意见反馈
  125. document.querySelector("#index-feedback-btn").remove()
  126.  
  127. // 屏蔽右APP下载推荐
  128. document.querySelector(".sideQrContainer").remove()
  129. }
  130.  
  131.  
  132.  
  133.  
  134. // 哔咪动漫优化
  135. if (window.location.href.indexOf("https://www.bimiacg4.net/bangumi/") > -1 || window.location.href.indexOf("https://www.bimiacg5.net/bangumi/") > -1) {
  136. // 自动跳过推荐下载安卓客户端
  137. // document.querySelector("#video>div>div>p>a").click()
  138. $("#bkcl").remove();
  139. return
  140. }
  141.  
  142.  
  143. // 韩剧看看优化
  144. if (window.location.href.indexOf("https://www.hanjukankan.com/movie/") > -1) {
  145. // 优化简介直接显示完整的剧情介绍
  146. document.querySelector(".sketch.hidden-sm.hidden-xs").innerHTML = document.querySelector("#jq .myui-panel_bd").innerHTML
  147. return
  148. }
  149.  
  150.  
  151. // 看韩剧优化
  152. if (window.location.href.indexOf("https://www.thanju.com/detail/") > -1) {
  153. // 优化简介直接显示完整的剧情介绍
  154. document.querySelector(".desc.hidden-xs").innerHTML = `\<span class="left text-muted">简介:</span>` + document.querySelector(".sketch.content").innerText.replace("剧情:", "")
  155. return
  156. }
  157.  
  158.  
  159. })();
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.