Greasy Fork

Greasy Fork is available in English.

Roblox Recommended and Sponsored remover

Enhance Roblox home page by removing Recommended, Sponsored and Innovation Awards sections.

当前为 2024-07-31 提交的版本,查看 最新版本

// ==UserScript==
// @name         Roblox Recommended and Sponsored remover
// @namespace    Roblox Recommended and Sponsored remover 
// @version      1.2.1
// @description  Enhance Roblox home page by removing Recommended, Sponsored and Innovation Awards sections.
// @author       Vexdel
// @match        https://*.roblox.com/home
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    function removeSections() {
        const sectionTitles = [ "Roblox Innovation Awards", "Recommended For You"]; //  "Sponsored",
        sectionTitles.forEach(title => {
            Array.from(document.querySelectorAll('h2')).forEach(heading => {
                if (heading.textContent.includes(title)) {
                    const container = heading.closest('div');
                    if (container) container.style.display = 'none';
                }
            });
        });

        const filters = [
            '.expand-home-content.wide-game-tile-game-grid.home-game-grid.game-grid',
            '.expand-home-content.wide-game-tile-carousel.game-carousel',
            'div.expand-home-content.game-carousel:nth-of-type(8)',
            'div.expand-home-content.game-carousel:nth-of-type(6)',
            'div.game-sort-carousel-wrapper:nth-of-type(4)',
            '.text-default.font-sort-subtitle'
        ];

        filters.forEach(selector => {
            document.querySelectorAll(selector).forEach(element => {
                element.style.display = 'none';
            });
        });
    }

    const observer = new MutationObserver(removeSections);

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

    removeSections();
})();