Prefer window to require(), export to all available outputs.

Summary:
Now that we're using `require()` in the browser, it's no longer safe to assume
that if `module.exports` is present, that we don't still want the variable to be
exported to the Socrates namespace.

This will prefer to retrieve variables from the global namespace if they're
present, and will export to both `module.exports` and `Socrates` if they're both
present.

Test Plan: See test plan on {D5605}

Reviewers: mattfaus

Reviewed By: mattfaus

CC: desmond

Differential Revision: http://phabricator.khanacademy.org/D5603