Wait for DOM

I got tired of tired retyping the same code again and again, so I put it — finally — in global.js, hopefully in a generalizable form.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>