Remove Homepage Garbage

Remove Recommended section on the roblox home page!

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Remove Homepage Garbage
// @namespace    https://www.roblox.com/home
// @version      2024-08-18 v2
// @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==



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 == "Continue" || "Favorites"))
           ) {
            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 });