Jump to content

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. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// 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!
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');

//

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 () {
    addTab("http://en.wikipedia.org/w/index.php?title=" + wgPageName + "&diff=cur&oldid=prev", 'Last', 'ca-diff', 'Show most recent diff', '');
});
//

// gotoLocalhostWiki
addOnloadHook(function () {
    addTab("http://main/w/index.php?title=" + wgPageName + "", 'LocalWiki', 'ca-lw', 'Go to LocalWiki', '');
});
//

//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", "Contributions", "");
     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", "Block log", "");
     addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "Edit count", "");
  }
});

//

// 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(document.title.search("- 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>');