Moves application.js script to app-init.js script

Script in application.js appeared to be running before requirejs read
its configuration file, so this moves the code in application.js to the
app-init.js script, which runs on all pages (like application.js).