// ==UserScript==
// @name my.opera.com forums - Selective signature removal
// @author Richard Lainchbury
// @description  Enhance display of threads on the my.opera.com forums
//			by selectively removing users' signatures.
// @ujs:category site: enhancements
// @ujs:published 2005-05-20 19:35
// @ujs:modified 2005-09-19 09:19
// @ujs:documentation http://userjs.org/scripts/site/enhancements/myoperacom-sigremover 
// @ujs:download http://userjs.org/scripts/download/site/enhancements/myoperacom-sigremover.js
// ==/UserScript==


/* 
 * This script is granted to the Public Domain
 */

if(location.hostname.indexOf('my.opera.com') != -1 ){ // only for opera forums
  document.addEventListener("load",function(e){ // add event on page load

    /* An array of user names whose signatures you wish to nuke 
     * Empty by default. Insert comma-separated list of user names here.
     * Example, removes the signatures of users "foo" and "bar":
     * 
     * var unrulySigs = new Array("foo","bar");
     */
    var unrulySigs = new Array();

    Array.prototype.inArray = function(needle){
      for (var i = this.length-1; i > -1 ; i--){ // loop through arrays length
        if (this[i] == needle){ // return true breaking loop
         return true;
        }
      }
      return false;
    }

    var boldList,divList;
    
    // an array of usernames to strip sigs from
    // grab all divs to search through 
    divList = document.getElementsByTagName('div');
    for(var i=divList.length-1; i > -1; i--) { // loop through and 
      if(divList[i].className=='sig'){
        var boldList = divList[i].parentNode.parentNode.getElementsByTagName('b');
        for(var b=boldList.length-1; b > -1 ;b--){
          if(unrulySigs.inArray(boldList[b].firstChild.nodeValue)){
           divList[i].style.display = "none";
          }
        }
      }
    }
  },false);
}
