A userscript that converts text in the browser.
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.
*://*/*)Cmd+Option+C (Mac) / Ctrl+Alt+C (Windows/Linux)<input> / <textarea> fieldsEscape or click outside to dismiss| Converter | Description |
|---|---|
| Unicode Decode | \u4f60\u597d → 你好 |
# 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.
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
},
};
src/main.ts:import { myConverter } from './converters/my-converter';
registerConverter(myConverter);
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