Move JS from template into JS files.