/* This scripts replaced the new scrolldown/input field (]) on the movepage with the old one */
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) {
$( function () {
var wpNewTitle = $( '#wpNewTitle' );
if( !wpNewTitle.length ) {
return;
}
mw.loader.using( , function () {
OO.ui.infuse( $( '#wpNewTitle' ) ); // Make sure that the widget is already infused before changing
var wpNewTitleMain = $( '#wpNewTitleMain input' );
var wpNewTitleNs = $( '#wpNewTitleNs select' );
if( !wpNewTitleMain.length || !wpNewTitleNs.length ) {
return;
}
//build the title from the scrolldown
var namespaceText = mw.config.get( 'wgFormattedNamespaces' );
var titleText = wpNewTitleMain.val();
var preloadTitle = namespaceText !== '' ? namespaceText + ':' + titleText : titleText;
var input = $( '<input name="wpNewTitle" size="60" type="text" id="wpNewTitle" />' );
input.val( preloadTitle ); //preload input with a title
input.get(0).attributes = wpNewTitleMain.get(0).attributes; // DOM copy of attributes
wpNewTitleMain.replaceWith( input ); //replace the new input with the old
wpNewTitleNs.parent().remove(); //the scroll down box
$( '#new-movepage-hint' ).remove(); //remove hint to new function in ]
$( 'label' ).attr( 'for', 'wpNewTitle' ); //correct label for to new input
});
});
}