カテゴリ別 2003年 | 2004年 | 2005年 | 2006年 | 2007年 | 2008年
知り合いサイト: よんだもの / 暴想 / Linuxでやる夫 / 新宿Vipper / 僕だけが幸せになればいいのに。
はてなブックマーク のサイトで、見なくてもいいやというサイトを非表示にする 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);
})();
最近のコメント:
RSS
![]()
This work is licensed under a
Creative Commons License
(note: text only. w/o web design, citations, (re)distributed softwares).
このエスプリは画期的!