PLD: split the js loads into pre and post for things that need dom and d...

...o not, closes #637