Skip to content

Instantly share code, notes, and snippets.

@jwerle
Created June 4, 2014 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwerle/2cf04b444a1f468f088e to your computer and use it in GitHub Desktop.
Save jwerle/2cf04b444a1f468f088e to your computer and use it in GitHub Desktop.
function b (fn) {
var str = fn.toString();
var buf = "";
var ch = 0;
var len = str.length;
var i = 0;
var inBody = false;
while (len--) {
ch = str[i++];
if ('{' == ch) {
inBody = true;
continue;
}
if (inBody) {
if (len > 0) {
buf += ch;
continue;
} else {
break;
}
}
}
return buf;
}
function x () {
$(window).find('.foo').children('.bar').trigger('click');
console.log('I clicked some shit !');
}
console.log(b(x));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment