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-02-09 提交的版本,查看 最新版本

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