Disable ChatGPT Login Popup

Menghilangkan popup login & "Sign up" di chatgpt.com dengan lebih agresif menggunakan CSS injection dan MutationObserver.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         Disable ChatGPT Login Popup
// @name:en      Disable ChatGPT Login Popup
// @namespace    Violentmonkey Scripts
// @version      1.0
// @description  Menghilangkan popup login & "Sign up" di chatgpt.com dengan lebih agresif menggunakan CSS injection dan MutationObserver.
// @description:en Aggressively removes the login & "Sign up" popup on chatgpt.com using CSS injection and MutationObserver.
// @author       3xploiton3
// @match        https://chatgpt.com/*
// @grant        GM_addStyle
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Selektor untuk popup dan elemen pengganggu lainnya.
    // Ini mungkin perlu disesuaikan jika OpenAI mengubah desain situsnya.
    // ---
    // Selectors for the popup and other intrusive elements.
    // These may need to be adjusted if OpenAI changes the site design.
    const SELECTORS_TO_REMOVE = [
        '[data-testid="modal-no-auth-welcome-back"]', // Popup utama "Welcome back" // Main "Welcome back" popup
        '.group.fixed.bottom-3.right-3', // Tombol "Get help" yang mengambang // Floating "Get help" button
        'div.w-full.text-center.text-xs' // Banner "Sign up to chat" di bawah // "Sign up to chat" banner at the bottom
    ];

    // Selektor untuk backdrop/overlay yang menggelapkan dan mengunci halaman.
    // ---
    // Selector for the backdrop/overlay that darkens and locks the page.
    const BACKDROP_SELECTOR = 'div[data-radix-portal] + div';

    // --- Langkah 1: Sembunyikan Elemen Secara Instan dengan CSS ---
    // @run-at document-start memastikan CSS ini diterapkan sebelum halaman dirender.
    // Ini adalah cara paling efektif untuk mencegah "flash" atau kemunculan singkat popup.
    // ---
    // --- Step 1: Instantly Hide Elements with CSS ---
    // @run-at document-start ensures this CSS is applied before the page is rendered.
    // This is the most effective way to prevent a "flash" or brief appearance of the popup.
    GM_addStyle(`
        ${SELECTORS_TO_REMOVE.join(',\n')} {
            display: none !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }
        ${BACKDROP_SELECTOR} {
            display: none !important;
        }
    `);

    // --- Langkah 2: Hapus Elemen dari DOM & Perbaiki Scroll ---
    // MutationObserver akan memantau setiap perubahan pada halaman.
    // ---
    // --- Step 2: Remove Elements from the DOM & Fix Scrolling ---
    // The MutationObserver will monitor any changes on the page.
    const observer = new MutationObserver((mutations) => {
        let popupFound = false;

        // Loop untuk mencari dan menghapus semua elemen yang tidak diinginkan.
        // ---
        // Loop to find and remove all unwanted elements.
        for (const selector of SELECTORS_TO_REMOVE) {
            const element = document.querySelector(selector);
            if (element) {
                element.remove();
                popupFound = true; // Tandai jika salah satu elemen ditemukan & dihapus // Mark if an element was found & removed
            }
        }

        // Cari dan hapus backdrop secara terpisah.
        // ---
        // Find and remove the backdrop separately.
        const backdrop = document.querySelector(BACKDROP_SELECTOR);
        if (backdrop) {
            backdrop.remove();
            popupFound = true;
        }

        // Jika popup atau backdrop ditemukan dan dihapus,
        // pastikan scroll halaman diaktifkan kembali.
        // ---
        // If a popup or backdrop was found and removed,
        // ensure page scrolling is re-enabled.
        if (popupFound) {
            document.documentElement.style.overflow = '';
            document.body.style.overflow = '';
        }
    });

    // Mulai amati perubahan dari root elemen (<html>) sesegera mungkin.
    // ---
    // Start observing changes from the root element (<html>) as soon as possible.
    observer.observe(document.documentElement, {
        childList: true, // Amati penambahan/penghapusan elemen anak // Observe addition/removal of child elements
        subtree: true    // Amati seluruh sub-pohon (semua elemen di dalam <html>) // Observe the entire subtree (all elements within <html>)
    });

})();