Extracts global javascript to main.js