uwuifyer

Instantly swaps letters as you press them into uwu style on Discord!

Verze ze dne 18. 08. 2026. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         uwuifyer
// @namespace    http://tampermonkey.net
// @version      1.2
// @description  Instantly swaps letters as you press them into uwu style on Discord!
// @author       You
// @license      MIT
// @match        https://*://
// @match        https://*://*
// @match        https://*://
// @match        https://discord.com*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Quick single-character layout mapping
    function getUwUKey(key) {
        if (key === 'l' || key === 'r') return 'w';
        if (key === 'L' || key === 'R') return 'W';
        return null;
    }

    // Intercept keyboard hits immediately
    document.addEventListener('keydown', function(event) {
        const target = event.target;
        if (!target) return;

        // Only look at typing inputs
        if (target.getAttribute('contenteditable') === 'true' || target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
            
            // Check if the pressed key needs to be uwuified
            const replacementKey = getUwUKey(event.key);
            
            if (replacementKey) {
                // Stop the real 'l' or 'r' from ever reaching Discord's input engine
                event.preventDefault();
                event.stopImmediatePropagation();

                // 1. Handle Discord's main Rich Text Chatbox
                if (target.getAttribute('contenteditable') === 'true') {
                    const reactKey = Object.keys(target).find(k => k.startsWith('__reactFiber$') || k.startsWith('__reactInternalInstance$'));
                    if (!reactKey) return;

                    try {
                        let node = target[reactKey];
                        while (node) {
                            if (node.memoizedProps && node.memoizedProps.editor) {
                                // Direct injection into Discord's internal text stream
                                node.memoizedProps.editor.insertText(replacementKey);
                                break;
                            }
                            node = node.return;
                        }
                    } catch (e) {
                        console.error("Keystroke override failed:", e);
                    }
                } 
                // 2. Handle standard plain inputs (Search bars, settings)
                else if (target.value !== undefined) {
                    const start = target.selectionStart;
                    const end = target.selectionEnd;
                    const val = target.value;
                    
                    // Insert 'w' or 'W' right where the cursor is flashing
                    target.value = val.slice(0, start) + replacementKey + val.slice(end);
                    target.setSelectionRange(start + 1, start + 1);
                    
                    // Tell the website something was typed
                    target.dispatchEvent(new Event('input', { bubbles: true }));
                }
            }
        }
    }, true); // Crucial: 'true' catches the finger press before Discord handles it
})();