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.)

目前为 2018-03-20 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Ads DOM Remover
  3. // @namespace sagiegurari
  4. // @version 1.18
  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 http://www.ynet.co.il/home/*
  10. // @match https://www.ynet.co.il/home/*
  11. // @match http://www.ynet.co.il/articles/*
  12. // @match https://www.ynet.co.il/articles/*
  13. // @match http://www.mynet.co.il/articles/*
  14. // @match https://www.mynet.co.il/articles/*
  15. // @match http://www.calcalist.co.il/*
  16. // @match https://www.calcalist.co.il/*
  17. // @match http://www.globes.co.il/*
  18. // @match https://www.globes.co.il/*
  19. // @match https://sourceforge.net/projects/*/download*
  20. // @match https://sourceforge.net/projects/*/postdownload*
  21. // @match http://subscenter.cinemast.com/*
  22. // @match https://subscenter.cinemast.com/*
  23. // @match http://www.subscenter.co/*
  24. // @match https://www.subscenter.co/*
  25. // @match http://www.subscenter.org/*
  26. // @match https://www.subscenter.org/*
  27. // @match https://*.wikipedia.org/*
  28. // @match http://*.techonthenet.com/*
  29. // @match https://*.techonthenet.com/*
  30. // @match http://www.opensubtitles.org/*
  31. // @match https://www.opensubtitles.org/*
  32. // @match http://*.wikia.com/wiki/*
  33. // @match https://*.wikia.com/wiki/*
  34. // @match http://*.reddit.com/*
  35. // @match https://*.reddit.com/*
  36. // @match http://*.bostonglobe.com/*
  37. // @match https://*.bostonglobe.com/*
  38. // @require https://code.jquery.com/jquery-2.2.2.min.js
  39. // @require https://greasyfork.org/scripts/18490-ads-dom-remover-runner/code/Ads%20DOM%20Remover%20Runner.js?version=189663
  40. // @grant none
  41. // @license MIT License
  42. // ==/UserScript==
  43.  
  44. (function run($, runner) {
  45. 'use strict';
  46.  
  47. var selectorDefinitions = {
  48. ynet: {
  49. hostNames: [
  50. 'ynet',
  51. 'calcalist'
  52. ],
  53. selectors: [
  54. '#colorbox',
  55. '#cboxOverlay',
  56. '#ads.premium',
  57. '#articleLayoutrightsidtable',
  58. '#google_image_div',
  59. 'img[src*="dynamicyield"]',
  60. 'div.MSCmainContent',
  61. '[id*="arketingCarouse"]',
  62. '[id*="arketingRecommended"]',
  63. '.mainVerticalArticleSharingLinks',
  64. '.OUTBRAIN',
  65. '.topBannerWrap',
  66. '.block.B3 .B3.ghcite.dyother.dyMonitor div',
  67. '.bigdealhomepage',
  68. '#ww6s_Main',
  69. '.buyandsavedy',
  70. '.area.footer.ghcite',
  71. '.hdr_set_homepage',
  72. '#c1_Hor',
  73. '#c2_Hor',
  74. '#c3_Hor',
  75. '#c4_Hor',
  76. '#c5_Hor',
  77. '#c6_Hor',
  78. '.homepagevideo-x6',
  79. '.buyandsave',
  80. '.general-image',
  81. '.PhotoArticlesTalkbacks',
  82. '[name="ExternalWebpageIframe"]',
  83. '#PROCOIL_SearchForm',
  84. '#magazines1024',
  85. '[id^="promo_"]',
  86. '[id^="ads."]',
  87. '[class*="facebook"]',
  88. '[class*="WinWin"]',
  89. '.main_search_radio',
  90. 'tr td [id^="ads."]',
  91. '.art-action-wrp',
  92. '.header-user-profile',
  93. '.left-art-content',
  94. '[class*="GeneralBanner"]',
  95. '#vilon',
  96. '#prime.shook',
  97. '#articlebottomsharinglinks',
  98. {
  99. selector: '.homepagelitevideo',
  100. fineTuneSelector: function ($element) {
  101. return $element.parent().parent();
  102. }
  103. },
  104. {
  105. selector: 'iframe',
  106. fineTuneSelector: function ($element) {
  107. return $element.filter(function () {
  108. return !$(this).parent().hasClass('news_ticker_iframe');
  109. });
  110. }
  111. },
  112. {
  113. selector: 'div.B2b.block div',
  114. pre: function ($element) {
  115. $element.parent().css({
  116. height: '1px'
  117. });
  118. }
  119. }
  120. ]
  121. },
  122. globes: {
  123. hostNames: 'globes',
  124. selectors: [
  125. '#chromeWindow',
  126. {
  127. selector: 'iframe',
  128. filter: function ($element) {
  129. var id = $element.attr('id');
  130. var src = $element.attr('src') || '';
  131.  
  132. return (id !== 'GlobalFinanceData_home') && (src.indexOf('/news/') !== -1);
  133. }
  134. }
  135. ]
  136. },
  137. techonthenet: {
  138. hostNames: 'techonthenet.com',
  139. selectors: ['.adsblocked']
  140. },
  141. sourceforge: {
  142. hostNames: 'sourceforge.net',
  143. selectors: [
  144. '#content-for-adblock',
  145. '#newsletter-floating',
  146. '#page-body'
  147. ]
  148. },
  149. subscenter: {
  150. hostNames: 'subscenter',
  151. selectors: [
  152. '.weekBottom',
  153. '.reviewsWindow',
  154. '#banner_cinemast',
  155. '.bottomMenu',
  156. 'footer',
  157. '#paypal',
  158. '#aboveSite',
  159. {
  160. selector: '#subtitles_list a[href="/he/contactus/"]',
  161. fineTuneSelector: function ($element) {
  162. return $element.parent();
  163. }
  164. }
  165. ]
  166. },
  167. wikipedia: {
  168. hostNames: 'wikipedia.org',
  169. selectors: [
  170. '#frbanner',
  171. '#frb-inline',
  172. '#wlm-banner',
  173. '#centralNotice',
  174. '.frb-main',
  175. '.frbanner',
  176. '.frm',
  177. '.frb'
  178. ]
  179. },
  180. opensubtitles: {
  181. hostNames: 'opensubtitles',
  182. selectors: ['.rec_container_right']
  183. },
  184. wikia: {
  185. hostNames: 'wikia.com',
  186. selectors: [
  187. '.WikiaFooter',
  188. '.WikiaRail',
  189. '.wds-global-footer'
  190. ]
  191. },
  192. reddit: {
  193. hostNames: 'reddit.com',
  194. selectors: ['#onboarding-splash']
  195. },
  196. bostonglobe: {
  197. hostNames: 'bostonglobe.com',
  198. selectors: [
  199. '.meter-social-connect',
  200. '.meter-social-connect__container'
  201. ]
  202. }
  203. };
  204.  
  205. [
  206. '#dcPremiumRightImg',
  207. '.boulevard',
  208. '#multiarticles-9',
  209. '#multiarticles-12',
  210. '#multiarticles-13',
  211. '#multiarticles-14',
  212. '#multiarticles-15',
  213. '#multiarticles-16',
  214. '.CdaMostViews',
  215. '.CdaCalcalistToday',
  216. '.CdaRecomendedMovies',
  217. '#SpecialBuilder1280',
  218. '.cdaFooter1280'
  219. ].forEach(function addSelector(selector) {
  220. selectorDefinitions.ynet.selectors.push({
  221. selector: selector,
  222. fineTuneSelector: function ($element) {
  223. return $element.parent();
  224. }
  225. });
  226. });
  227.  
  228. runner($, {
  229. getSelectorDefinitions: function () {
  230. return selectorDefinitions;
  231. }
  232. });
  233. }(window.jQuery.noConflict(true), window.adrRunner));