Javascript refactoring/cleanup

I started working myself through tinytinyrss.js and did some refactoring on the way. This might not be the end of it, but as I'm already 20 commits into it, I decided to put it up for discussion and hopefully merging.