Last active
September 26, 2015 03:37
-
-
Save atomer/1032908 to your computer and use it in GitHub Desktop.
http://d.hatena.ne.jp/os0x/20090824/1251133041 にほんの少し手を加えた、UserScriptでwindowを取得するスニペット
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window, loaded){ | |
var win; | |
if (!loaded && this.chrome) { | |
var fn = '(' + arguments.callee.toString() + ')(this,true);'; | |
var script = document.createElement('script'); | |
script.appendChild(document.createTextNode(fn)); | |
document.body.appendChild(script); | |
return; | |
} else if (this.chrome) { | |
win = window; | |
} else { | |
win = unsafeWindow; | |
} | |
})(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((window, loaded) -> | |
if not loaded and @chrome | |
fn = '(' + arguments.callee.toString() + ')(this,true);' | |
script = document.createElement('script') | |
script.appendChild(document.createTextNode(fn)) | |
document.body.appendChild(script) | |
return | |
else if @chrome | |
win = window | |
else | |
win = unsafeWindow | |
)(window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment