REMOVE SLOP PROJECTS

Precisely blocks project cards by text on websim.com and collapses empty grid gaps.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         REMOVE SLOP PROJECTS
// @namespace    http://tampermonkey.net
// @version      3.3
// @description  Precisely blocks project cards by text on websim.com and collapses empty grid gaps.
// @author       Killy
// @match        https://websim.com/*
// @match        https://www.websim.com/*
// @match        https://websim.ai/*
// @match        https://www.websim.ai/*
// @grant        none
// @run-at       document-end
 // @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Enter your keywords/phrases here (all lowercase)
    const blockList = [
        "numberblocks",
        "colorblocks",
        "alphablocks",
        "numberslop",
        "sprunki",
        "Untitled",
        "Sandbox",
        "Playground",
        "Effects",
        "klasky csupo"
    ];

    const isHomePage = () => {
        const path = window.location.pathname;
        return path === '/' || path === '/index.html';
    };

    const blockProjects = () => {
        if (!isHomePage()) return;

        // Select elements we haven't checked yet
        const selectors = ['a', 'h1', 'h2', 'h3', 'span', 'p']
            .map(tag => `${tag}:not([data-wb-checked])`)
            .join(', ');

        const titles = document.querySelectorAll(selectors);

        titles.forEach(el => {
            el.setAttribute('data-wb-checked', 'true');

            const text = el.textContent.trim().toLowerCase();
            if (!text) return;

            const matchesBlock = blockList.some(phrase => text.includes(phrase));

            if (matchesBlock) {
                // Base target: the link itself
                let containerToHide = el.closest('a') || el;
                let current = containerToHide;

                // Walk up the DOM tree to find the main layout grid.
                // By finding the parent grid, we know 'current' is the exact slot leaving the empty gap.
                while (current.parentElement && current.parentElement.tagName !== 'BODY' && current.parentElement.tagName !== 'MAIN') {
                    const parentClass = current.parentElement.className || '';

                    // Look for standard grid containers (WebSim uses Tailwind CSS)
                    if (typeof parentClass === 'string' && (parentClass.includes('grid ') || parentClass.includes('grid-cols') || parentClass.match(/\bgrid\b/))) {
                        containerToHide = current; // We found the exact grid cell!
                        break;
                    }
                    current = current.parentElement;
                }

                // Hide the ENTIRE grid cell to collapse the space completely
                containerToHide.style.display = 'none';
            }
        });
    };

    // --- Debounce Utility ---
    const debounce = (func, wait) => {
        let timeout;
        return function(...args) {
            clearTimeout(timeout);
            timeout = setTimeout(() => func.apply(this, args), wait);
        };
    };

    const debouncedBlockProjects = debounce(blockProjects, 150);

    // Run on initial page load
    blockProjects();

    // Monitor for infinite scroll and URL changes
    const observer = new MutationObserver((mutations) => {
        if (!isHomePage()) return;

        const hasNewNodes = mutations.some(mutation => mutation.addedNodes.length > 0);
        if (hasNewNodes) {
            debouncedBlockProjects();
        }
    });

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

    console.log("WebSim Gap-Collapsing Blocker Active.");
})();