DeepL Footer remover

Remove footer from DeepL website

当前为 2024-08-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name DeepL Footer remover
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Remove footer from DeepL website
  6. // @match https://www.deepl.com/*
  7. // @license Unlicense
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Configuration object for target elements
  15. const TARGETS = {
  16. footer: 'footer',
  17. header: '.relative.bg-neutral-next-50 > .mobile\\:hidden'
  18. };
  19.  
  20. /**
  21. * Removes specified elements from the page
  22. */
  23. function removeElements() {
  24. Object.entries(TARGETS).forEach(([key, selector]) => {
  25. const element = document.querySelector(selector);
  26. if (element) {
  27. element.remove();
  28. console.log(`${key} removed`);
  29. }
  30. });
  31. }
  32.  
  33. /**
  34. * Initializes the script
  35. */
  36. function init() {
  37. // Remove elements on initial page load
  38. removeElements();
  39.  
  40. // Set up MutationObserver to handle dynamic content
  41. const observerConfig = { childList: true, subtree: true };
  42. const observer = new MutationObserver(removeElements);
  43. observer.observe(document.body, observerConfig);
  44.  
  45. console.log('DeepL Footer Remover initialized');
  46. }
  47.  
  48. // Run the initialization function when the script loads
  49. init();
  50. })();