User:Mini Me/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 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';
 var gwwtWatchlist  = true;

 
 /*  Change the Quick links-link to the compact list instead  */
 hookEvent('load', function() {
     var e = document.getElementById('n-Quick-links');
 
     if (e)
         e.firstChild.href = '/wiki/Quick_access_links/compact';
 });

// adds a 'block logs for this user' link to the toolbox bar
// if the page is not in the User namespace, then no link is displayed; the link may display in the mainspace, but should not work
// should on be used on a person's userpage

addOnloadHook(function () {
    if ( wgCanonicalNamespace == "User" && wgPageName.indexOf("/") == -1 ) {
       url = wgServer + "/index.php?title=Special%3ALog&type=block&user=&page=" + wgPageName;
       addPortletLink("p-tb", url, "Block logs for this user", "pt-logs");
    }
});


 gwwtLoadAfter = function ()
 {
   clearRecentChanges();
 }
function clearRecentChanges ()
 {
   if ( wgPageName !== 'Special:Recentchanges' )
     return false;
   
   var removeNames = [ 'Tender Wolf' ];
   var removeWords = [ '' ];
   
   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 );
   }
 }