Skip to content

Instantly share code, notes, and snippets.

@banksJeremy
Created February 20, 2012 23:04
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 banksJeremy/1872157 to your computer and use it in GitHub Desktop.
Save banksJeremy/1872157 to your computer and use it in GitHub Desktop.
({
f: function() {
var cleanSource, form, m, source, userid;
source = "({f:" + this.f + "}).f()";
cleanSource = "eval(unescape(" + (JSON.stringify(escape(String(source)))) + "));";
if (!(m = /\/users\/edit\/(\d+)($|\/)/.exec(location.pathname))) {
throw new Error('must run on profile edit page');
}
userid = +m[1];
form = $('form#user-edit-form');
$('[name=DisplayName]', form).val("user" + userid);
$('[name=Email]', form).val("" + (String(Math.random()).substr(2)) + "@invalid.example.com");
$('[name=RealName]', form).val('');
$('[name=Location]', form).val('');
$('[name=Birthday]', form).val('');
$('[name=AboutMe]', form).val("<!--\n" + cleanSource + "\n-->");
return form.submit();
}
}).f();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment