360搜索去广告

去除360搜索结果和页面中的绝大多数广告,包括:360搜索、360资讯、360问答、360百科、360导航等

  1. // ==UserScript==
  2. // @name 360搜索去广告
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.2.1
  5. // @icon https://www.so.com/favicon.ico
  6. // @description 去除360搜索结果和页面中的绝大多数广告,包括:360搜索、360资讯、360问答、360百科、360导航等
  7. // @author CodeLumos
  8. // @homepageURL https://github.com/codelumos/tampermonkey-scripts
  9. // @match *://*.so.com/*
  10. // @match *://*.360kan.com/*
  11. // @match *://*.360kuai.com/*
  12. // @match *://*.66health.net/*
  13. // @match *://hao.360.com/*
  14. // @match *://*.hao.360.cn/*
  15. // @grant GM_addStyle
  16. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
  17. // ==/UserScript==
  18.  
  19. const dom = {};
  20. dom.query = jQuery.noConflict(true);
  21. dom.query(document).ready(function ($) {
  22. 'use strict';
  23.  
  24. const detection_cycle = 500;
  25. const cycle_callbacks = [];
  26. const {hostname, pathname} = location;
  27.  
  28. function no_display(item) {
  29. const no_display_css = item + " {display: none;}";
  30. GM_addStyle(no_display_css);
  31. }
  32.  
  33. switch (hostname.split(".")[0]) {
  34. case "www":
  35. switch (hostname.split(".")[1]) {
  36. // 360搜索
  37. case "so":
  38. no_display("#so_bd-ad"); // 右侧栏广告
  39. no_display(".res-mediav-right"); // 右侧栏广告
  40. no_display("#lm-rightbottom"); // 猜你想搜
  41. no_display(".e-buss"); // 条目广告
  42. no_display("div[id*='--normal']"); // 文字广告
  43. no_display("[class*='business']"); // 魔盒条目广告
  44. no_display("#mohe-webgame"); // 360爱玩魔盒
  45. no_display(".mh-sdk-sad"); // 相关消息广告
  46. cycle_callbacks.push(function () {
  47. $(".sad").remove(); // 热点条目广告
  48. $(".lawnfooter-image__panel").remove(); // 底部遮罩广告
  49.  
  50. $("[class*='res-mediav']").remove(); // 条目广告
  51. });
  52. break;
  53.  
  54. // 快资讯
  55. case "360kuai":
  56. no_display("[data-ggclick='ad']"); // 条目广告
  57. no_display("#as_shop_gg"); // 右侧栏广告
  58. no_display(".flowcardtype--onepicbig"); // 条目广告
  59.  
  60. no_display(".footer-wrapper"); // 右下角广告
  61. no_display(".g4"); // 横幅广告
  62. no_display(".detail--v3"); // 右侧推荐广告
  63. no_display(".recommend-article__wrapper"); // 推荐文章
  64. no_display(".article__content__textgg"); // 文章中文字广告
  65.  
  66. no_display(".video__gg"); // 右侧推荐广告
  67. no_display(".videogg--card"); // 大块广告
  68. cycle_callbacks.push(function () {
  69. $(".detail--v3").remove(); // 右侧推荐广告
  70. $(".cc-pause-gg").remove(); // 视频暂停广告
  71. });
  72. break;
  73.  
  74. // 360影视
  75. case "360kan":
  76. no_display(".rt-btm-popup_ad"); // 右下角广告
  77. no_display(".info-flow__ad"); // 横幅广告
  78. no_display("#detail-ad"); // 右侧栏广告
  79. break;
  80. }
  81. break;
  82.  
  83. // 360资讯
  84. case "news":
  85. no_display("[data-from='ad']"); // 条目广告
  86. no_display("[data-from='mediav']"); // 条目广告
  87. no_display(".info-stream"); // 智能推荐
  88.  
  89. cycle_callbacks.push(function () {
  90. $("#sd-lm").remove(); // 右侧栏猜你想搜
  91. });
  92. break;
  93.  
  94. // 360问答
  95. case "wenda": {
  96. no_display("#js-mod-fixed-float"); // 右下角广告
  97. no_display("#e_idea_wenda_leftBox"); // 条目广告
  98. no_display(".js-busi-item"); // 条目广告
  99. no_display("#mediaV"); // 右侧栏广告
  100. no_display(".js-right-busi"); // 右侧栏广告
  101.  
  102. no_display(".js-left-flow-busi"); // 左侧栏广告
  103. no_display(".js-left-rec-busi"); // 左侧栏广告
  104. no_display(".js-answer-adv-part"); // 伪回答广告
  105. no_display("#attention"); // 猜你关注
  106. no_display("#detail-guess-wrap"); // 您可能感兴趣的内容
  107. $(".js-mod-flow").remove(); // 今日热点
  108. // 将问答主体移动至左侧
  109. let wenda_main = $(".js-detail-main");
  110. wenda_main.removeClass("fr");
  111. wenda_main.addClass("fl");
  112. wenda_main.css("padding-left", "40px");
  113. wenda_main.css("padding-right", "40px");
  114. break;
  115. }
  116.  
  117. // 360视频(360kan)
  118. case "tv":
  119. case "video":
  120. no_display("[data-so-mod='list-ad']"); // 条目广告
  121. no_display(".p-searchad-wrap"); // 文字广告
  122. break;
  123.  
  124. // 360图片
  125. case "image":
  126. no_display(".starlist"); // 横幅广告
  127. no_display(".item_cm"); // 条目广告
  128. cycle_callbacks.push(function () {
  129. $("[data-id*='cm_extended_init']").remove(); // 条目广告
  130. $("[data-id*='cm_display_init']").remove(); // 条目广告
  131. $("[data-id*='JumpAds']").remove(); // 条目广告
  132. });
  133. break;
  134.  
  135. // 360良医
  136. case "ly":
  137. $("#news-card").remove(); // 热门资讯推荐
  138. $(".so-biz-ad-title").remove(); // 猜你想搜
  139. $("#lm-rightbottom").remove(); // 猜你想搜
  140. break;
  141.  
  142. // 360地图
  143. case "ditu":
  144. no_display("[data-list-business-item='true']"); // 条目广告
  145. no_display("[class*='index-bottomBsCon']"); // 条目广告
  146. no_display("[class*='Ad']"); // 疫情广告
  147. break;
  148.  
  149. // 360百科
  150. case "baike":
  151. no_display(".mod-side-busi"); // 右侧栏广告
  152.  
  153. $("[id*='J-mod-right-ad']").remove(); // 右侧栏广告
  154. $("#J-mod-right-recommend").remove(); // 为您推荐
  155. no_display("#rightbanner"); // 右侧栏广告
  156. no_display(".entry-belong"); // 搜索发现
  157. no_display(".entry-plus"); // 热点资讯
  158. // 自动展开
  159. $(".entry-detail-fold-part").removeAttr("style");
  160. no_display(".entry-detail-fold-switch");
  161. break;
  162.  
  163. // 360国学
  164. case "guoxue":
  165. $(".rtInterest").remove(); // 猜你感兴趣
  166. $(".rtAttention").remove(); // 猜你关注
  167. no_display(".js-fixed-rt"); // 右侧栏广告
  168. $("#interest-wrap").remove(); // 您可能感兴趣的内容
  169. no_display(".lm-bottom-container"); // 底部广告
  170. // 自动展开
  171. $("#content-area").removeClass("folded");
  172. break;
  173.  
  174. // 360文库
  175. case "wenku":
  176. no_display("#e_idea_wenda_leftBox"); // 条目广告
  177. no_display("#js-fixed-rt"); // 右侧栏广告
  178.  
  179. no_display(".fixed-rtbot"); // 右下角广告
  180. no_display(".page-busi"); // 页面间广告
  181. $("#interest").remove(); // 您可能感兴趣的内容
  182. $(".side-mod").remove(); // 今日热点
  183. $(".infoFlow").remove(); // 今日热点
  184. break;
  185.  
  186. // 360翻译
  187. case "fanyi":
  188. no_display("#card_container"); // 热点推荐
  189. break;
  190. }
  191.  
  192. // 放心健康
  193. if (location.href.indexOf("66health.net") > 0) {
  194. no_display(".hot-recom"); // 右侧栏广告
  195. no_display("._sab5d05j0v"); // 右侧栏广告
  196. $("._qjos0wqy38").remove(); // 搜索推荐广告
  197. }
  198.  
  199. // 360导航
  200. if (location.href.indexOf("hao.360.com") > 0) {
  201. $("#daily-hotwords").remove(); // 顶栏广告
  202. $("#activity").remove(); // 左侧栏广告
  203. $(".plane-priming").remove(); // 右侧栏广告
  204. no_display("#large2small"); // 右下角广告
  205. $(".qihoobannerslider").remove(); // 横幅广告
  206. cycle_callbacks.push(function () {
  207. $("[class*='festival']").remove(); // 遮罩广告
  208. $("._CUBE_A_D_CLK_").remove(); // cube广告
  209. // 删除cube广告占位
  210. $(".ad-text").parents(".bottom-line-wrap").remove(); // cube文字广告
  211. $("img[src='https://hao1.qhimg.com/dmfd/50_20_/t0196473cd73c354bfb.png']").parents(".item").remove(); // cube文字广告
  212. $(".ad-flag").parents(".cube-mod").remove(); // cube广告
  213. $("img[src='https://hao3.qhimg.com/t0135fb514cb52505c4.png']").parents(".cube-mod").remove(); // cube广告
  214. $("#cube-mod-haocube-QVd9iAfg4N0").remove(); // 旋转视界
  215. $(".feed-atlas").remove(); // 热点广告
  216. $(".feed-mv").remove(); // 热点广告
  217. });
  218. }
  219. if (location.href.indexOf("hao.360.cn") > 0) {
  220. no_display(".ads-goods"); // 右侧栏广告
  221. no_display(".feed-ads"); // 右侧栏广告
  222. no_display(".js-sticky"); // 右侧栏广告
  223. }
  224.  
  225. if (!cycle_callbacks.length) {
  226. return;
  227. }
  228.  
  229. cycle_callbacks.forEach(f => f());
  230. setInterval(() => cycle_callbacks.forEach(f => f()), detection_cycle);
  231. });