Twitter/X UI Improvements

Improves Twitter/X layout by adjusting widths and removing grok and stuff

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         Twitter/X UI Improvements
// @namespace    https://twitter.com/
// @version      1.1
// @description  Improves Twitter/X layout by adjusting widths and removing grok and stuff
// @author       Minoa
// @match        https://twitter.com/*
// @match        https://x.com/*
// @grant        GM_addStyle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Add custom CSS styles
    const customStyles = `
        .r-1ye8kvj { max-width: 680px !important; }
        .r-o96wvk { width: 230px !important; }
        .r-ttdzmv { padding-top: 8px !important; }
        .r-1hycxz { width: 280px !important; }
        .r-1jte41z { min-width: 250px !important; }
    `;
    
    GM_addStyle(customStyles);

    // Function to remove unwanted elements
    function removeElements() {
        const selectors = [
            '[data-testid="GrokDrawer"]',
            'a[href="/i/grok"]',
            'a[href="/i/verified-orgs-signup"]',
            'a[href="/i/premium_sign_up"]',
            'aside[aria-label="Subscribe to Premium"]',
            '[data-testid="grokImgGen"]',
            '.r-18u37iz.r-1h0z5md button[aria-label="Grok actions"]'
        ];

        selectors.forEach(selector => {
            const elements = document.querySelectorAll(selector);
            elements.forEach(element => element.remove());
        });
    }

    // Create and run mutation observer to handle dynamically loaded content
    const observer = new MutationObserver(() => {
        removeElements();
    });

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

    // Initial cleanup
    removeElements();
})();