User:Writ Keeper/Scripts/peerReviewCloser.js: Difference between revisions

Content deleted Content added
fx
fx
Line 4:
{
$("#ca-closepeer>a").text("closing...");
$("#ca-closepeer>a").off("click");
var talkPage = $("a:contains('Article talk')").attr("href");
var talkPageName = "";
Line 19:
api.edit(talkPageName, function(revision)
{
var regexResult = revision.content.match(/\{\{ *Peer review *(\| *archive *= *\d+) *\}\}/);
if(regexResult != null && typeof regexResult[1] != "undefined")
{
return {
text: revision.content.replace("{{peer review" + regexResult[10] + "}}", "{{Old peer review" + regexResult[1] + "}}"),
summary: "Closing peer review"
};
Line 37:
api.edit(mw.config.get("wgPageName"), function(revision)
{
var regexResult = revision.content.match(/\{\{ *Peer review page *\| *topic *= *\w+ *\}\}/);
if(regexResult != null)
{
return {
text: revision.content.replace(/\{\{Peer review page\|topic=\w+\}\}/regexResult[0], "{{Ombox|text='''This [[WP:PR|peer review]] discussion has been closed.'''}} <noinclude>[[Category:November 2018 peer reviews]]</noinclude>"),
summary: "Closing peer review"
};
Line 47:
else
{
alert("Error updating the Peer Review page; article talk page might require cleanup.");
$("#ca-closepeer>a").text("error!");
return null;