User:Wizardboy777/monobook.js

From Guild Wars Wiki
Jump to navigationJump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
 /**** Guild Wars Wiki Tools
  * (c) 2007 by Patrick Westerhoff [poke]
  */
 var gwwtPortletPos = 'p-search';
 var head = document.getElementsByTagName( 'head' )[0];
 head.appendChild( document.createElement( 'script' ) );
 head.lastChild.src  = '/index.php?title=User:Poke/GuildWarsWikiTools.js&action=raw&ctype=text/javascript';
 head.lastChild.type = 'text/javascript';

function addGwikiSwitch() 
{
    var hist; 
    var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    addPortletLink('p-cactions', 'http://www.guildwiki.org/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ),
                   'gwiki', 'ca-gwiki', 'See this page on GuildWiki');
    addPortletLink('p-cactions', 'http://guildwars.wikia.com/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ),
                   'wikia', 'ca-wikia', 'See this page on GuildWars@Wikia');
}
addOnloadHook(addGwikiSwitch);