User:Color probe/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

// Script from [[User:MarkS/extraeditbuttons.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//<nowiki> Admin-like RC Patrol tools

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:VoA/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//</nowiki>[[Category:Wikipedians who use RC script ]]

//Back-up edit counter
//Visit [[User:Interiot/Tool2/code.js]] in emergencies!
document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

// 

//

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key);
}
//

//

//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510

// addLastDiff
addOnloadHook(function () {
    z=document.getElementById("content").childNodes;
    for (var n=0;n<z.length;n++) { 
      if (z[n].className=="firstHeading") {
        var pname=z[n].textContent;
      }
    }
    var l=addTab("http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", 'last', '');
    l.lastChild.title="Show most recent diff";
});
//

// gotoLocalhostWiki
addOnloadHook(function () {
    z=document.getElementById("content").childNodes;
    for (var n=0;n<z.length;n++) { 
      if (z[n].className=="firstHeading") {
        var pname=z[n].textContent;
      }
    }
    var l=addTab("http://localhost/wiki/index.php?title=" + pname + "", 'localhost', '');
    l.lastChild.title="Go to localhost wiki";
});
//

//Please leave the following line
//user:Where/usertabs

addOnloadHook(function() {
  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
     return;
  }
  if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {
     username_a = document.URL.match(/:.*:(.*)/);
     username=username_a[1];
     addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");
     addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");
     addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", "");
     addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");
  }
});

//

// Compare link

function fixCompare()
{
  var histForm=document.getElementsByTagName("form")[0];
  var finalButton=document.getElementById("historysubmit");
  var firstButton=histForm.getElementsByTagName("input")[1];
  histForm.removeChild(finalButton);
  histForm.removeChild(firstButton);
  var compareLink=document.createElement("a");
  var genLink="http://en.wikipedia.org/w/index.php?title=" + histForm.title.value + "&diff=" + histForm.diff[0].value + "&oldid=" + histForm.oldid[1].value;
  compareLink.setAttribute("href", genLink);
  compareLink.appendChild(document.createTextNode("Compare selected versions"));
  histForm.insertBefore(compareLink, document.getElementById("pagehistory"));
  var endLink=compareLink.cloneNode(true);
  histForm.appendChild(endLink);
  var diffList=document.getElementById("pagehistory");
  diffList.setAttribute("onchange", "updateCompare()");
}
function updateCompare()
{
  var histForm=document.getElementsByTagName("form")[0];
  var diffList=document.getElementById("pagehistory");
  var compareLink=diffList.previousSibling;
  var endLink=diffList.nextSibling;
  var oldInd=-1;
  var i=0;
  while(oldInd==-1 & i<histForm.oldid.length)
  {
    if(histForm.oldid[i].checked)
      oldInd=i;
    i++;
  }
  var diffInd=-1;
  var j=0;
  while(diffInd==-1 & j<histForm.diff.length)
  {
    if(histForm.diff[j].checked)
      diffInd=j;
    j++;
  }
var genLink="http://en.wikipedia.org/w/index.php?title=" + histForm.title.value + "&diff=" + histForm.diff[diffInd].value + "&oldid=" + histForm.oldid[oldInd].value;
  compareLink.setAttribute("href", genLink);
  endLink.setAttribute("href", genLink);
}
if(url.indexOf("action=history")!=-1)
addOnloadHook(fixCompare);
//

// Script from [[User:Cacycle/diff.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');