User:Poke/GuildWarsWikiTools/GuildWiki Switch

From Guild Wars Wiki
Jump to navigationJump to search

This is a sub-project of Guild Wars Wiki Tools.

Guild Wars Wiki Code[edit]

 /**** Guild Wars Wiki Tools - GuildWiki Switch
  * (c) 2007 by Patrick Westerhoff [poke]
  */
 function gwwtGuildWikiSwitch ()
 {
   if ( wgNamespaceNumber < 100 )
   {
     var itemNode = document.createElement( 'li' );
     itemNode.appendChild( document.createElement( 'a' ) );
     itemNode.lastChild.href  = 'http://gw.gamewikis.org/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle );
     itemNode.lastChild.title = 'See this page on GuildWiki';
     itemNode.lastChild.appendChild( document.createTextNode( 'GWiki' ) );
     document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode );
   }
 }
 hookEvent( 'load', gwwtGuildWikiSwitch );

Or with GWWT installed:

 /**** Guild Wars Wiki Tools - GuildWiki Switch
  * (c) 2007 by Patrick Westerhoff [poke]
  */
 function gwwtGuildWikiSwitch ()
 {
   if ( wgNamespaceNumber < 100 )
   {
     url = 'http://gw.gamewikis.org/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle );
     new PortletArea( 'p-cactions' ).addItem( 'gwwt-gwiki', 'GWiki', url, 'See this page on GuildWiki' );
   }
 }
 gwwtLoadAfter = gwwtGuildWikiSwitch;

GuildWiki Code[edit]

 /**** Guild Wars Wiki Tools - GuildWiki Switch
  * (c) 2007 by Patrick Westerhoff [poke]
  */
 function gwwtGuildWikiSwitch ()
 {
   if ( wgNamespaceNumber < 100 )
   {
     var itemNode = document.createElement( 'li' );
     itemNode.appendChild( document.createElement( 'a' ) );
     itemNode.lastChild.href  = 'http://wiki.guildwars.com/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle );
     itemNode.lastChild.title = 'See this page on Guild Wars Wiki';
     itemNode.lastChild.appendChild( document.createTextNode( 'GWW' ) );
     document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode );
   }
 }
 hookEvent( 'load', gwwtGuildWikiSwitch );