User:Oxymoron83/aivreporthelper.js

// If TwinkleConfig aint exist. if( typeof( TwinkleConfig ) == 'undefined' ) { TwinkleConfig = {}; }

$(twinkleaivreporthelper); //Eintragungen auf VM function twinkleaivreporthelper { if ( (wgPageName == "Wikipedia:Administrator_intervention_against_vandalism") && (QueryString.get( 'aivhelper' ) ) ) { var vandal = QueryString.get( 'vandal' ); var article = QueryString.get( 'vanarticle' ).replace( /^(Image|Category):/i, ':$1:' );

if(vandal == wgUserName) { alert('You don\'t want to report yourself, do you?'); return; }

var text = document.getElementById( 'wpTextbox1' ).value; var re = new RegExp( "\\{\\{\\s*(?:(?:[Ii][Pp])?[Vv]andal|[Uu]serlinks)\\s*\\|\\s*(?:1=)?\\s*" + RegExp.escape( vandal, true ) + "\\s*\\}\\}" ); var myArr;

if( ( myArr = re.exec( text ) ) ) { return; }

var notice; if ( QueryString.exists('vanarticlerevid') && QueryString.exists('vanarticlegoodrevid') ) { var query = { 'title': article, 'diff': QueryString.get( 'vanarticlerevid' ), 'oldid': QueryString.get( 'vanarticlegoodrevid' ) };		notice = "On " + article + " ([" + mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?" + QueryString.create( query ) + " diff])"; }

if ( isIPAddress( vandal ) ) { notice = "* - " + notice + " vandalism after final warning" + " " + ""; } else { notice = "* - " + notice + "vandalism after final warning, actions evidently indicate a vandalism only account" + " " + ""; }

document.getElementById( 'wpTextbox1' ).value = text + notice; document.getElementById( 'wpSummary' ).value = "Reporting " + vandal + ""; if( TwinkleConfig.markAIVReportAsMinor ) { document.getElementById( 'wpMinoredit' ).checked = true; }	if( confirm( "Add " + vandal + " who vandalized " + article + "?" ) ) {	  document.getElementById('editform').submit; }

//window.setTimeout(function { window.close; }, 2000); } }