Remove Homepage Garbage

Remove Recommended section on the roblox home page!

// ==UserScript==
// @name         Remove Homepage Garbage
// @namespace    https://www.roblox.com/home
// @version      2025-03-30
// @description  Remove Recommended section on the roblox home page!
// @author       CMTG (@callmetreeguy on discord)
// @match        https://www.roblox.com/home
// @icon         https://www.google.com/s2/favicons?sz=64&domain=roblox.com
// @grant        none
// @license MIT
// ==/UserScript==


const DontDelete = {
    "Continue": true,
    "Favorites": true
}

function removeRecommendedSection() {
    const homePageGameGrid = document.querySelector('div[data-testid="home-page-game-grid"]');
    if (homePageGameGrid) {
        const header = homePageGameGrid.querySelector('div.container-header > h2');
        if (header && header.textContent.trim() === 'Recommended For You') {
            homePageGameGrid.remove();
        }
    }

    const allContainers = document.querySelectorAll('div.game-sort-header-container');

    allContainers.forEach(container => {
        const headerSpan = container.querySelector('.container-header h2 span');
        const TheA = container.querySelector('h2').querySelector('a')

        if (!(TheA && (DontDelete[TheA.textContent]))) {
            container.parentElement.remove();
        }

        if ((headerSpan && headerSpan.textContent.trim() == "Today's Picks")) {

            const parentElement = container.parentElement;

            const siblingElement = parentElement.querySelector('div[data-testid="game-carousel"]');
            if (siblingElement) {
                siblingElement.remove();
            }
            container.remove();
        }
    })
}
window.addEventListener('load', removeRecommendedSection);

const observer = new MutationObserver((mutations) => {
    mutations.forEach(() => {
        removeRecommendedSection();
    });
});

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