Move main js logic to fxos_apps.js