google-ai-mode-removal

Userscript to remove AI Mode button from Google search results

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         google-ai-mode-removal
// @namespace    http://tampermonkey.net/
// @license      MIT
// @version      10.0
// @description  Userscript to remove AI Mode button from Google search results
// @match        https://www.google.com/search*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    console.log("🚀 Script Modo IA iniciado");

    function removeModoIA() {
        // Procurar por todos os elementos que contenham o texto
        const elementos = document.querySelectorAll('*');

        for (const elemento of elementos) {
            if (elemento.textContent && elemento.textContent.includes('Modo IA')) {
                // Subir na árvore DOM para encontrar o botão
                let pai = elemento;
                while (pai && pai !== document.body) {
                    if (pai.tagName === 'BUTTON' ||
                        pai.getAttribute('role') === 'button' ||
                        pai.tagName === 'A') {

                        console.log("✅ Removendo:", pai);
                        pai.remove();
                        return true;
                    }
                    pai = pai.parentElement;
                }
            }
        }
        return false;
    }

    // Tentar remover imediatamente
    setTimeout(removeModoIA, 500);

    // Observar mudanças
    const observer = new MutationObserver(() => {
        removeModoIA();
    });

    // Iniciar observação quando o DOM estiver pronto
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', () => {
            observer.observe(document.body, {
                childList: true,
                subtree: true
            });
        });
    } else {
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    // Verificação periódica
    setInterval(removeModoIA, 2000);
})();