User:Wynthyst/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]
  */
 addScript( 'User:Poke/GuildWarsWikiTools.js' );
 gwwtLoadAfter = function ()
 {
  if ( wgAction == 'rollback' && document.getElementById( 'rollback-success' ) != null )
  {
    window.location.href = wgServer + wgScript + '?title=' + wgPageName;
    return;
  }
  
  // Custom links
  var portNav = new PortletArea( 'p-navigation' );
  portNav.addText( 'My Wiki Links' );
  portNav.addItem( null, 'Inactive Guilds', '/wiki/Guild_Wars_Wiki:List_of_inactive_guilds' );
  portNav.addItem( null, 'Projects', '/wiki/Guild_Wars_Wiki:Projects' );
  portNav.addItem( null, 'Categories', '/wiki/Guild_Wars_Wiki:Categorical_index' );
  portNav.addItem( null, 'New Guild Pages', 'http://wiki.guildwars.com/index.php?title=Special%3ANewPages&namespace=100&username=' );
  portNav.addItem( null, 'New Feeser Pages', 'http://wiki.guildwars.com/wiki/Feedback:User/Recently_created_feedback_homepages' );
  clearRecentChanges();
 }
 
 function clearRecentChanges ()
 {
   if ( wgPageName !== 'Special:RecentChanges' )
     return false;
   
   var removeNames = [ 'Inspired', ];
   var removeWords = [ 'Ursan', 'ursan', ];
   
   var i, li, lis, xpath, remove = new Array();
   xpath  = '//div[@id="bodyContent"]//li[ ';
   xpath += 'contains( a[4]/@title, "' + removeNames.join( '" ) or contains( a[4]/@title, "' ) + '" ) or ';
   xpath += 'contains( a[1]/@title, "' + removeWords.join( '" ) or contains( a[1]/@title, "' ) + '" ) or ';
   xpath += 'contains( span[@class="comment"], "' + removeWords.join( '" ) or contains( span[@class="comment"], "' ) + '" ) ]';
   lis    = document.evaluate( xpath, document, null, 4, null );
   while( ( li = lis.iterateNext() ) )
   {
     remove.push( li );
   }
   while( ( li = remove.pop() ) )
   {
     li.parentNode.removeChild( li );
   }
 }

var gwwtWatchlist = true;

function contribCount ()
{
   if ( wgNamespaceNumber < 100 )
   {
     var itemNode = document.createElement( 'li' );
     itemNode.appendChild( document.createElement( 'a' ) );
     itemNode.lastChild.href  = 'javascript:addScript(\'User:Poke/GuildWarsWikiTools/ContributionCount.js\');void(0)';
     itemNode.lastChild.title = 'See this page on GuildWiki';
     itemNode.lastChild.appendChild( document.createTextNode( 'Cont' ) );
     document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode );
   }
 }
 hookEvent( 'load', contribCount);