Content deleted Content added
←Created page with 'var redirectPageName = prompt("What page would you like to redirect this to?"); if (redirectPageName) { var params = { action: "edit", title: mw.config.get("wgPageName"), text: `#REDIRECT [[${redirectPageName}]]`, summary: "Redirected with User:JJPMaster/quickredirect.js" }; } else return;' Tag: Disambiguation links added |
to redirect to the redirect |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1:
mw.util.addPortletLink(
var redirectPageName = prompt("What page would you like to redirect this to?");▼
'p-cactions', '#',
if (redirectPageName) {▼
'Redirect', 'pt-redirect', 'Create a redirect from this page'
);
$('#pt-redirect').click(() => {
▲ var redirectPageName = prompt("What page would you like to redirect this to?");
▲ if (redirectPageName) {
var params = {
action: "edit",
title: mw.config.get("wgPageName"),
text: `#REDIRECT [[${redirectPageName}]]`,
summary: "Redirected with [[
api = new mw.Api();
}▼
else return;▼
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
window.___location.href = mw.util.getUrl(mw.config.get("wgPageName"), { redirect: 'no' });
} );
▲ }
▲ else return;
})
|