Skip to content

Instantly share code, notes, and snippets.

@ahomu
Created February 18, 2011 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahomu/833422 to your computer and use it in GitHub Desktop.
Save ahomu/833422 to your computer and use it in GitHub Desktop.
Google Readerで胡散臭いタイトルのエントリをどうこうしたいぞ的な
// ==UserScript==
// @name Trash Hotentry
// @namespace http://havelog.ayumusato.com/
// @description くずかごフィルター
// @include http://www.google.com/reader/view*
// @version 0.1
// ==/UserScript==
(function(doc) {
setInterval(function() {
var entry = doc.querySelectorAll('div.entry'),
ignore = doc.querySelectorAll('div.ignore'),
i = 0,
iz = entry.length,
jz = ignore.length;
if ( iz !== jz && !!(doc.body.className.indexOf('loading') === -1) ) {
for ( ; i < iz; i++ ) {
var title = doc.querySelector('div.entry-'+i+' h2.entry-title'),
row = entry[i],
text = title.firstChild,
klass = row.className;
if ( !!(klass.indexOf('ignore') === -1) ) {
if ( text.nodeType === 3 ) {
// 分岐を増やせばいろいろできます
if ( !!(text.nodeValue.match(/(最強の|たった1つの|つの理由|Word[pP]ress|しておきたい|するべき|Togetter|ライフハッカー)/)) ) {
row.style.opacity = '0.1';
} else if ( !!(text.nodeValue.match(/痛いニュース/)) ) {
title.style.color = 'purple';
}
}
row.className = klass + ' ignore';
}
}
}
}, 500);
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment