Zum Inhalt springen

„MediaWiki:Gadget-old-movepage.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Inhalt gelöscht Inhalt hinzugefügt
K preloadTitle aus wpNewTitleMain und wpNewTitleNs zusammenbauen
K -using 'mediawiki.special.movePage'
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() {
/* mediawiki.special.movePage sets bytelimits to some fields, which gets -1 in some cases */
mw.loader.using( 'mediawiki.special.movePage', function() { $( function() {
var wpNewTitleMain = $( '#wpNewTitleMain' );
var wpNewTitleMain = $( '#wpNewTitleMain' );
var wpNewTitleNs = $( '#wpNewTitleNs' );
var wpNewTitleNs = $( '#wpNewTitleNs' );
Zeile 17: Zeile 16:
wpNewTitleNs.remove(); //the scroll down box
wpNewTitleNs.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]]
})});
});
}
}

Version vom 2. Mai 2012, 19:34 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' );
  var wpNewTitleNs = $( '#wpNewTitleNs' );
  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
  wpNewTitleMain.replaceWith( input ); //replace the new input with the old
  wpNewTitleNs.remove(); //the scroll down box
  $( '#new-movepage-hint' ).remove(); //remove hint to new function in [[MediaWiki:Movepagetext-noredirectfixer]]
 });
}