Hotfix for Tampermonkey compatibility.

See http://forum.tampermonkey.net/viewtopic.php?f=17&p=2223#p2223 for
initial bug report. Tampermonkey doesn't support Greasemonkey's `@grant
none` metadata so `window.*` variables can't be accessed and must still
use `unsafeWindow`.

Also added wrapper that includes `undefined` which made things more
simple.