過去に書いたスクリプトを点検する

yahoo番組表を最適化するために書いた。
http://tv.yahoo.co.jp/vhf/sizu/realtime.html

(function(){
    document.getElementById('wrapper').style.width = '97%';
    var remove = document.evaluate('//div[@class="prCenterSQB clearFix" or @class="prCT" or @id="sub"]', document, null, 7, null);
    for(i=0;i<remove.snapshotLength;i++){
        remove.snapshotItem(i).parentNode.removeChild(remove.snapshotItem(i));
    }
    var warp = document.evaluate('//form[@name="mitai"]', document, null, 7, null);
    window.scroll(0,warp.snapshotItem(0).offsetTop);
    var cellHighlight = document.evaluate('//td[@class and @valign and @rowspan]', document, null, 7, null);
    for(i=0;i<cellHighlight.snapshotLength;i++){
        cellHighlight.snapshotItem(i).addEventListener("mouseover", function(){
            this.style.backgroundColor = 'pink';
        }, false);
        cellHighlight.snapshotItem(i).addEventListener("mouseout", function(){
            this.style.backgroundColor = '';
        }, false);
    }
})();


は、以下になる。

GM_addStyle(<><![CDATA[
  #sub {display:none !important;}
  td[class~="turnup"]:hover {background:pink !important;}
]]></>);
document.getElementById('wrapper').style.width = '97%';
var warp = document.evaluate('//form[@name="mitai"]', document, null, 7, null);
scroll(0,warp.snapshotItem(0).offsetTop);


CSSおもろい。Firefox3もっとがんばれ→http://www.css3.info/modules/selector-compat/
ってちょっと調べたらFirefox 3.5(現行の3.1 Beta 4)から:nth-child、:nth-last-child、:nth-of-type、:nth-last-of-type、:first-of-type、:last-of-type、:only-of-typeなどがサポートされるのか。