„MediaWiki:Gadget-old-movepage.js“ – Versionsunterschied
Erscheinungsbild
Inhalt gelöscht Inhalt hinzugefügt
K fix gadget |
K nur was tuen, wenn Elemente da sind - Spezial:Verschieben ohne Seitenname hat beispielsweise keine |
||
Zeile 1: | Zeile 1: | ||
/* This scripts replaced the new scrolldown/input field ([[rev:110209]]) on the movepage with the old one */ |
/* This scripts replaced the new scrolldown/input field ([[rev:110209]]) on the movepage with the old one */ |
||
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) { |
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) { |
||
$( function () { |
|||
var wpNewTitleMain = $( '#wpNewTitleMain input' ); |
var wpNewTitleMain = $( '#wpNewTitleMain input' ); |
||
var wpNewTitleNs = $( '#wpNewTitleNs select' ); |
var wpNewTitleNs = $( '#wpNewTitleNs select' ); |
||
Zeile 7: | Zeile 7: | ||
return; |
return; |
||
} |
} |
||
mw.loader.using( [ 'mediawiki.special.movePage' ], function () { |
|||
//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() ]; |
||
var titleText = wpNewTitleMain.val(); |
|||
var preloadTitle = namespaceText !== '' ? namespaceText + ':' + titleText : titleText; |
var titleText = wpNewTitleMain.val(); |
||
var preloadTitle = namespaceText !== '' ? namespaceText + ':' + titleText : titleText; |
|||
var input = $( '<input name="wpNewTitle" size="60" type="text" id="wpNewTitle" />' ); |
var input = $( '<input name="wpNewTitle" size="60" type="text" id="wpNewTitle" />' ); |
||
input.val( preloadTitle ); //preload input with a title |
input.val( preloadTitle ); //preload input with a title |
||
input.get(0).attributes = wpNewTitleMain.get(0).attributes; // DOM copy of attributes |
input.get(0).attributes = wpNewTitleMain.get(0).attributes; // DOM copy of attributes |
||
wpNewTitleMain.replaceWith( input ); //replace the new input with the old |
wpNewTitleMain.replaceWith( input ); //replace the new input with the old |
||
wpNewTitleNs.parent().remove(); //the scroll down box |
wpNewTitleNs.parent().remove(); //the scroll down box |
||
$( '#new-movepage-hint' ).remove(); //remove hint to new function in [[MediaWiki:Movepagetext-noredirectfixer]] |
$( '#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 |
$( 'label[for="wpNewTitleMain"]' ).attr( 'for', 'wpNewTitle' ); //correct label for to new input |
||
}); |
|||
}); |
|||
} |
} |
Version vom 1. Mai 2017, 21:14 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 wpNewTitleMain = $( '#wpNewTitleMain input' );
var wpNewTitleNs = $( '#wpNewTitleNs select' );
if( !wpNewTitleMain.length || !wpNewTitleNs.length ) {
return;
}
mw.loader.using( [ 'mediawiki.special.movePage' ], function () {
//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
});
});
}