Text Converter

A userscript that converts text in the browser.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Autore
xhofe
Installazioni giornaliere
0
Installazioni totali
2
Valutazione
0 0 0
Versione
0.0.0
Creato il
07/04/2026
Aggiornato il
07/04/2026
Dimensione
8,07 KB
Licenza
MIT
Applica a
Tutti i siti

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