mediawiki.js: Move stray lines int global scope to closure

There was a local variable "mw" in the (implied) global scope,
which then got assigned to "window.mw". That's a bit odd having
both.

There were also some extra lines hanging outside the closure
(where we used jQuery instead of $).

Make the local "mw" actually local and move the rest into the
closure as well.

Remove obsolete "undefined" variable reset. Per code conventions,
we don't support environments that define "undefined". Most of
our modules already don't account for this but mediawiki base
still did.

Change-Id: Iab31788cc6413d0185d868da9cce130fd4d76cde
Merge "mediawiki.js: Move stray lines int global scope to closure"