General cleanup of common.js

- I encased the whole script in an anonymous function because there was really no reason not to. Any variables that we want exposed globally eg. `setCookie`, `getCookie`, `callAPI` etc. we can just manually expose, which is what I've done.
- I got rid of those individual `wg` variables you had cached and created a single `mwConfig` object which we can reference values by doing, for example, `mwConfig.wgPageName`. Individually caching values like you were was quite messy and un-maintainable, and this way we can achieve the same effect without declaring all those variables.
- I did a bunch of general trivial cleanup all over the place, just making things cleaner.