User:SJP/monobook.js

importScript('User:AzaToth/morebits.js'); importScript('User:AzaToth/twinklefluff.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css'); importScript('User:AzaToth/twinklewarn.js'); importScript('User:AzaToth/twinklearv.js'); importScript('User:AzaToth/twinklespeedy.js'); importScript('User:AzaToth/twinklediff.js'); importScript('User:AzaToth/twinkleprotect.js');

importScript('User:AzaToth/twinklewarn.js');

$(twinklewarnauto);

//originally from User:DerHexer/rollback.js function twinklewarnauto { if ( ( wgNamespaceNumber == 3 ) && ( QueryString.exists( 'vanarticle' )) ) { if ( !isIPAddress (wgTitle) ) { document.getElementById("siteSub").firstChild.nodeValue = "- - - Keine automatische Warnung - Keine IP - - -"; return; }

document.editform.wpMinoredit.checked=true; if (document.getElementById( 'wpTextbox1' ).value == "" ) { if ( QueryString.get( 'vanarticle' ).slice(0, 5) == "User:" ) { if ( QueryString.get( 'type' ) == "vand" ) { spam("3", "Warning", 23 , 0); } else if ( QueryString.get( 'type' ) == "norm" ) { spam("2", "Caution", 22 , 0); } else { spam("1", "General note", 21, 0); }              } else { spam("1", "General note", 1, 0); }      } else { var now = new Date; var actual_time = now.getTime; var splitted = document.forms["editform"].wpTextbox1.value.split(" 432000000) || (!last_time)) {           //86400000 = 24 h, 432000000 = 5 d	        spam("2", "Caution", 2 , difftime); } else { if ( (splitted[splitted.length-1].search(/uw\-[^\d]*(\d)/) != -1) || (splitted[splitted.length-1].search(/Template\:Test/) != -1) || (splitted[splitted.length-1].search(/Template\:Blatantvandal/) != -1) || (splitted[splitted.length-1].search(/Uw\-bv/) != -1) ) { var matchedtemplate = splitted[splitted.length-1].match(/uw\-[^\d]*(\d)/); var matchednumber = RegExp.$1; var matchedtemplate2 = splitted[splitted.length-1].match(/Template\:Test(\d)/); var matchednumber2 = RegExp.$1; if ( (splitted[splitted.length-1].search(/Template\:Blatantvandal/) != -1) || (splitted[splitted.length-1].search(/Uw\-bv/) != -1) ) { matchednumber = 4; }               if (matchednumber < matchednumber2) { matchednumber = matchednumber2; }

if (difftime > 90000000) {     //90000000 = 25 h                    if ( (matchednumber == 4) && ( QueryString.get( 'type' ) == "norm" ) ) { matchednumber = 3; } if ( (matchednumber == 2) && ( QueryString.get( 'type' ) == "vand" ) ) { matchednumber = 3; } if (matchednumber == 4) { spam("4im", "Only warning", 14 , difftime); } else if (matchednumber == 3) { spam("3", "Warning", 13 , difftime); } else { spam("2", "Caution", 12 , difftime); }                } else { if (matchednumber == 4) { if ( difftime > 36000000 ) {    //36000000 = 10 h                             spam("4im", "Only warning", 5 , difftime); } else { //reports only in test status if (!wgUserName == "Oxymoron83") { document.getElementById("siteSub").firstChild.nodeValue = "- - - No automatic warning - Reached level 4 - - -"; return; } else { var meldenquery = { 'title': 'Wikipedia:Administrator intervention against vandalism', 'action': 'edit', 'section':'1', 'vanarticle': QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '', 'vandal': wgTitle, 'vanarticlerevid': QueryString.exists( 'vanarticlerevid' ) ? QueryString.get( 'vanarticlerevid' ) : '', 'vanarticlegoodrevid': QueryString.exists( 'vanarticlegoodrevid' ) ? QueryString.get( 'vanarticlegoodrevid' ) : '', //'type': type, //'count': QueryString.exists( 'count' ) ? QueryString.get( 'count' ) : '', 'aivhelper': true };                               window.open(mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( meldenquery ),'VM',''); }                         }             	     } else if (matchednumber == 3) { spam("4", "Final warning", 4 , difftime); } else { spam("3", "Warning", 3 , difftime); }                }              } else { spam("2", "Caution", 9, difftime); }        }       }    } }

function spam( Stufe, StufeSum, lognr, difftime2 ) { document.getElementById("siteSub").firstChild.nodeValue = "Message-ID: " + lognr; var text = document.getElementById( 'wpTextbox1' ).value; var date = new Date; var headerRe = new RegExp( "^==+\\s*" + date.getUTCMonthName + "\\s+" + date.getUTCFullYear + "\\s*==+", 'm' ); if( !headerRe.exec( text ) ) { text += "\n== " + date.getUTCMonthName + " " + date.getUTCFullYear + " ==\n"; }

switch( QueryString.get( 'type' ) ) { case 'vand': Art = "Vandalism"; Tmpl = "uw-vandalism"; break; case 'blank': Art = "Removal of content"; Tmpl = "uw-delete"; break; case 'source': Art = "Addition of unsourced material"; Tmpl = "uw-unsourced"; break; case 'spam': Art = "Adding spam links"; Tmpl = "uw-spam"; break; default: Art = "Editing tests"; Tmpl = "uw-test"; break; }

document.getElementById( 'wpTextbox1' ).value = text + "\n\{\{subst:" + Tmpl + Stufe + "|"+ QueryString.get( 'vanarticle' ) + "|subst=subst:\}\} --\~\~\~\~\n"; document.getElementById( 'wpSummary' ).value = StufeSum + ": " + Art + " on " + QueryString.get( 'vanarticle' ) + ""; document.editform.wpSave.click; }

/**** afd helper ****/ importScript('User:Jnothman/afd_helper/script.js');

/* This is to keep track of who is using this extension: User:Jnothman/afd_helper/script.js */