Benutzer:WWWIG/monobook.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WWWIG (Diskussion | Beiträge) (+ Edit Script Teil 1k) |
WWWIG (Diskussion | Beiträge) (+ Edit Script Teil 1l) |
||
| Zeile 23: | Zeile 23: | ||
if ( !document.getElementById( 'wpTextbox1' ) ) return; | if ( !document.getElementById( 'wpTextbox1' ) ) return; | ||
var t_Inhalt = document.getElementById( 'wpTextbox1' ).value; | var t_Inhalt = document.getElementById( 'wpTextbox1' ).value; | ||
| − | if ( ( | + | var t_Template = ''; |
| + | if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) { | ||
| + | t_Template = '{{Andere Sprachen|'; | ||
| + | } else | ||
| + | if ( t_Inhalt.indexOf('{{другие языки|') != -1 ) { | ||
| + | t_Template = '{{другие языки|'; | ||
| + | } else | ||
| + | if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) { | ||
| + | t_Template = '{{Andere Sprachen|'; | ||
| + | } else | ||
| + | if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) { | ||
| + | t_Template = '{{Andere Sprachen|'; | ||
| + | } else | ||
| + | if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) { | ||
| + | t_Template = '{{Andere Sprachen|'; | ||
| + | } | ||
| + | |||
| + | |||
| + | if ( ( t_PositionStart = t_Inhalt.indexOf( t_Template ) ) != -1 ) { | ||
t_PositionEnd = t_Inhalt.indexOf('}}', t_PositionStart ); | t_PositionEnd = t_Inhalt.indexOf('}}', t_PositionStart ); | ||
var t_Andere_Sprachen = t_Inhalt.slice( t_PositionStart, t_PositionEnd + 2 ); | var t_Andere_Sprachen = t_Inhalt.slice( t_PositionStart, t_PositionEnd + 2 ); | ||
Version vom 27. Juli 2011, 06:44 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;
var t_Template = '';
if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) {
t_Template = '{{Andere Sprachen|';
} else
if ( t_Inhalt.indexOf('{{другие языки|') != -1 ) {
t_Template = '{{другие языки|';
} else
if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) {
t_Template = '{{Andere Sprachen|';
} else
if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) {
t_Template = '{{Andere Sprachen|';
} else
if ( t_Inhalt.indexOf('{{Andere Sprachen|') != -1 ) {
t_Template = '{{Andere Sprachen|';
}
if ( ( t_PositionStart = t_Inhalt.indexOf( t_Template ) ) != -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, '' );
t_Andere_Sprachen = t_Andere_Sprachen.replace( '}}', '' );
var t_Interwikis = t_Andere_Sprachen.split("|[[");
var t_InterwikiAusgabe = '';
for (var i = 1; i < t_Interwikis.length; i++) {
t_Interwikis[i] = t_Interwikis[i].replace( ']]', '' );
var t_Interwiki = t_Interwikis[i].split("|");
if ( t_Interwiki[1] ) {
t_InterwikiAusgabe += '[[' + t_Interwiki[1] + ':' + t_Interwiki[0] + ']]\r\n';
}
}
t_Inhalt += t_InterwikiAusgabe;
// alert( 'Go' + t_InterwikiAusgabe );
document.getElementById( 'wpTextbox1' ).value = t_Inhalt;
}
}