Geenstijl add remover

Remove adds articles from Geenstijl.nl

  1. // ==UserScript==
  2. // @name Geenstijl add remover
  3. // @namespace https://www.geenstijl.nl/
  4. // @version 0.8
  5. // @description Remove adds articles from Geenstijl.nl
  6. // @author Rick van der Staaij
  7. // @require http://code.jquery.com/jquery-latest.min.js
  8. // @include https://www.geenstijl.nl/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. var cleaning = false;
  14.  
  15. function removeAddArticles() {
  16. let cleanCounter = 0;
  17. $('article').each(function() {
  18. if ($(this).find(".compost-warn:contains('Ingezonden mededeling')").length > 0) {
  19. cleanCounter++;
  20. $(this).attr("style", "display: none !important");
  21. }
  22. });
  23. if (cleanCounter > 0) {
  24. console.log('[Geenstijl add killer] Removed ' + cleanCounter + ' spam cards.');
  25. }
  26. }
  27.  
  28. function removePromoBlocks() {
  29. console.log('[Geenstijl add killer] Cleaning crap.');
  30. $('.article-premium-promotion-block, .pgAdWrapper, .become-premium, .modal-float-in, .not-a-pixel, div[data-page="site_index.homepage"], .afctr-wrapper').attr("style", "display: none !important");
  31. }
  32.  
  33. function clean() {
  34. if (cleaning) {
  35. return;
  36. }
  37.  
  38. console.log('CLEANING');
  39.  
  40. cleaning = true;
  41.  
  42. removePromoBlocks();
  43. removeAddArticles();
  44.  
  45. setTimeout(() => {
  46. cleaning = false;
  47. console.log('Done.');
  48. }, 100);
  49. }
  50.  
  51. (function() {
  52. 'use strict';
  53.  
  54. console.log('[Geenstijl add killer] Killing spam...');
  55. clean();
  56.  
  57. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  58.  
  59. var observer = new MutationObserver(function(mutations, observer) {
  60. clean();
  61. });
  62.  
  63. observer.observe(document, {
  64. subtree: true,
  65. attributes: true,
  66. });
  67.  
  68. $( document ).ready(function() { clean(); });
  69. $( window ).on( "load", function() { clean(); });
  70. })();