Remove Recommended section on the roblox home page!
当前为
// ==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 });