Skip to content

Instantly share code, notes, and snippets.

@pocotan001
Created August 31, 2011 14:19
Show Gist options
  • Save pocotan001/1183656 to your computer and use it in GitHub Desktop.
Save pocotan001/1183656 to your computer and use it in GitHub Desktop.
ブックマークレット: グローバル変数を一覧(alert,consoleに出力)
javascript:(function(){var d=document,f=d.createElement('iframe'),b=d.body,o={0:1,getInterface:1,GetWeakReference:1,console:1,loadFirebugConsole:1,_createFirebugConsole:1,_firebug:1,_FirebugCommandLine:1},c=typeof this.console!='undefined',r='';f.src=d.URL+'?';b.appendChild(f);var w=f.contentWindow;for(var i in this){if(!(i in w)&&!o[i]&&!/^script\d{13}$/.test(i)){r+=i+'\n';if(c)console.log(i+':',this[i]);}}b.removeChild(f);alert(r);})();
// Uncompressed
javascript:
(function(){
var d = document,
f = d.createElement('iframe'),
b = d.body,
o = {
0: 1,
getInterface: 1,
GetWeakReference: 1,
console: 1,
loadFirebugConsole: 1,
_createFirebugConsole: 1,
_firebug: 1,
_FirebugCommandLine: 1
},
c = typeof this.console != 'undefined',
r = '';
f.src = d.URL + '?';
b.appendChild(f);
var w = f.contentWindow;
for(var i in this){
if(!(i in w) && !o[i] && !/^script\d{13}$/.test(i)){
r += i + '\n';
if(c) console.log(i + ':', this[i]);
}
}
b.removeChild(f);
alert(r);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment