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

当前为 2016-04-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Ads DOM Remover
  3. // @namespace sagiegurari
  4. // @version 0.55
  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 http://www.ynet.co.il/articles/*
  11. // @match http://www.calcalist.co.il/*
  12. // @match http://www.globes.co.il/*
  13. // @require https://code.jquery.com/jquery-2.2.2.min.js
  14. // @require https://greasyfork.org/scripts/18490-ads-dom-remover-runner/code/Ads%20DOM%20Remover%20Runner.js?version=117422
  15. // @grant none
  16. // @license MIT License
  17. // ==/UserScript==
  18. /* jshint -W097 */
  19.  
  20. (function run($, runner) {
  21. 'use strict';
  22.  
  23. var selectorDefinitions = {
  24. ynet: [
  25. '#colorbox',
  26. '#cboxOverlay',
  27. '#ads.premium',
  28. 'img[src*="dynamicyield"]',
  29. 'div.MSCmainContent',
  30. '[id*="arketingCarouse"]',
  31. '[id*="arketingRecommended"]',
  32. '.mainVerticalArticleSharingLinks',
  33. '.OUTBRAIN',
  34. '.topBannerWrap',
  35. '.block.B3 .B3.ghcite.dyother.dyMonitor div',
  36. '.bigdealhomepage',
  37. '#ww6s_Main',
  38. '.buyandsavedy',
  39. '.area.footer.ghcite',
  40. '.hdr_set_homepage',
  41. '#c1_Hor',
  42. '#c2_Hor',
  43. '#c3_Hor',
  44. '#c4_Hor',
  45. '#c5_Hor',
  46. '#c6_Hor',
  47. '.homepagevideo-x6',
  48. '.buyandsave',
  49. '.general-image',
  50. '[name="ExternalWebpageIframe"]',
  51. {
  52. selector: 'iframe',
  53. filter: function ($element) {
  54. return !$element.parent().hasClass('news_ticker_iframe');
  55. }
  56. },
  57. {
  58. selector: 'div.B2b.block div',
  59. pre: function ($element) {
  60. $element.parent().css({
  61. height: '1px'
  62. });
  63. }
  64. }
  65. ],
  66. globes: [
  67. '#chromeWindow',
  68. {
  69. selector: 'iframe',
  70. filter: function ($element) {
  71. var id = $element.attr('id');
  72. var src = $element.attr('src') || '';
  73. return (id !== 'GlobalFinanceData_home') && (src.indexOf('/news/') !== -1);
  74. }
  75. }
  76. ]
  77. };
  78.  
  79. runner($, {
  80. getSelectors: function (hostName) {
  81. var selectors;
  82. if (hostName.indexOf('globes') !== -1) {
  83. selectors = selectorDefinitions.globes;
  84. } else { //ynet/calcalist
  85. selectors = selectorDefinitions.ynet;
  86. }
  87.  
  88. return selectors;
  89. }
  90. });
  91. }(window.$, window.adrRunner));