MediaWiki:NiceEdit.js

$("#mw-revision-info").append($("", { id: "niiice", html: "Nice edit" }).on("click", function { niiice(wgRevisionId); })); $("#mw-diff-ntitle2").append($("", { id: "niiice", html: "Nice edit" }).on("click", function { niiice($("a[data-action=revision-link-after]").attr("href").split("oldid=")[1]); })); if (typeof wgRevisionId != "undefined" && wgCurRevisionId == wgRevisionId) $("#WikiaPageHeader h1").after($("", { id: "niiice", html: " Nice edit" }).on("click", function { niiice(wgRevisionId); }));

function niiice(revid) { if (typeof revid == "undefined") { console.log("No revid"); return; }   $.ajax({        type: "POST",        url: "/wikia.php?controller=ContributionAppreciation&method=appreciate",        data: {            "revision": revid,            "token": mw.user.tokens.get("editToken")        },        success: function(data) {            console.log("success");            console.log(data);            $("#niiice").html("Thanked");        }    }); }