site.js: some refactoring

More will be needed. And I still suck at JavaScript.
Improve UI error messages on invalid JSON

Now the message displays the line and column at which the error has occurred.
site.js: add function to set the cursor at a given position in a text area

Found on Stack Overflow. Tested.
Make JSON parse error reporting work!

We now have a link right below the text area; when the user clicks on it, the
caret automatically jumps to the correct position. Yay!