Benutzer:WWWIG/monobook.js: Unterschied zwischen den Versionen

Aus Watch-Wiki
Zur Navigation springen Zur Suche springen
(+ Edit Script Teil 1e)
(+ Edit Script Teil 1f)
Zeile 33: Zeile 33:
 
       document.getElementById( 'wpTextbox1' ).value = t_Inhalt;
 
       document.getElementById( 'wpTextbox1' ).value = t_Inhalt;
  
       alert( 'Go' + t_PositionStart + '/' + t_PositionEnd + '/' + t_Andere_Sprachen );
+
       var t_Interwikis = t_Andere_Sprachen.split("|");
 +
 
 +
      for (var i = 1; i < t_Interwikis.length; i++) {
 +
          t_InterwikiAusgabe += '/' + t_Interwikis[i];
 +
      }
 +
 
 +
      alert( 'Go' + t_Interwikis[1] + t_InterwikiAusgabe );
 
   }
 
   }
 
}
 
}

Version vom 27. Juli 2011, 07:25 Uhr

/* -- */
// my_vkdebug = true;

importScript('MediaWiki:Gadget-CheckRCForm.js');
importScript('MediaWiki:Gadget-CatGenRepairForm.js');

if ( wgAction=="edit" &&
     wgNamespaceNumber==0 )
addOnloadHook(function() {
 
   if ( t_Position = document.getElementById( 'firstHeading' ) ) {
 
      var t_NewElement = document.createElement('input');
      t_NewElement.setAttribute( 'id', 'mw-new-element' );
      t_NewElement.setAttribute( 'type', 'button' );
      t_NewElement.setAttribute( 'onclick', 'do_new_action();' );
 
      t_Position.appendChild( t_NewElement );
   }
});

function do_new_action() {
   if ( !document.getElementById( 'wpTextbox1' ) ) return;
   var t_Inhalt = document.getElementById( 'wpTextbox1' ).value;
   if ( ( t_PositionStart = t_Inhalt.indexOf('{{Andere Sprachen|') ) != -1 ) {
      t_PositionEnd = t_Inhalt.indexOf('}}', t_PositionStart );
      var t_Andere_Sprachen = t_Inhalt.slice( t_PositionStart, t_PositionEnd + 2 );

      t_Inhalt = t_Inhalt.replace( t_Andere_Sprachen + "\r\n", "" );
      t_Inhalt = t_Inhalt.replace( t_Andere_Sprachen + "\r", "" );
      t_Inhalt = t_Inhalt.replace( t_Andere_Sprachen + "\n", "" );
      t_Inhalt = t_Inhalt.replace( t_Andere_Sprachen, "" );
      document.getElementById( 'wpTextbox1' ).value = t_Inhalt;

      var t_Interwikis = t_Andere_Sprachen.split("|");

      for (var i = 1; i < t_Interwikis.length; i++) {
          t_InterwikiAusgabe += '/' + t_Interwikis[i];
      }
  
      alert( 'Go' + t_Interwikis[1] + t_InterwikiAusgabe );
   }
}