User:Fusionmix/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
importScript('User:AWeenieMan/furme.js');
 
importScript("User:Lupin/recent2.js");
 
importScript('User:Ioeth/friendly.js');
 
// [[User:Lupin/popups.js]]   
 importScript('User:Lupin/popups.js');
 
 popupRevertSummaryPrompt=true;
 popupQueriedRevertSummary="Revert to revision dated $2 by [[User:$3|$3]] ([[User_talk:$3|talk]]) using [[:en:Wikipedia:Tools/Navigation_popups|popups]] ([[WP:VAND|vandalism]])"
 
  importScript('User:AzaToth/morebits.js');
  importScript('User:Oxymoron83/twinklefluff.js');
  importScript('User:Oxymoron83/twinklewarnauto.js');
  importScript('User:AzaToth/twinklearv.js');
  importScript('User:Oxymoron83/aivreporthelper.js');
  importScript('User:AzaToth/twinklespeedy.js');
  importScript('User:AzaToth/twinkleimage.js');
  importScript('User:AzaToth/twinklediff.js');
  importScript('User:AzaToth/twinkleprotect.js');
  importScript('User:AzaToth/twinkleprod.js');
  importScript('User:AzaToth/twinklexfd.js');
  importScript('User:AzaToth/twinklesalt.js');
 
 TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'window',
        showSharedIPNotice              :       false,
        openTalkPage                    :       [ 'agf', 'norm', 'vand', 'blank', 'source', 'spam' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       "",
        deletionSummaryAd               :       "",
        protectionSummaryAd             :       "",
        watchWarnings                   :       false,
        watchSpeedyPages                :       [ 'g1', 'g10' ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g3', 'g8', 'g10', 'g11', 'g12', 'a1', 'a3', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev', 'blank', 'source', 'spam' ],
        deleteTalkPageOnDelete          :       false,
        markWarningsAsMinor             :       true,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       true,
        markProdPagesAsMinor            :       true,
        confirmUsernameToAIV            :       true,
        offerReasonOnNormalRevert       :       false,
        orphanBacklinksOnSpeedyDelete   :       {orphan:false}
};
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Invitatious/unsigned2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
// [[User:Jsimlo/shortcuts.js]]
 document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Jsimlo/shortcuts.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 function shortcutsInit ()
 {
      shortcutsStartSection ( 'Workstation' );
      //shortcutsAddLink ('Navigation shortcuts', 'Wikipedia:Tools/Navigation shortcuts');
      shortcutsAddLink ( 'Links', 'User:Oxymoron83/Workstation' );
 }
 
