Remove Citation Machine Ad

Remove the Citation Machine ad overlay

  1. // ==UserScript==
  2. // @name Remove Citation Machine Ad
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Remove the Citation Machine ad overlay
  6. // @author Log4Jake
  7. // @match https://www.citationmachine.net/*
  8. // @grant none
  9. // @license GNU General Public License v3.0
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function to remove the ad element
  16. function removeAdElement() {
  17. var adElements = document.querySelectorAll('div[style*="position: fixed; z-index: 9999; display: flex; flex-direction: column;"]');
  18. adElements.forEach(function(adElement) {
  19. adElement.remove();
  20. });
  21. }
  22.  
  23. // Remove the ad element when the page initially loads
  24. removeAdElement();
  25.  
  26. // Use a MutationObserver to monitor changes to the DOM
  27. var observer = new MutationObserver(function(mutations) {
  28. mutations.forEach(function(mutation) {
  29. if (mutation.type === 'childList') {
  30. removeAdElement();
  31. }
  32. });
  33. });
  34.  
  35. // Configure and start the observer
  36. var config = { childList: true, subtree: true };
  37. observer.observe(document.body, config);
  38. })();