Discord UwU Typer

Turns your typed keys into uwu style text on Discord!

Verzia zo dňa 18.08.2026. Pozri najnovšiu verziu.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu budete musieť nainštalovať rozšírenie, ako je napríklad Tampermonkey alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         Discord UwU Typer
// @namespace    http://tampermonkey.net
// @version      0.3
// @description  Turns your typed keys into uwu style text on Discord!
// @author       You
// @license      MIT
// @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');
    }

    // Monitor keyboard input
    document.addEventListener('input', function(event) {
        const target = event.target;
        
        // Target standard text inputs, textareas, and Discord's rich text editor
        if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.getAttribute('contenteditable') === 'true') {
            
            // Handle standard input fields
            if (target.value !== undefined) {
                const start = target.selectionStart;
                const end = target.selectionEnd;
                target.value = uwuify(target.value);
                target.setSelectionRange(start, end);
            } 
            // Handle Discord's special slate/contenteditable chat boxes
            else if (target.innerHTML !== undefined) {
                // Prevent infinite loops from script modifying its own changes
                if (target.dataset.isUwUing) return;
                target.dataset.isUwUing = 'true';

                // Save cursor position safely
                const selection = window.getSelection();
                if (selection.rangeCount > 0) {
                    const range = selection.getRangeAt(0);
                    const offset = range.startOffset;
                    const container = range.startContainer;

                    if (container.nodeType === Node.TEXT_NODE) {
                        container.textContent = uwuify(container.textContent);
                        
                        // Restore cursor position
                        try {
                            const newRange = document.createRange();
                            newRange.setStart(container, Math.min(offset, container.textContent.length));
                            newRange.collapse(true);
                            selection.removeAllRanges();
                            selection.addRange(newRange);
                        } catch (e) {
                            // Fallback if cursor position fails
                        }
                    }
                }
                delete target.dataset.isUwUing;
            }
        }
    }, true);
})();