User:MisterPepe/skill.js

// //tagging and redirecting function for skill icons by MisterPepe - sorry if it's messy, I did a rush job =P

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; }

function stripExtension(target) {  var period = target.indexOf('.'); if (period != -1) {      return target.substring(0, period); }  return target; }

function tagIcon {  if (document.title.indexOf("Editing ") != -1) {     if (document.URL.lastIndexOf("&fakeaction=icon") != -1) {        var loc = wgTitle; var addr = stripExtension(loc); var f = document.editform, t=f.wpTextbox1; t.value = t.value + "\n#redirect " + addr + "\n\n"; f.wpSummary.value = "Redirecting and tagging skill icon."; f.wpSave.click;

return; }  }   if (wgNamespaceNumber ==6) { addPortletLink("p-cactions', "http://wiki.guildwars.com/index.php?&action=edit&fakeaction=icon&title=" + title, "Skill Icon", "ca-icon", "Tag and redirect skill icon", "");  } } addOnloadHook(tagIcon); //