Fix bug that prevented to re-edit a caption
Stop leaking vars

- Wrap the plugin in a function
- Cache calls to `$(this)`
- Leak as few vars as possible to `window`
- Add some missing `;`
Use builtin Dialog api to close gracefully

Relying on all the click events is messy and does not cover all cases
(ie closing with ESC key).
Extract templating code, js -> html
Add option to use textarea instead of WYSIWYG