Created
October 27, 2008 09:05
-
-
Save swdyh/20059 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 twitter faceiconize | |
| // @namespace http://www.relucks.org/ | |
| // @include http://twitter.com/home | |
| // ==/UserScript== | |
| (function() { | |
| var fl = function(doc) { | |
| var st = getElementsByXPath('//td[@class="thumb vcard author"]/a', doc) | |
| st.forEach(function(i){ | |
| var name = i.href.split('/').pop() | |
| i.childNodes[0].src = 'http://usericons.relucks.org/turnyournameintoaface/' + name | |
| }) | |
| } | |
| fl(document) | |
| setTimeout(function() { | |
| if (window.AutoPagerize && window.AutoPagerize.addDocumentFilter) { | |
| window.AutoPagerize.addDocumentFilter(fl) | |
| } | |
| }, 0) | |
| var fs = getElementsByXPath('id("friends")//a[@rel="contact"]') | |
| fs.forEach(function(i){ | |
| var name = i.href.split('/').pop() | |
| i.childNodes[0].src = 'http://usericons.relucks.org/turnyournameintoaface/' + name | |
| }) | |
| GM_addStyle('.hentry .thumb img { width:40px; } #friends img { width:20px; }') | |
| function getElementsByXPath(xpath, node) { | |
| var node = node || document | |
| var doc = node.ownerDocument ? node.ownerDocument : node | |
| var nodesSnapshot = doc.evaluate(xpath, node, null, | |
| XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) | |
| var data = [] | |
| for (var i = 0; i < nodesSnapshot.snapshotLength; i++) { | |
| data.push(nodesSnapshot.snapshotItem(i)) | |
| } | |
| return data | |
| } | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment