Hide Promotion Advertisement at Codewars Site

Remove certain elements from the page

// ==UserScript==
// @name         Hide Promotion Advertisement at Codewars Site
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Remove certain elements from the page
// @author       aspen138
// @match        *://*.codewars.com/kata/*
// @icon         https://www.google.com/s2/favicons?domain=codewars.com
// @license      MIT
// @grant        none
// ==/UserScript==



(function() {
    'use strict';

    // Function to remove elements and adjust styles
    function adjustElements() {
        const descriptionFooter = document.querySelector('.description-footer');
        const partnerDisplay = document.getElementById('partner-display');
        const textCenter = document.querySelector('.text-center');
        const bonusPointsHeader = document.getElementById('bonus-points-not-really-but-just-for-fun');
        const descriptionFullHeight = document.querySelector('.description.h-full');
        const descriptionContent = descriptionFullHeight ? descriptionFullHeight.querySelector('.description-content') : null;

        if (descriptionFooter) {
            descriptionFooter.remove();
        }

        if (partnerDisplay) {
            partnerDisplay.remove();
        }

        if (textCenter) {
            textCenter.remove();
        }

        if (bonusPointsHeader) {
            bonusPointsHeader.remove();
        }

        if (descriptionContent) {
            descriptionContent.style.height = '100%';
            descriptionContent.style.display = 'flex';
            descriptionContent.style.flexDirection = 'column';
        }
    }

    // Initial adjustment
    adjustElements();

    // Listen for URL changes
    window.addEventListener('popstate', adjustElements);
    window.addEventListener('hashchange', adjustElements);

    // Observe DOM changes
    const observer = new MutationObserver(() => {
        adjustElements();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    // Reapply adjustments every 5 seconds
    setInterval(adjustElements, 5000);

})();