Modify Text Area from pixai prompts

Modifica el tamaño de un área de texto y agrega un botón para alternar el tamaño uwu

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Modify Text Area from pixai prompts
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Modifica el tamaño de un área de texto y agrega un botón para alternar el tamaño uwu
// @author       Abejita
// @match        https://pixai.art/generator/image
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Función para crear el botón
    function createButton() {
        let buttonContainer = document.querySelector('.px-4.py-1.flex.gap-4.items-center .flex-1');
        if (buttonContainer && !document.querySelector('#toggleSizeButton')) {
            let button = document.createElement('button');
            button.id = 'toggleSizeButton';
            button.textContent = 'Agrandar';
            button.style.padding = '8px 18px';
            button.style.borderRadius = '5px';
            button.style.border = 'none';
            button.style.background = 'linear-gradient(to right, #ff7ec5, #c36bfb)';
            button.style.color = 'white';
            button.style.cursor = 'pointer';
            button.style.fontSize = '16px';
            button.style.margin = '10px';
            buttonContainer.appendChild(button);

            button.addEventListener('click', toggleSize);
        }
    }

    // Función para alternar el tamaño del área de texto
    function toggleSize() {
        let elements = document.querySelectorAll('textarea.w-full.min-h-\\[3em\\].max-h-\\[9em\\].dense\\:max-h-\\[5em\\].bg-transparent.outline-none.resize-none');
        elements.forEach(element => {
            if (element.style.height === '400px') {
                element.style.height = '120px';
                element.style.maxHeight = '2000px';//9em
                document.querySelector('#toggleSizeButton').textContent = 'Agrandar';
            } else {
                element.style.height = '400px';
                element.style.maxHeight = '2000px';
                document.querySelector('#toggleSizeButton').textContent = 'Reducir';
            }
        });
    }

    // Crear el botón al cargar la página completamente
    window.addEventListener('load', function() {
        setTimeout(createButton, 6000);
    });

    // Crear el botón al presionar F9
    document.addEventListener('keydown', function(event) {
        if (event.key === 'F9') {
            createButton();
        }
    });

    // Revisa cada 6 segundos para asegurarse de que el botón aparezca correctamente
    setInterval(createButton, 6000);
})();