DrawariaGPT AI Chat

New DrawariaGPT ChatBot AI - Assistant

// ==UserScript==
// @name         DrawariaGPT AI Chat
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  New DrawariaGPT ChatBot AI - Assistant
// @author       YouTubeDrawaria
// @match        https://ftac.vercel.app/*
// @match        https://drawaria.online/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=drawaria.online
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Función para inyectar estilos globales
    function addGlobalStyle(css) {
        const head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        const style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }

    // --- Código para ftac.vercel.app ---
    if (window.location.host.includes("ftac.vercel.app")) {
        window.addEventListener('load', () => {
            const header = document.querySelector("body > div.tac-data > h1");
            if (header) {
                header.textContent = "DrawariaGPT AI Chat 🤖🌞";
            }
        });
    }

    // --- Código para drawaria.online ---
    if (window.location.host.includes("drawaria.online")) {
        // Creamos el contenedor modal para mostrar la página de ftac.vercel.app
        const container = document.createElement("div");
        container.id = "drawariagpt-container";
        container.style.position = "fixed";
        container.style.top = "50%";
        container.style.left = "50%";
        container.style.transform = "translate(-50%, -50%)";
        container.style.width = "80%";
        container.style.height = "80%";
        container.style.background = "#fff";
        container.style.boxShadow = "0 0 10px rgba(0,0,0,0.5)";
        container.style.zIndex = "10000";
        container.style.display = "none"; // inicialmente oculto
        container.style.flexDirection = "column";
        container.style.overflow = "hidden";

        // Creamos la barra superior con el botón de cerrar
        const headerBar = document.createElement("div");
        headerBar.style.background = "#333";
        headerBar.style.color = "#fff";
        headerBar.style.padding = "10px";
        headerBar.style.display = "flex";
        headerBar.style.justifyContent = "space-between";
        headerBar.style.alignItems = "center";

        const title = document.createElement("span");
        title.textContent = "DrawariaGPT Chat";
        headerBar.appendChild(title);

        const closeButton = document.createElement("button");
        closeButton.textContent = "Close";
        closeButton.style.background = "#f00";
        closeButton.style.color = "#fff";
        closeButton.style.border = "none";
        closeButton.style.padding = "5px 10px";
        closeButton.style.cursor = "pointer";
        closeButton.addEventListener("click", () => {
            container.style.display = "none";
        });
        headerBar.appendChild(closeButton);

        container.appendChild(headerBar);

        // Utilizamos un elemento <object> en lugar de un <iframe>
        const objectEl = document.createElement("object");
        objectEl.data = "https://ftac.vercel.app/";
        objectEl.type = "text/html";
        objectEl.style.width = "100%";
        objectEl.style.height = "100%";
        objectEl.style.border = "none";

        container.appendChild(objectEl);
        document.body.appendChild(container);

        // Creamos el ícono flotante (draggable)
        const icon = document.createElement("img");
        icon.src = "https://www.google.com/s2/favicons?sz=64&domain=drawaria.online";
        icon.id = "drawariagpt-icon";
        icon.style.position = "fixed";
        icon.style.bottom = "20px";
        icon.style.right = "20px";
        icon.style.width = "50px";
        icon.style.height = "50px";
        icon.style.cursor = "pointer";
        icon.style.zIndex = "10001";
        document.body.appendChild(icon);

        // Al hacer click en el ícono se abre el contenedor
        icon.addEventListener("click", () => {
            container.style.display = "flex";
        });

        // Hacemos que el ícono sea arrastrable
        let isDragging = false;
        let offsetX, offsetY;

        icon.addEventListener("mousedown", (e) => {
            isDragging = true;
            offsetX = e.clientX - icon.getBoundingClientRect().left;
            offsetY = e.clientY - icon.getBoundingClientRect().top;
            e.preventDefault();
        });

        document.addEventListener("mousemove", (e) => {
            if (isDragging) {
                // Removemos estilos fijos de right y bottom
                icon.style.right = "auto";
                icon.style.bottom = "auto";
                icon.style.left = (e.clientX - offsetX) + "px";
                icon.style.top = (e.clientY - offsetY) + "px";
            }
        });

        document.addEventListener("mouseup", () => {
            isDragging = false;
        });
    }
})();