User:Writ Keeper/Scripts/oldSchoolThanks.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$(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;
	});
});