Content deleted Content added
No edit summary |
m JJPMaster moved page User:JJPMaster/SuppressRedirect.js to User:JJPMaster/Scripts/SuppressRedirect.js: cleaning up my userspace |
||
(10 intermediate revisions by the same user not shown) | |||
Line 3:
return false;
}
// mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3AJJPMaster%2Fusefulvars.js&action=raw&ctype=text/javascript'); // [[User:JJPMaster/usefulvars.js]]
$(() => {
if (mw.config.get("wgArticleId") !== 0) {
$("#bodyContent").append(`▼
var porty = mw.util.addPortletLink('p-cactions', '#', 'Suppress redirect', 'pt-supp', 'Move and suppress the redirect');
<div id="suppressRedirectDialog">▼
ad = "(using [[w:en:User:JJPMaster/SuppressRedirect|SuppressRedirect]])";
Why do you want to suppress this redirect?▼
<select name="criterion" id="PMRcriterion">▼
▲ Why do you want to suppress this redirect?
<option>Reverting page move vandalism ([[WP:PMRC#1]])</option>▼
▲ <select name="criterion" id="PMRcriterion">
<option>
<option>
<option>
<option>Moving pages from
<option>
<option>
<option>
▲ <option>
</select><br />▼
<option>Moving editnotice to subpage of [[Template:Editnotices]] ([[w:en:WP:PMRC#8]])</option>
<input type="text" id="toMoveTitle" name="toMoveTitle" /><label for="toMoveTitle">The title the page will be moved to</label><br />▼
<input type="checkbox" id="moveSubpages" name="moveSubpages" checked /><label for="moveSubpages">Move subpages</label><br />▼
▲ </select><br />
<
▲ <input type="checkbox" class="subpageonly" id="moveSubpages" name="moveSubpages" checked /><label class="subpageonly" for="moveSubpages">Move subpages</label><br />
</div>▼
▲ <input type="
`);▼
<button type="button" id="moveForReal">Move page and suppress redirect</button>
var critValue = document.getElementById("PMRcriterion").value;▼
▲ </div>
var criterion;▼
▲ if(critValue !== "Redirect would meet a criterion for speedy deletion ([[WP:PMRC#9]])")
criterion = critValue;▼
$(porty).click(() => $("#suppressRedirectDialog").dialog());
else {▼
var innerCrit = prompt("What criterion?");▼
if(innerCrit)▼
criterion = `Redirect would meet criterion [[WP:CSD#${innerCrit}|${innerCrit}]] for speedy deletion ([[WP:PMRC#9]])`;▼
if(critValue !== "Redirect would meet a criterion for speedy deletion ([[w:en:WP:PMRC#9]])")
else criterion = critValue;▼
▲ criterion = critValue;
▲ var innerCrit = prompt("What criterion?");
▲ if(innerCrit)
▲ criterion = `Redirect would meet criterion [[WP:CSD#${innerCrit.toUpperCase()}|${innerCrit.toUpperCase()}]] for speedy deletion ([[w:en:WP:PMRC#9]])`;
▲ else criterion = critValue;
var params = {▼
action: 'move',▼
from: mw.config.get("wgPageName"),▼
to: document.getElementById("toMoveTitle").value,▼
reason: criterion + " " + ad,▼
movetalk: checkToBoolean(document.getElementById("moveTalk").value),▼
movesubpages: checkToBoolean(document.getElementById("moveSubpages").value),▼
noredirect: true,▼
format: 'json'▼
api = new mw.Api();▼
api.postWithToken( 'csrf', params ).done( function ( data ) {▼
console.log( data );▼
window.___location.href = mw.config.get("wgArticlePath").replace("$1", "") + document.getElementById("toMoveTitle").value;
});
}
▲ $("#suppressRedirectDialog").dialog();
▲ $("moveForReal").click(function() {
▲ var params = {
▲ action: 'move',
▲ from: mw.config.get("wgPageName"),
▲ to: document.getElementById("toMoveTitle").value,
▲ reason: criterion,
▲ movetalk: checkToBoolean(document.getElementById("moveTalk").value),
▲ movesubpages: checkToBoolean(document.getElementById("moveSubpages").value),
▲ noredirect: true,
▲ format: 'json'
▲ },
▲ api = new mw.Api();
▲ api.postWithToken( 'csrf', params ).done( function ( data ) {
▲ console.log( data );
▲ } );
▲ });
});
|