Greasy Fork

Greasy Fork is available in English.

Roblox Home Cleaner

Roblox Home Page Cleaner with the option to toggle on or off "Today's Picks"! Also removes the add friends button!

当前为 2025-05-23 提交的版本,查看 最新版本

// ==UserScript==
// @name         Roblox Home Cleaner
// @namespace    Roblox Recommended and Sponsored remover
// @version      6.1.3
// @description  Roblox Home Page Cleaner with the option to toggle on or off "Today's Picks"! Also removes the add friends button!
// @author       Krex
// @match        https://*.roblox.com/home
// @grant        GM_addStyle
// ==/UserScript==

(function () {
    'use strict';

    const ALLOWED_SECTIONS = ["Continue", "Favorites"];
    let showTodaysPicks = false;

function ToggletodaysPicksButton() {
    const navList = document.querySelector('ul.nav.rbx-navbar');
    if (!navList) return;

    const listItem = document.createElement('li');
    listItem.className = 'cursor-pointer';

    const toggleButton = document.createElement('a');
    toggleButton.textContent = "Toggle Today's Picks";
    toggleButton.href = "#";
    toggleButton.className = 'font-header-2 nav-menu-title text-header';
    toggleButton.style.userSelect = 'none';

    toggleButton.addEventListener('click', (e) => {
        e.preventDefault();
        showTodaysPicks = !showTodaysPicks;
        cleanHomePage();
    });

    listItem.appendChild(toggleButton);
    navList.appendChild(listItem);
}

    function cleanHomePage() {

const friendsTile = document.querySelector('.friends-carousel-list-container > div.friends-carousel-tile:nth-of-type(1) > [href*="/users/friends"]');
if (friendsTile && friendsTile.parentElement) {
    friendsTile.parentElement.remove();
} //will this work????? hmmmmmmmmmm
        document.querySelectorAll('h2, h3').forEach(heading => {
            const sectionTitle = heading.textContent.trim();
            const container = heading.closest(
                'div[class*="game-sort-carousel-wrapper"], div[data-testid="home-page-game-grid"]'
            );

            if (container) {
                container.style.display = 
                    ALLOWED_SECTIONS.includes(sectionTitle) || 
                    (showTodaysPicks && sectionTitle.startsWith("Today's Picks"))
                        ? ''
                        : 'none';
            }
        });
    }

    const observer = new MutationObserver(cleanHomePage);
    observer.observe(document.body, { childList: true, subtree: true });

    ToggletodaysPicksButton();
    cleanHomePage();
})();