uwuifyer

Detects and converts ONLY what you type into uwu style across all Discord locations.

Από την 18/08/2026. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey or Violentmonkey 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         uwuifyer
// @namespace    http://tampermonkey.net
// @version      1.1
// @description  Detects and converts ONLY what you type into uwu style across all Discord locations.
// @author       You
// @license      MIT
// @match        https://*://
// @match        https://*://*
// @match        https://*://
// @match        https://discord.com*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Function to convert regular text to uwu style
    function uwuify(text) {
        return text
            .replace(/[lr]/g, 'w')
            .replace(/[LR]/g, 'W')
            .replace(/n([aeiou])/g, 'ny$1')
            .replace(/N([aeiou])/g, 'Ny$1')
            .replace(/N([AEIOU])/g, 'NY$1')
            .replace(/ove/g, 'uv');
    }

    // Safely inject text directly into Discord's internal state
    function setTextInDiscord(target, newText) {
        const reactKey = Object.keys(target).find(key => key.startsWith('__reactFiber$') || key.startsWith('__reactInternalInstance$'));
        if (!reactKey) return false;

        try {
            let node = target[reactKey];
            while (node) {
                if (node.memoizedProps && node.memoizedProps.editor) {
                    const editor = node.memoizedProps.editor;
                    
                    // Remember selection position
                    const savedSelection = editor.selection;
                    
                    // Update state content
                    editor.selectAll();
                    editor.insertText(newText);
                    
                    // Put cursor back to where it belonged
                    if (savedSelection) {
                        editor.selection = savedSelection;
                    }
                    return true;
                }
                node = node.return;
            }
        } catch (e) {
            // Silently catch framework errors
        }
        return false;
    }

    // Watch text as you type it out
    document.addEventListener('input', function(event) {
        const target = event.target;
        if (!target) return;

        // 1. Process regular Discord chat box
        if (target.getAttribute('contenteditable') === 'true') {
            if (target.dataset.isUwUing) return;
            target.dataset.isUwUing = 'true';

            const original = target.innerText || "";
            const converted = uwuify(original);

            if (original !== converted) {
                setTextInDiscord(target, converted);
            }

            delete target.dataset.isUwUing;
        }
        // 2. Process standard text fields (Search box, settings bars)
        else if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
            const original = target.value;
            const converted = uwuify(original);
            if (original !== converted) {
                const start = target.selectionStart;
                const end = target.selectionEnd;
                target.value = converted;
                target.setSelectionRange(start, end);
            }
        }
    }, true);
})();