uwuifyer

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

2026/08/18のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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
})();