Gaming
 
[Tecnobrat]

Tecnobrat 218 edits since April 18, 2007

218

User:Tecnobrat/wowwiki.js

From WoWWiki

Image:Icon-warning-22x22.png Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac)
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Konqueror: simply click the Reload button, or press F5
  • Opera users may need to completely clear the cache in Tools→Preferences.
/*
<pre>
*/

 addOnloadHook( function() {
  var googleSearch = document.getElementById('p-search').innerHTML.replace("Search", "Google Search");
  var wikiSearch = "<h5><label for='searchInput'>Wiki Search</label></h5><div id='searchBody' class='pBody'><form action='/index.php?title=Special:Search' id='searchform'><div><input id='searchInput' name='search' value='' type='text'><input name='go' class='searchButton' id='searchGoButton' value='Go' type='submit'>&nbsp;<input name='fulltext' class='searchButton' id='mw-searchButton' value='Search' type='submit'></div></form></div>";
  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 = "<h5>Personal tools</h5><div class='pBody'><ul><li id='pt-userpage'><a href='/User:Tecnobrat'>Tecnobrat</a></li><li id='pt-mytalk'><a href='/User_talk:Tecnobrat'>My talk</a></li><li id='pt-mycss'><a href='/User:Tecnobrat/wowwiki.css'>CSS</a></li><li id='pt-myjs'><a href='/User:Tecnobrat/wowwiki.js'>JS</a></li><li id='pt-preferences'><a href='/Special:Preferences'>My preferences</a></li><li id='pt-watchlist'><a href='/Special:Watchlist'>My watchlist</a></li><li id='pt-contributions'><a href='/Special:Contributions/Tecnobrat'>My contributions</a></li><li id='pt-logout'><a href='/Special:Userlogout'>Log out</a></li></ul></div>";

}

/* 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);

/*
</pre>
[[Category:User JS|Tecnobrat]]
[[Category:User:Tecnobrat]]
*/