Text Converter

A userscript that converts text in the browser.

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 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!)

Autor
xhofe
Denně instalací
0
Celkem instalací
2
Hodnocení
0 0 0
Verze
0.0.0
Vytvořeno
07. 04. 2026
Aktualizováno
07. 04. 2026
Size
8,1 KB
Licence
MIT
Spustit na
všech stránkách

Text Converter

A Tampermonkey userscript for in-page text conversion. Select text on any webpage, click the floating trigger button, and choose a converter to replace the selected text in place.

Features

  • Works on all websites (*://*/*)
  • Floating T button appears near the selection
  • Keyboard shortcut: Cmd+Option+C (Mac) / Ctrl+Alt+C (Windows/Linux)
  • Preserves DOM structure when selection spans multiple elements
  • Handles <input> / <textarea> fields
  • Press Escape or click outside to dismiss

Built-in Converters

Converter Description
Unicode Decode \u4f60\u597d你好

Development

# Install dependencies
pnpm install

# Dev mode (auto-reload in Tampermonkey)
pnpm dev

# Production build
pnpm build

The compiled userscript is output to dist/monkey-text-converter.user.js.

Adding a New Converter

  1. Create a file in src/converters/:
// src/converters/my-converter.ts
import type { TextConverter } from '../types';

export const myConverter: TextConverter = {
  name: 'My Converter',
  convert(text: string): string {
    return text; // your logic here
  },
};
  1. Register it in src/main.ts:
import { myConverter } from './converters/my-converter';
registerConverter(myConverter);

Project Structure

src/
  main.ts                 # Entry point — register converters & init
  types.ts                # TextConverter interface
  converter-registry.ts   # Converter registry (register / getAll)
  text-replacer.ts        # Selection reading & DOM text replacement
  converters/
    unicode-decode.ts     # Unicode decode (\uXXXX → char)
  context-menu/
    index.ts              # Floating button & menu logic
    style.css             # UI styles

Tech Stack