MediaWiki:Gadget-MoveUtil.js: Difference between revisions
From Elwiki
mNo edit summary |
mNo edit summary |
||
Line 24: | Line 24: | ||
'contentmodel': 'wikitext', | 'contentmodel': 'wikitext', | ||
'appendtext': '\n* ' + from + ' -> ' + (ns == '' ? '' : ns + ':') + to | 'appendtext': '\n* ' + from + ' -> ' + (ns == '' ? '' : ns + ':') + to | ||
}).done(); | }).done(function(){ | ||
api.postWithToken('edit', { | |||
'minor': '', | |||
'recreate': '', | |||
'bot': '', | |||
'action': 'edit', | |||
'title': 'User:Boxsnake/MoveWatch', | |||
'summary': 'Bot Adding From Page Move. Pages linked to moved pages. --[[Special:Gadgets|Move Util]]', | |||
'contentmodel': 'wikitext', | |||
'appendtext': '\n{{:Special:WhatLinksHere/' + from + '}}' | |||
}); | |||
}); | |||
}); | }); | ||
} | } | ||
} | } |
Revision as of 02:05, 8 May 2015
if(wgNamespaceNumber == -1 && /MovePage(\/.+)?/.test(wgTitle)){
if($('#mw-movepage-table').length){
$('#wpMovetalk').attr('checked', 'checked');
$('#wpLeaveRedirect').removeAttr('checked');
$('#wpMovesubpages').attr('checked', 'checked');
/* Bind to Submit Event */
$('#movepage').submit(function(event){
var from, ns, to, api;
api = new mw.Api();
from = $('#mw-movepage-table strong').first().text();
ns = mw.config.get('wgFormatteNamespaces', wgFormattedNamespaces);
ns = ns[$('#wpNewTitleNs').val()];
to = $('#wpNewTitleMain').val();
/* Add Line in MoveList */
api.postWithToken('edit', {
'minor': '',
'recreate': '',
'bot': '',
'action': 'edit',
'title': 'User:Boxsnake/MoveList',
'summary': 'Bot Adding From Page Move. --[[Special:Gadgets|Move Util]]',
'contentmodel': 'wikitext',
'appendtext': '\n* ' + from + ' -> ' + (ns == '' ? '' : ns + ':') + to
}).done(function(){
api.postWithToken('edit', {
'minor': '',
'recreate': '',
'bot': '',
'action': 'edit',
'title': 'User:Boxsnake/MoveWatch',
'summary': 'Bot Adding From Page Move. Pages linked to moved pages. --[[Special:Gadgets|Move Util]]',
'contentmodel': 'wikitext',
'appendtext': '\n{{:Special:WhatLinksHere/' + from + '}}'
});
});
});
}
}