„MediaWiki:Gadget-old-movepage.js“ – Versionsunterschied
Erscheinungsbild
Inhalt gelöscht Inhalt hinzugefügt
K nur was tuen, wenn Elemente da sind - Spezial:Verschieben ohne Seitenname hat beispielsweise keine |
K https://de.wikipedia.org/w/index.php?title=MediaWiki_Diskussion:Gadget-old-movepage.js&oldid=165149614#Gadget_funktioniert_nicht |
||
Zeile 2: | Zeile 2: | ||
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) { |
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) { |
||
$( function () { |
$( function () { |
||
var |
var wpNewTitle = $( '#wpNewTitle' ); |
||
if( !wpNewTitle.length ) { |
|||
⚫ | |||
⚫ | |||
return; |
return; |
||
} |
} |
||
mw.loader.using( [ 'mediawiki.special.movePage' ], function () { |
mw.loader.using( [ 'mediawiki.special.movePage' ], function () { |
||
OO.ui.infuse( 'wpNewTitle' ); // Make sure that the widget is already infused before changing |
|||
var wpNewTitleMain = $( '#wpNewTitleMain input' ); |
|||
⚫ | |||
⚫ | |||
return; |
|||
} |
|||
//build the title from the scrolldown |
//build the title from the scrolldown |
||
var namespaceText = mw.config.get( 'wgFormattedNamespaces' )[ wpNewTitleNs.val() ]; |
var namespaceText = mw.config.get( 'wgFormattedNamespaces' )[ wpNewTitleNs.val() ]; |
Version vom 4. Mai 2017, 18:56 Uhr
/* This scripts replaced the new scrolldown/input field ([[rev:110209]]) on the movepage with the old one */
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) {
$( function () {
var wpNewTitle = $( '#wpNewTitle' );
if( !wpNewTitle.length ) {
return;
}
mw.loader.using( [ 'mediawiki.special.movePage' ], 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' )[ wpNewTitleNs.val() ];
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 [[MediaWiki:Movepagetext-noredirectfixer]]
$( 'label[for="wpNewTitleMain"]' ).attr( 'for', 'wpNewTitle' ); //correct label for to new input
});
});
}