$(document).ready(function()
{
$(".mw-thanks-thank-link").off("click");
$(".mw-thanks-thank-link").click(function()
{
if((typeof noThanksConfirm != "undefined" && noThanksConfirm) || confirm("Are you sure you want to thank the author of this edit?"))
{
var clickedThanksLink = this;
var postData = {rev : $(this).attr("data-revision-id"), token : mw.user.tokens.get( 'csrfToken' ), source : "script"};
$.post("/w/api.php?action=thank&format=json", postData, function(){
$(clickedThanksLink).replaceWith('<span class="mw-thanks-thanked">thanked</span>');
});
}
return false;
});
});