Hide Paid Mentions & Sticky Validate on Minestrator

Hides paid-only content and pins Validate Settings to bottom on Minestrator panel pages for free servers only.

// ==UserScript==
// @name         Hide Paid Mentions & Sticky Validate on Minestrator
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Hides paid-only content and pins Validate Settings to bottom on Minestrator panel pages for free servers only.
// @author       You
// @match        https://minestrator.com/en/board/manage/my/server/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const hidePaidContent = () => {
        document.querySelectorAll('.modal-content').forEach(modal => {
            const title = modal.querySelector('.modal-header .modal-title');
            if (title?.textContent.trim() === 'Upgrade MyBox') {
                modal.closest('.modal')?.remove();
                console.log('Removed "Upgrade MyBox" modal');
            }
        });

        document.querySelectorAll('.card-access').forEach(card => {
            const heading = card.querySelector('h4');
            const text = card.textContent;

            if (
                heading?.textContent.includes("My MySQL credentials") &&
                text.includes("Databases are not available on free servers.")
            ) {
                card.closest('.col-lg-6, .col-12')?.remove();
            }

            if (
                heading?.textContent.includes("Dedicated ports") &&
                text.includes("Dedicated ports are not available on free servers.")
            ) {
                card.closest('.col-12')?.remove();
            }
        });

        const selectorsToRemove = [
            '[data-target="#upgradeBoxModal"]',
            '.premium-badge',
            '.upgrade-notice',
            'a[href^="/en/board/upgrade/"]'
        ];
        selectorsToRemove.forEach(sel => {
            document.querySelectorAll(sel).forEach(el => el.remove());
        });

        const navTabSelectors = [
            'a[href="#sauvegardes"]',
            'a[href="#livemap"]',
            'a[href="#statistiques"]'
        ];
        navTabSelectors.forEach(sel => {
            document.querySelectorAll(sel).forEach(tab => {
                tab.closest('.nav-item')?.remove();
            });
        });

        const paramBlock = document.querySelector('#parametres');
        if (paramBlock) {
            const validateBox = paramBlock.querySelector('.col-sm-12');
            if (validateBox && !validateBox.classList.contains('floating-validate')) {
                validateBox.classList.add('floating-validate');
                console.log("Floating validate box enabled");
            }
        }
    };

    const css = `
.floating-validate {
    position: fixed !important;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    z-index: 1000;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
    `;
    if (typeof GM_addStyle !== 'undefined') {
        GM_addStyle(css);
    } else {
        const style = document.createElement('style');
        style.textContent = css;
        document.head.appendChild(style);
    }

    window.addEventListener('load', hidePaidContent);
    const observer = new MutationObserver(hidePaidContent);
    observer.observe(document.body, { childList: true, subtree: true });
})();