RuudBurger/CouchPotatoServer — pull request #2040 by cpg (2013-08-20 11:41:47+00:00)
Title: Some times CP comes up with an empty body

Hi, I find that CP comes up with an empty body often. The HTML is not empty, tho, so the app is alive. See gist:6280227 for what it generates.

There are no errors in the data dir at data/logs/CouchPotato.log

On a hunch, I took at look at the JS console and it looks like
```
ReferenceError: $ is not defined
[Break On This Error]

if($(window).getSize().x <= 480)
```
restarting the server eventually seems to generate a proper app, suggesting a race condition.

This patch appears to reliably work by making sure the code runs when
the DOM has finished loading.