Created
February 18, 2011 08:42
-
-
Save ahomu/833422 to your computer and use it in GitHub Desktop.
Google Readerで胡散臭いタイトルのエントリをどうこうしたいぞ的な
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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