Content deleted Content added
No edit summary |
fix depreciated RMT regex |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1:
//<nowiki>
$('<br><button class="closeButton">Close</button><button class="relistButton">Relist</button>').insertBefore('.tmbox-move');
$('<button class="rmTechButton">Raise Technical Move request</button>').insertBefore('. var url = window.___location.href.match(/Talk.*$/gm).toString().replace(/_/g, ' ');
Line 8 ⟶ 9:
console.log(url);
$('.closeButton').click(function(){
queryPage(function(result){
api.get( queryParams(url) ).done( function ( data ) {▼
var page;▼
for (page in data.query.pages){▼
result = data.query.pages[page].revisions[0]['*'];▼
section = section + '\n{{subst:RM bottom}}\n';
▲ sectionLog = result.split("==");
▲ for(let i = 0; i < sectionLog.length; i++){
▲ if(sectionLog[i].match(/Requested move \d/gm) && sectionLog[i+1].match(/{{requested move.*/g)){
}▼
▲ var closeMSG = window.prompt("Close Message : ");
▲ var updatedSection;
}▼
▲ else{
▲ updatedSection = section.replace(/{{requested move.*/g,'{{subst:RM top|' + closeMSG + '|nac=yes}}');
result = result.replace(sectionLog[i+1], updatedSection);▼
console.log(result);▼
editPage(url, result, 'Closed');▼
}
}
}
}
});
$('.relistButton').click(function(){
console.log("Relisted");
Line 49 ⟶ 46:
result = result.replace(section, updatedSection);
console.log(result);
editPage(url, result, 'Relisted');
}
else{
Line 63 ⟶ 60:
$('.rmTechButton').click(function(){
queryPage(function(result){
sectionLog = result.split("==");
var section = sectionLog[i+1];
▲ for(let i = 0; i < sectionLog.length; i++){
▲ if(sectionLog[i].match(/Requested move \d/gm)){
▲ var section = sectionLog[i+1];
▲ var moveFrom = window.prompt("Enter Move Source : ");
▲
▲ var reason = window.prompt("Request reason : ");
▲ var techReq = '{{subst:RMassist|'+ moveFrom +'|' + moveTo + '|reason=' + reason + '}}';
api2.get( queryParams('Wikipedia:Requested moves/Technical requests') ).done( function ( data ) {▼
▲
▲ var newMatch = result2.match(/Uncontro.*====\n.*>\n<!--.*/gm).toString() + '\n' + techReq;
▲ }
▲ result2 = result2.replace(/Uncontro.*====\n.*>\n<!--.*/gm, newMatch);
▲ console.log(result2);
▲ });
▲ }
}
}
}
});
|