Make sure JS files from addExtraJS are loaded after in-page <script>s
Make sure JS files from addExtraJS are loaded after in-page <script>s

In production we were getting an error that suggested that tabs.js was
being loaded before map.js.

These are loaded by different mechanisms (warning: this is all awful):

 - map.js is loaded via {% javascript 'google-map' %} in the <body>
   which is replaced by a <script> tag that loads it directly

 - tabs.js is loaded from the 'both' case of yepnope (although in a
   slightly convoluted way, because of the hack to make django-pipeline
   work with yepnope) - it starts with addExtraJS

I believe this is happening because the files that are loaded from
'both' don't wait for the document to be ready, so the <script> tag in
the body might not have been loaded yet.

This moves the loading of the extra JS into the 'complete' callback of
yepnope, and wraps the body of that function in $(function() { }) so
that it really is only run when the document's ready.

n.b. This is just a quick fix because the rep locator page is broken on
People's Assembly. I think the best way to fix this ultimately is to
remove this tangled web of hacked-together delayed loading entirely,
and replace it with something more coherent.

Fixes #2137
Fixes #2138
Fixes #2139

mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola