VID-2130 Fixing gallery loading race condition

Galleries weren't always loading b/c the ```wikipage.content``` event wasn't waiting for the DOM to be ready. I had only ported over one line from MW1.23.6 and had missed the part where it waited for the onload event.