User:Unused0025/monobook.js

//Add LI Link and Add Tab, renamed to prevent conflicts. To make installation easier //for people who haven't used User Scripts before.

function srtAddLILink(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 srtAddTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return srtAddLILink(tabs, url, name, id, title, key) }

$(function {  var spans = document.body.getElementsByTagName('span');  var i;  var a;  for(i in spans)  {    if(spans[i].className!=null)    if(spans[i].className.toLowerCase.indexOf("selfreference")!=-1)    {      //found a selfref      spans[i].style.display="none";      a=spans[i].getElementsByTagName("A");      if(a.length==0) break; //can't find a dablink      a=a[a.length-1]; //find last hyperlink in the selfref; this will probably be the dablink itself      srtAddTab(a.href,"WP","ca-dablink","WP","");      break; //in case of multiple selfrefs, just do one    }  } });