// importScript('User:Ais523 non-admin/adminrights.js'); //Admin highlighter
 
 // get URL parameters (used for page type variables)
 var UrlParameters = new Array ();
 readparams();
 
 function readparams() {
  var asReadInUrlParameters;
  var asReadInUrlParameter;
 
  // Get URL parameters
  asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
  for (i = 0; i < asReadInUrlParameters.length; i++) {
    asReadInUrlParameter = asReadInUrlParameters[i].split("=");
    UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
  }
 }
 
 if(!usersignature) var usersignature = '\~\~\~\~'         //standard signature
 if(!levelthreewarning) var levelthreewarning = false;
 
 function fillActionPage() {
   if (UrlParameters["diff"] > "") {
     function searchRollbackLink() {
       var tds = document.getElementsByTagName("td");
       for (var i=0; i<tds.length; i++) {
         var td = tds[i]; 
         if (td.className != "diff-ntitle") continue;
         var as = td.getElementsByTagName("a");
         for (var j=0; j<as.length; j++) {
           var a = as[j];
           if (!/.*action=rollback.*/(a.href)) continue;
           var newlink = document.createElement('a');
           a.setAttribute('accesskey', "s");
           newlink.setAttribute('href', a.href);
           var EditTextNode = document.createTextNode("normal rollback");
           newlink.appendChild(EditTextNode);
           as[j].parentNode.insertBefore( newlink, as[j].nextSibling );
           as[j].parentNode.insertBefore( document.createTextNode(' | '), as[j].nextSibling );
           return a;
         }
       }
       return tds;
     }
 
     function RollAndSpam(rolluri) {
       location.href = rolluri;
       var backrolled = rolluri.split("from=")[1].split("&token=")[0];
       var vandalizedpage = wgPageName;
       var uri = "http://en.wikipedia.org/w/index.php?title=User talk:" + backrolled + "&vandalizedpage=" + vandalizedpage + "&action=edit&spam=1";
       window.setTimeout(function() { location.href = uri; }, 500);
     }
     var revlink = searchRollbackLink();
     revlink.onclick = function() { RollAndSpam(revlink.href); return false; }
   }
   if ( (UrlParameters["spam"] > "") && (UrlParameters["vandalizedpage"] > "") ) {
       document.editform.wpMinoredit.checked=true;
       var splitted = document.forms["editform"].wpTextbox1.value.split("<!--");
       var lastsplitted = splitted[splitted.length-1];
       var now = new Date();
       var actual_time = now.getTime();
       var last_time = lastsplitted.match(/([\:\d]+)\, (\d+) ([^\d]+) (\d+)/);
       var last_timestamp = Date.parse(RegExp.$2 + " " + RegExp.$3 + " " + RegExp.$4 + " " + RegExp.$1 + ":00 GMT");
       var difftime = last_timestamp + 86400000 - actual_time;
       var matchedtemplate = lastsplitted.match(/uw\-([^\d]*)(\d)/);
       var matchedtemplatename = RegExp.$1;
       var matchednumber = RegExp.$2;
       var matchedtemplate2 = lastsplitted.match(/Template\:Test(\d)/);
       var matchednumber2 = RegExp.$1;
       if (lastsplitted.search(/Uw\-Blank(\d)/) != -1) {
         var matchednumber = RegExp.$1;
         var matchedtemplatename = 'vandalism';
       } else if (lastsplitted.search(/Uw\-Blank[^\d]/) != -1) {
         var matchednumber = 1;
         var matchedtemplatename = 'vandalism';
       }
       if ((lastsplitted.search(/Uw\-bv/) != -1) || (lastsplitted.search(/Blatantvandal/) != -1)) {
         var matchednumber = 4;
         var matchedtemplatename = 'vandalism';
       }
       if ((!matchedtemplatename) || (matchedtemplatename == 'cluebotwarning') || (matchedtemplatename == 'w/index.php?title=') || (matchedtemplatename == 'block') || (difftime < 0) || (matchedtemplatename.search(/\d/) != -1)) { 
         var matchedtemplatename = 'vandalism';
       }
       if ((document.forms["editform"].wpTextbox1.value == "") || (!last_time)) {
         document.editform.wpSummary.value = "Caution: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
         document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\{\{subst\:uw-" + matchedtemplatename + "2\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
         document.editform.wpSave.click();
         window.setTimeout(function() { window.close(); }, 750);
       } else {
         if (difftime < 0) {
           document.editform.wpSummary.value = "Caution: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
           document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-" + matchedtemplatename + "2\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
           document.editform.wpSave.click();
           window.setTimeout(function() { window.close(); }, 750);
         } else {
             if ((matchednumber == 4) || (matchednumber2 == 4)) {
               var reporturl = "http://en.wikipedia.org/w/index.php?title=Wikipedia:Administrator_intervention_against_vandalism&action=edit&addreporteduser=" + wgTitle + "&addreportedarticle=" + UrlParameters["vandalizedpage"];
               window.setTimeout(function() { location.href = reporturl; }, 750);
             } else if ((!levelthreewarning) || (matchednumber == 3) || (matchednumber2 == 3)) {
               document.editform.wpSummary.value = "Final warning: Vandalism on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
               document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-vandalism4\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
               document.editform.wpSave.click();
               window.setTimeout(function() { window.close(); }, 750);
             } else {
               document.editform.wpSummary.value = "Warning: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
               document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-" + matchedtemplatename + "3\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
               document.editform.wpSave.click();
               window.setTimeout(function() { window.close(); }, 750);
             }
         }
       }
   }
   if ((UrlParameters["addreporteduser"] > '') && (UrlParameters["addreportedarticle"] > '')) {
     if (document.forms["editform"].wpTextbox1.value.search(new RegExp(UrlParameters["addreporteduser"]))==-1) {
       document.editform.wpMinoredit.checked=true;
       document.editform.wpSummary.value = "Reporting [[Special:Contributions/" + UrlParameters["addreporteduser"] + "|" + UrlParameters["addreporteduser"] + "]].";
       document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "*{{IPvandal|" + UrlParameters["addreporteduser"] + "}} – On [[" + UrlParameters["addreportedarticle"].replace(/\_/g, ' ') + "]]; vandalism after final warning " + usersignature;
       document.editform.wpSave.click();
     } else {
       window.close();
     }
   }
 }
 
 if ( (UrlParameters["diff"] > "") || ( (UrlParameters["spam"] > "") && (UrlParameters["vandalizedpage"] > "") ) || ( (UrlParameters["addreporteduser"] > '') && (UrlParameters["addreportedarticle"] > '') ) ) {
   addOnloadHook(fillActionPage);
 }