/space-replacer

A micro app that replaces spaces with underscores in pasted text.

Primary LanguageHTML

space-replacer 2.0

A super simple app that replaces spaces with underscores in pasted text.

The tool no longer relies on the prompt method.

It now uses an "onpaste" event listener in the markup, which triggers the replace function after a 4ms delay. The delay is added because "onpaste" triggers directly after the paste event, before the text is pasted. 4ms is the minimum delay of the setTimeout function as per HTML 5.

The can now complete space replacement in 4 steps:

  1. Open Space Replacer
  2. Ctrl+V
  3. Ctrl+C
  4. Close Space Replacer (Ctrl+W)

Next step should be browser plug-in integration and a keyboard shortcut, reducing the number of steps to one.

Added some styling in-line. Can consider moving it to CSS in future versions.