User:Bot ishmael/monaco.js

function addPortletLink2(portlet,href,text,id,tooltip,accesskey,nextnode) { var node=document.getElementById(portlet); if(!node)return null; alert("Found "+portlet+" node."); node=node.getElementsByTagName("ul")[0]; if(!node)return null; alert("Found ul node."); 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); return item; }

function addGWWSwitch {   var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink2('page_bar',      'http://wiki.guildwars.com/wiki/'+wgCanonicalNamespace+':'+encodeURIComponent(wgTitle),      'GWW', 'ca-gww', 'See this page on Guild Wars Wiki', 'g'); } addOnloadHook(addGWWSwitch);