fix bug 36180 (JS modules not loaded for transcluded RunQuery forms)

SpecialPageFactory::capturePath swaps $wgOut (and other globals) so that adding JS to them has no effect on the actual output.

The fix is to add JS to the ParserOutput ($wgParser->getOutput) instead.

Change-Id: I5e42325808f6121e7f533b778df30eeea9f2f89f