Greasy Fork

Greasy Fork is available in English.

DeepL Footer remover

Remove footer from DeepL website

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

// ==UserScript==
// @name         DeepL Footer remover
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove footer from DeepL website
// @match        https://www.deepl.com/*
// @license      Unlicense
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Configuration object for target elements
    const TARGETS = {
        footer: 'footer',
        header: '.relative.bg-neutral-next-50 > .mobile\\:hidden'
    };

    /**
     * Removes specified elements from the page
     */
    function removeElements() {
        Object.entries(TARGETS).forEach(([key, selector]) => {
            const element = document.querySelector(selector);
            if (element) {
                element.remove();
                console.log(`${key} removed`);
            }
        });
    }

    /**
     * Initializes the script
     */
    function init() {
        // Remove elements on initial page load
        removeElements();

        // Set up MutationObserver to handle dynamic content
        const observerConfig = { childList: true, subtree: true };
        const observer = new MutationObserver(removeElements);
        observer.observe(document.body, observerConfig);

        console.log('DeepL Footer Remover initialized');
    }

    // Run the initialization function when the script loads
    init();
})();