User:DannyS712 test/move.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:DannyS712 test/move. |
mw.loader.using( 'mediawiki.util', function () {
$(document).ready( function () {
if ( $('.ambox-move > tbody > tr').length > -1 ){
var row = $('.ambox-move > tbody > tr')[0];
var noticeText = row.children[1].innerText;
var target = noticeText.replace(/It has been requested that the title of this article be changed to |\. Please see the relevant discussion. The page should not be moved unless the discussion is closed; summarizing the consensus achieved in support of the move\./g, '');
target = target.replace(/A request that this article title be changed to | is under discussion\. Please do not move this article until the discussion is closed\./g, '');
target = encodeURIComponent( target );
console.log( 'MOVE', row, noticeText, target );
var current = mw.config.get('wgPageName');
var link = '<td><a href=/w/index.php?title=Special:MovePage&wpOldTitle=' + current + '&wpNewTitle=' + target + '&wpMovetalk=1&wpMovesubpages=1>Move</a></td>';
$(row).append( $(link) );
console.log( link );
}
} );
} );