フォーチュンサモナーズ
«前の日記(2007-05-04) 最新 次の日記(2007-05-06)» 編集

Don'tStopMusic

2003|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|12|
2006|01|02|03|04|05|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|08|09|10|

カテゴリ別 2003年 | 2004年 | 2005年 | 2006年 | 2007年 | 2008年

知り合いサイト: よんだもの / 暴想 / Linuxでやる夫 / 新宿Vipper / 僕だけが幸せになればいいのに。


2007-05-05

_ [適当] はてなブックマークで特定サイトを非表示にする greasemonkey スクリプト このエントリーを含むブックマーク

はてなブックマーク のサイトで、見なくてもいいやというサイトを非表示にする greasemonkey スクリプトを書いてみました。hatebunomore.user.js

2007/05/06 追記。ページによって URL がまちまちなことに気がついたので、xpath 式を緩い条件に変更しました。

// ==UserScript==
// @name            hatena bookmark no more gigazine
// @namespace       http://dontstopmusic.no-ip.org/diary/20070505.html#p01
// @description     Hide some famous sites on b.hatena.ne.jp
// @include         http://b.hatena.ne.jp/*
// ==/UserScript==
 
var denies = [
    'http://gigazine.net/',
    'http://www.popxpop.com/',
    'http://www.simplexsimple.com/',
    'http://dain.cocolog-nifty.com/',
    ];
var ids = [];
for (var i = 0; i < denies.length; i++) {
    var xpath = '//a[contains(@href, "' + denies[i] + '")]/../..';
    var entries = document.evaluate( xpath, document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
    var entry;
    while(entry = entries.iterateNext()) {
        ids.push(entry.id);
    }
}
(function() {
    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }
    for (var i = 0, style = ''; i < ids.length; i++) {
        style += '#' + ids[i] + ' { display: none; } ';
    }
    addGlobalStyle(style);
})();
本日のツッコミ(全1件) [ツッコミを入れる]
_ yokoyamen (2007-05-06 02:39)

このエスプリは画期的!

[]

最近のコメント:

  1. だて (05-30)
  2. eto (05-30)
  3. だて (05-15)

RSS
Creative Commons License
This work is licensed under a Creative Commons License
(note: text only. w/o web design, citations, (re)distributed softwares).