Greasemonkey script: up2date filtering

Want to help out? Need help accessing the AniDB API? This is the place to ask questions.

Moderator: AniDB

Locked
Wildclaw
Posts: 2
Joined: Sun Apr 02, 2006 6:23 pm

Greasemonkey script: up2date filtering

Post by Wildclaw » Sun Jul 23, 2006 3:37 pm

This is a simple script that hides some of the entries on the up2date page. Groups as well as episode types can be hidden. Episode types are defined by the first character in the "ep" column, while groups need to be exact (including the []).

You have to edit the first rows manually to change what is hidden. It is pretty easy though. Just add/remove entries in the lists (hideGroups,hideEpTypes) at the top. Save it as <something>.user.js .

If you are using firefox install with greasemonkey. If you are using opera add it to your user javascript files.

Code: Select all

/********************/
// Hide the following episodes in Up2Date:

// Episodes by the following groups:
var hideGroups=new Array("-","[ExampleGroup]");

// Parodies, Credits, Trailers
var hideEpTypes = new Array("P","C","T");
/*********************/

function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

if(window.location.href == 'http://anidb.info/perl-bin/animedb.pl?show=up2date')
{
window.addEventListener('load',
   
function()
{
   t1 = document.getElementById('layout-content').
         getElementsByTagName('table')[0].
         getElementsByTagName('tbody')[0].
         getElementsByTagName('tr');

    for(i=1;i<t1.length;i++)
    {
      t2 = t1[i].getElementsByTagName('td');
    
      for(j=0;j<t2.length;j++)
      {
        if (t2[j].className == 'group')  
        {
          groupName = TrimString(t2[j].textContent);
         
          //Hide entries that don't belong to any group, or non-english groups
          for(k=0;k<hideGroups.length;k++)
          {
            if(groupName == hideGroups[k])
              t1[i].style.display = 'none'; 
          }
        }
             
        if(t2[j].className == 'ep') 
        {
          epType = t2[j].textContent.charAt(0); // First character)
          
          //Hide Credits, Parodies, Trailers
          for(k=0;k<hideEpTypes.length;k++)
          {
            if(epType == hideEpTypes[k])
              t1[i].style.display = 'none'; 
          }
        }
             
      }
    }
  }
, false);
}
[/code]

Der Idiot
AniDB Staff
Posts: 1227
Joined: Fri Mar 21, 2003 10:19 am

Post by Der Idiot » Sun Jul 23, 2006 4:38 pm

added it to the scripts page: http://wiki.anidb.info/w/Scripts

Locked