fdesouche.com popup ad remover

This script remove ad and anti adblock popups on fdesouche.com

  1. // ==UserScript==
  2. // @name fdesouche.com popup ad remover
  3. // @namespace http://userscripts.org/users/useridnumber
  4. // @description This script remove ad and anti adblock popups on fdesouche.com
  5. // @include http://*.fdesouche.com/*
  6. // @include http://fdesouche.com/*
  7. // @version 3
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var removeads = function removeads () {
  12. var items = {};
  13. var selects = jQuery("body>div>div>a[target='_blank']");
  14. selects.each(function (_, e) {
  15. var pNode = e.parentNode
  16. while (pNode.parentNode.nodeName === "DIV" && pNode.parentNode.className !== "") {
  17. pNode = pNode.parentNode;
  18. }
  19. pNode.parentNode.removeChild(pNode);
  20. });
  21. }
  22.  
  23. removeads();
  24.  
  25. // Create an observer instance
  26. var observer = new MutationObserver(function( mutations ) {
  27. mutations.forEach(function( mutation ) {
  28. var newNodes = mutation.addedNodes; // DOM NodeList
  29. if( newNodes !== null ) { // If there are new nodes added
  30. removeads();
  31. var selects = jQuery("body>div>h1");
  32. if (selects.length !== 0) {
  33. var node = selects[0];
  34. if (node.innerHTML.indexOf("Adblock") !== -1) {
  35. node = node.parentNode;
  36. node.style.visibility="hidden";
  37. document.__fds_popupClassName = node.className + "-bg";
  38. console.info("CAP:" + document.__fds_popupClassName);
  39. }
  40. }
  41. var selects = jQuery("body>div." + document.__fds_popupClassName);
  42. if (selects.length !== 0) {
  43. selects[0].style.visibility="hidden";
  44. }
  45. }
  46. });
  47. });
  48.  
  49. // Configuration of the observer:
  50. var config = {
  51. attributes: true,
  52. childList: true,
  53. characterData: true
  54. };
  55. // Pass in the target node, as well as the observer options
  56. observer.observe(document.body, config);