Greasy Fork

Greasy Fork is available in English.

Roblox Home Page Cleaner

Roblox Home Page Cleaner lets you toggle Today's Picks on or off. It also gets rid of the Add Friends button and any other random trash Roblox throws on the homepage!

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Roblox Home Page Cleaner
// @namespace    Roblox Recommended and Sponsored remover
// @version      6.1.6
// @description  Roblox Home Page Cleaner lets you toggle Today's Picks on or off. It also gets rid of the Add Friends button and any other random trash Roblox throws on the homepage!
// @author       Krex
// @match        https://*.roblox.com/home
// @grant        GM_addStyle
// ==/UserScript==
//Will Roblox ever STOP changing things and breaking every script?????????
//took ONE DAY for roblox to break EVERYTHING AGAIN
(function () {
    'use strict';

    let showTodaysPicks = false;
    let cleanTimeout = null;

    function ToggletodaysPicksButton() {
        const navList = document.querySelector('ul.nav.rbx-navbar');
        if (!navList) {
            setTimeout(ToggletodaysPicksButton, 1000);
            return;
        }
        if (document.getElementById('toggleTodaysPicksBtn')) 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.id = 'toggleTodaysPicksBtn';

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

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

    function cleanHomePage() {
        if (cleanTimeout) clearTimeout(cleanTimeout);
        cleanTimeout = setTimeout(() => {
            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();
            }

            const todaysPicks = document.querySelector("#HomeContainer > div.place-list-container > div > div > div:nth-child(2)");
            const recommended1 = document.querySelector("#HomeContainer > div.place-list-container > div > div > div:nth-child(4)");
            const recommended2 = document.querySelector("#HomeContainer > div.place-list-container > div > div > div:nth-child(5)");

            if (todaysPicks) todaysPicks.style.display = showTodaysPicks ? '' : 'none';
            if (recommended1) recommended1.style.display = 'none';
            if (recommended2) recommended2.style.display = 'none';
        }, 300);
    }

    function init() {
        ToggletodaysPicksButton();
        cleanHomePage();

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

    window.addEventListener('load', () => {
        setTimeout(init, 1000);
    });
})();