Execute JavaScript output after DOMContentLoaded

Previously, JavaScript generated for the browser would only execute on
the DOMContentLoaded event. We should also check if the browser is
already ready. We can do this with the following:

    document.readyState == "complete" || document.readyState == "loaded"
Merge pull request #874 from puffnfresh/javascript-ready

Execute JavaScript output after DOMContentLoaded