Benutzer:WWWIG/monobook.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WWWIG (Diskussion | Beiträge) (+ Edit Script Teil 1a) |
WWWIG (Diskussion | Beiträge) (+ Edit Script Teil 1b) |
||
Zeile 21: | Zeile 21: | ||
function do_new_action() { | function do_new_action() { | ||
− | if ( document.getElementById( 'wpTextbox1' ).value.indexOf('{{Andere Sprachen|') != -1 ) { | + | if ( !document.getElementById( 'wpTextbox1' ) ) return; |
− | alert( 'Go' ); | + | 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_PositionStart + t_PositionEnd ); | ||
+ | |||
+ | alert( 'Go' + t_PositionStart + '/' + t_PositionEnd + '/' + t_Andere_Sprachen ); | ||
} | } | ||
} | } |
Version vom 27. Juli 2011, 06:13 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_PositionStart + t_PositionEnd ); alert( 'Go' + t_PositionStart + '/' + t_PositionEnd + '/' + t_Andere_Sprachen ); } }