Skip to content

Instantly share code, notes, and snippets.

@joahg
Created November 26, 2013 17:19
Show Gist options
  • Save joahg/7662276 to your computer and use it in GitHub Desktop.
Save joahg/7662276 to your computer and use it in GitHub Desktop.
The magic behind JoahG/cc-ban_chrome-extension.
(function () {
if (typeof (CCDATA) === 'undefined' || typeof (CCDATA.page.user) === 'undefined' || typeof (CCDATA.page.user.id) === 'undefined') {
alert("Insufficient Data. Please try again on a valid Codecademy User page.");
return false;
} else {
$("body").append("<form action='/admin/forums/ban_user?user_identifier=" + CCDATA.page.user.id + "' class='button_to' method='post'><div><input name='_method' type='hidden' value='put' class='ui-inited'><input data-confirm='Are you sure you want to ban this user from the forums?' type='submit' id='BAN_FORM_SUBMIT' class='ui-inited'><input name='authenticity_token' type='hidden' value='" + csrf_token + "' class='ui-inited'></div></form>");
$("#BAN_FORM_SUBMIT").click()
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment