Remove Homepage Garbage

Remove Recommended section on the roblox home page!

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

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


(function() {
    'use strict';

    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 && thea.textContent == "Sponsored") {
                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 });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址