Have you considered jQuickie?Browser Info Environment
- Having to add code 'if edit mode'
- Need to load other common resources.
- Need to catch exceptions.
- Need to add ready event handlers.
Maybe you should have a look at jQuickie.http://www.concrete5.org/marketplace/addons/jquickie/...
Straight up, you could do it all the hard way using a plain html block. But that is like saying 'Why do I need Concrete5 when I could do the same with php?'.
jQuickie wraps your script in common infrastructure like exception handlers, edit mode conditions, and ready handlers; loads resources to the header or footer; provides a code editor with syntax highlighting, folding and undo/redo; and uses jsHint to analyse and validate your code.