User:Tecnobrat/wowwiki.js

/*

addOnloadHook( function { var googleSearch = document.getElementById('p-search').innerHTML.replace("Search", "Google Search");  var wikiSearch = " Wiki Search    ";  document.getElementById("p-search").innerHTML = googleSearch + wikiSearch; });

/* changes the personal links (at the top) to include direct links to the customized CSS and JS pages */ function changePersonal { document.getElementById('p-personal').innerHTML = " Personal tools TecnobratMy talkCSS</a></li><a href='/User:Tecnobrat/wowwiki.js'>JS</a></li><a href='/Special:Preferences'>My preferences</a></li><a href='/Special:Watchlist'>My watchlist</a></li><a href='/Special:Contributions/Tecnobrat'>My contributions</a></li><a href='/Special:Userlogout'>Log out</a></li></ul> ";

}

/* adds some extra tabs to user pages */ /* Please leave the following line */ /* user:Where/usertabs */ addOnloadHook(function { var wgTitle = document.getElementsByTagName('h1')[0].firstChild.nodeValue;  if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history     return;  if (wgTitle.indexOf(':') == -1)  //must be in a namespace     return;  var wgServer = "http://www.wowwiki.com";  var wgCanonicalNamespace = wgTitle.slice(0,wgTitle.indexOf(':'));  wgTitle = wgTitle.slice(wgTitle.indexOf(':')+1, wgTitle.length);  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {     var username = encodeURIComponent( wgTitle );     addPortletLink("p-cactions", wgServer + "/Special:Contributions/" + username, "Contribs", "ca-contrib", "User contributions");     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=move&user=" + username, "Page moves", "ca-pagemoves", "Page moves by this user");     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=block&page=User:" + username, "Blocks received", "ca-blog", "Blocks received by this user"); addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2", "Userspace", "", "List of pages in this user's userspace"); addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=block&user=" + username, "Blocks given", "", "Blocks by this user"); addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=protect&user=" + username, "Protections", "", "Protections by this user"); addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=delete&user=" + username, "Deletions", "", "Deletions by this user"); } });

/* MW 1.10 addPortletLink function */

function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) { var node = document.getElementById(portlet); if ( !node ) return null; node = node.getElementsByTagName( "ul" )[0]; if ( !node ) return null;

var link = document.createElement( "a" ); link.appendChild( document.createTextNode( text ) ); link.href = href;

var item = document.createElement( "li" ); item.appendChild( link ); if ( id ) item.id = id;

if ( accesskey ) { link.setAttribute( "accesskey", accesskey ); tooltip += " ["+accesskey+"]"; }	if ( tooltip ) { link.setAttribute( "title", tooltip ); }	if ( accesskey && tooltip ) { updateTooltipAccessKeys( new Array( link ) ); }

if ( nextnode && nextnode.parentNode == node ) node.insertBefore( item, nextnode ); else node.appendChild( item ); // IE compatibility (?)

return item; }

/* does everything */ function doStuff { changePersonal; changeSearch; }

/* makes the page wait until it's loaded before it does everything, otherwise it won't be able to access the parts of the page which haven't loaded yet */ addOnloadHook(doStuff);

/*