Remove all inline JavaScript from viewer.html to comply with CSP unsafe-inline and correct error textarea's height

Move inline event handlers to viewer.js to comply with a [Content-Security-Policy](http://www.w3.org/TR/2013/WD-CSP11-20130604/) where directive "unsafe-inline" is not set.

Also changed `textarea.rows = <number of newlines>` to `textarea.style.height = textarea.scrollHeight`.
The previous method was unreliable, because most errors are wrapped. In practice, this meant that the error was alsways put in a textarea with the height of one line.