-
-
Save cxx/408613 to your computer and use it in GitHub Desktop.
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 Twittfilter for hitode909-RT | |
// @namespace http://d.hatena.ne.jp/send/ | |
// @description twitter filter | |
// @include http://twitter.com/* | |
// ==/UserScript== | |
// | |
(function (){ | |
var filter = function(node) { | |
var f = { | |
anouncement : function (context){ | |
var path = './/span[@class="entry-content"]'; | |
var elems = document.evaluate(path, context, null, 7, null); | |
for(var e = 0 ; e < elems.snapshotLength; e++) { | |
var elem = elems.snapshotItem(e); | |
for(var i = 0 ; i < elem.childNodes.length; i++) { | |
var s = elem.childNodes[i].data; | |
if(s != null && s.match(/RT\s+\{\"id\"\s*\:\s*\"?(\d+)\"?(?:\s*\,\s*\"screen\_name\"\s*\:\s*\"([\w\d\_]+)\"\s*)?\}/)) { | |
var id = RegExp.$1; | |
var screen_name = RegExp.$2; | |
if (id) { | |
var link = document.createElement('A'); | |
var decoration; | |
if (screen_name) { | |
decoration = document.createElement('marquee'); | |
link.href = | |
"http://twitter.com/"+screen_name+"/status/"+id; | |
link.innerHTML = " "+link.href; | |
} | |
else { | |
decoration = document.createElement('blink'); | |
link.href = | |
"http://mobile.twitter.com/statuses/"+id; | |
link.innerHTML = " "+link.href; | |
} | |
decoration.appendChild(link); | |
elem.appendChild(decoration); | |
} | |
} | |
} | |
} | |
}, | |
}; | |
for (var func in f) f[func](node); | |
} | |
filter(document); | |
document.getElementById('timeline').addEventListener('DOMNodeInserted', function(event) { | |
filter(event.target); | |
}, false); | |
})(); | |
//.user.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment