Text Converter

A userscript that converts text in the browser.

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

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

Upphovsman
xhofe
Dagliga installationer
0
Totala installationer
2
Betyg
0 0 0
Version
0.0.0
Skapad
2026-04-07
Uppdaterad
2026-04-07
Size
8,07 KB
Licens
MIT
Gäller för
Alla sidor

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