MediaWiki:Gadget-old-movepage.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
/* 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.misc-authed-ooui' ], 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
  });
 });
}