Content deleted Content added
Writ Keeper (talk | contribs) test |
Writ Keeper (talk | contribs) test |
||
Line 1:
{
mw.loader.using("mediawiki.api").done( function ()
{
$("#ca-closepeer>a").text("Closing...");
Line 7:
var talkPage = $("a:contains('Article talk')").attr("href");
var talkPageName = "";
if
{
talkPage = talkPage.match(/\/wiki\/(\w+:.+)/);
if
{
talkPageName = talkPage[1];
Line 16:
}
var api = new mw.Api();
api.edit(mw.config.get("wgPageName"), function
{
var regexResult = revision.content.match(/\{\{ *Peer review page *\| *topic *= *\w+ *\}\}/);
if
{
return {
text: revision.content.replace(regexResult[0], "{{Ombox|text='''This [[WP:PR|peer review]] discussion has been closed.'''}} <noinclude>[[Category:November 2018 peer reviews]]</noinclude>"),
summary: "Closing peer review due to inactivity (via [[User:Writ Keeper/Scripts/peerReviewCloser.js|peerReviewCloser.js]])"
};
Line 31 ⟶ 29:
else
{
mw.notify( 'Error updating the Peer Review page; article talk page might also require cleanup.', { title: 'Peer review closing error' } );
$("#ca-closepeer>a").text("error!");
return null;
}
}).done(function
{
api.edit(talkPageName, function
{
var regexResult = revision.content.match(/\{\{ *
if
{
return {
text: revision.content.replace(regexResult[0], "{{Old peer review" + regexResult[1] + "}}"),
summary: "Closing peer review due to inactivity (via [[User:Writ Keeper/Scripts/peerReviewCloser.js|peerReviewCloser.js]])"
};
}
else
{
mw.notify( 'Peer
$("#ca-closepeer>a").text("error!");
return null;
}
})
.done(function {
___location.reload();
Line 79 ⟶ 60:
}
mw.hook("wikipage.content").add(function ()▼
{
if
{
mw.loader.using("mediawiki.util").done( function ()
{
mw.util.addPortletLink('p-cactions', '#', "Close peer review", "ca-closepeer", "close this peer review");
$("#ca-closepeer").click(
{
event.preventDefault();
mw.loader.load( [ 'mediawiki.api.edit' ] ); //start loading, while the user is in the prompt
return closePeerReview();
});
|