Greasy Fork is available in English.

Ads DOM Remover

Removes Ad Containers from DOM (doesn't replace adblocker extension, but blocks dynamic content which the adblocker fails to block by removing whole sections from the HTML DOM.)

目前為 2023-11-02 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Ads DOM Remover
  3. // @namespace sagiegurari
  4. // @version 1.37
  5. // @author Sagie Gur-Ari
  6. // @description Removes Ad Containers from DOM (doesn't replace adblocker extension, but blocks dynamic content which the adblocker fails to block by removing whole sections from the HTML DOM.)
  7. // @homepage https://github.com/sagiegurari/userscripts-ads-dom-remover
  8. // @supportURL https://github.com/sagiegurari/userscripts-ads-dom-remover/issues
  9. // @match https://www.ynet.co.il/*
  10. // @match https://www.mynet.co.il/*
  11. // @match https://www.calcalist.co.il/*
  12. // @match https://www.globes.co.il/*
  13. // @match https://sourceforge.net/projects/*/download*
  14. // @match https://sourceforge.net/projects/*/postdownload*
  15. // @match https://*.wikipedia.org/*
  16. // @match https://*.techonthenet.com/*
  17. // @match https://*.wikia.com/wiki/*
  18. // @match https://*.reddit.com/*
  19. // @match https://*.youtube.com/*
  20. // @match https://*.geeksforgeeks.org/*
  21. // @match https://*.bostonglobe.com/*
  22. // @match https://*.aternos.org/*
  23. // @match https://aternos.org/*
  24. // @require https://code.jquery.com/jquery-2.2.2.min.js
  25. // @require https://greasyfork.org/scripts/18490-ads-dom-remover-runner/code/Ads%20DOM%20Remover%20Runner.js?version=983896
  26. // @grant none
  27. // @license MIT License
  28. // ==/UserScript==
  29.  
  30. (function run($, runner) {
  31. 'use strict';
  32.  
  33. var selectorDefinitions = {
  34. test: {
  35. // the test selector definition is only used for testing
  36. hostNames: [
  37. '__tests1__',
  38. '__tests2__'
  39. ],
  40. selectors: {
  41. options: {
  42. loops: 1,
  43. interval: 1
  44. },
  45. selectors: [
  46. '.ad1',
  47. '.ad2'
  48. ]
  49. }
  50. },
  51. ynet: {
  52. hostNames: [
  53. 'ynet',
  54. 'calcalist'
  55. ],
  56. selectors: [
  57. '#colorbox',
  58. '#cboxOverlay',
  59. '#ads.premium',
  60. '#articleLayoutrightsidtable',
  61. '#google_image_div',
  62. 'img[src*="dynamicyield"]',
  63. 'div.MSCmainContent',
  64. '[id*="arketingCarouse"]',
  65. '[id*="arketingRecommended"]',
  66. '.mainVerticalArticleSharingLinks',
  67. '.OUTBRAIN',
  68. '.topBannerWrap',
  69. '.block.B3 .B3.ghcite.dyother.dyMonitor div',
  70. '.bigdealhomepage',
  71. '#ww6s_Main',
  72. '.buyandsavedy',
  73. '.area.footer.ghcite',
  74. '.hdr_set_homepage',
  75. '#c1_Hor',
  76. '#c2_Hor',
  77. '#c3_Hor',
  78. '#c4_Hor',
  79. '#c5_Hor',
  80. '#c6_Hor',
  81. '.homepagevideo-x6',
  82. '.buyandsave',
  83. '.general-image',
  84. '.PhotoArticlesTalkbacks',
  85. '[name="ExternalWebpageIframe"]',
  86. '#PROCOIL_SearchForm',
  87. '#magazines1024',
  88. '[id^="promo_"]',
  89. '[id^="ads."]',
  90. '[class*="facebook"]',
  91. '[class*="WinWin"]',
  92. '.main_search_radio',
  93. 'tr td [id^="ads."]',
  94. '.art-action-wrp',
  95. '.header-user-profile',
  96. '.left-art-content',
  97. '[class*="GeneralBanner"]',
  98. '#vilon',
  99. '#prime.shook',
  100. '#articlebottomsharinglinks',
  101. '.floatingPlayerimReallyDummy_container',
  102. '#ynet_user_login',
  103. '[title="YouTube"]',
  104. '[title="facebook"]',
  105. '#INDbtnWrap',
  106. '.YnetPremiumHeaderLogin',
  107. '.CreditLogos',
  108. '.tp-modal',
  109. {
  110. selector: '.homepagelitevideo',
  111. fineTuneSelector: function ($element) {
  112. return $element.parent().parent();
  113. }
  114. },
  115. {
  116. selector: 'iframe',
  117. fineTuneSelector: function ($element) {
  118. return $element.filter(function () {
  119. return !$(this).parent().hasClass('news_ticker_iframe');
  120. });
  121. }
  122. },
  123. {
  124. selector: 'div.B2b.block div',
  125. pre: function ($element) {
  126. $element.parent().css({
  127. height: '1px'
  128. });
  129. }
  130. }
  131. ]
  132. },
  133. globes: {
  134. hostNames: 'globes',
  135. selectors: [
  136. '#chromeWindow',
  137. {
  138. selector: 'iframe',
  139. filter: function ($element) {
  140. return $element.not('#GlobalFinanceData_home[src~=/news/]');
  141. }
  142. }
  143. ]
  144. },
  145. techonthenet: {
  146. hostNames: 'techonthenet.com',
  147. selectors: ['.adsblocked']
  148. },
  149. sourceforge: {
  150. hostNames: 'sourceforge.net',
  151. selectors: [
  152. '#content-for-adblock',
  153. '#newsletter-floating',
  154. '#page-body'
  155. ]
  156. },
  157. wikipedia: {
  158. hostNames: 'wikipedia.org',
  159. selectors: [
  160. '#frbanner',
  161. '#frb-inline',
  162. '#wlm-banner',
  163. '#centralNotice',
  164. '.frb-main',
  165. '.frbanner',
  166. '.frm',
  167. '.frb'
  168. ]
  169. },
  170. wikia: {
  171. hostNames: 'wikia.com',
  172. selectors: [
  173. '.WikiaFooter',
  174. '.WikiaRail',
  175. '.wds-global-footer'
  176. ]
  177. },
  178. reddit: {
  179. hostNames: 'reddit.com',
  180. selectors: [
  181. '#onboarding-splash',
  182. '[id^="google_ads"]'
  183. ]
  184. },
  185. youtube: {
  186. hostNames: 'youtube.com',
  187. selectors: [
  188. '.ytp-ce-element',
  189. 'ytd-companion-slot-renderer',
  190. '#masthead-ad',
  191. '.video-ads ytp-ad-module',
  192. '.ytp-ad-overlay-ad-info-dialog-container',
  193. '.ytp-ad-overlay-slot',
  194. 'tp-yt-paper-dialog'
  195. ],
  196. options: {
  197. loops: 200,
  198. interval: 2500
  199. }
  200. },
  201. geeksforgeeks: {
  202. hostNames: 'geeksforgeeks.org',
  203. selectors: [
  204. '.login-modal-div',
  205. '[aria-label=cookieconsent]'
  206. ]
  207. },
  208. bostonglobe: {
  209. hostNames: 'bostonglobe.com',
  210. selectors: [
  211. '.meter-social-connect',
  212. '.meter-social-connect__container'
  213. ]
  214. },
  215. aternos: {
  216. hostNames: 'aternos.org',
  217. selectors: [
  218. '.ad',
  219. '.header-ad'
  220. ]
  221. }
  222. };
  223.  
  224. [
  225. '#dcPremiumRightImg',
  226. '.boulevard',
  227. '#multiarticles-9',
  228. '#multiarticles-12',
  229. '#multiarticles-13',
  230. '#multiarticles-14',
  231. '#multiarticles-15',
  232. '#multiarticles-16',
  233. '.CdaMostViews',
  234. '.CdaCalcalistToday',
  235. '.CdaRecomendedMovies',
  236. '#SpecialBuilder1280',
  237. '.cdaFooter1280'
  238. ].forEach(function addSelector(selector) {
  239. selectorDefinitions.ynet.selectors.push({
  240. selector: selector,
  241. fineTuneSelector: function ($element) {
  242. return $element.parent();
  243. }
  244. });
  245. });
  246.  
  247. runner(
  248. $, {
  249. getSelectorDefinitions: function () {
  250. return selectorDefinitions;
  251. }
  252. }
  253. );
  254. }(
  255. window.jQuery.noConflict(true),
  256. window.adrRunner
  257. ));