Created
February 3, 2010 07:42
-
-
Save 0mg/293451 to your computer and use it in GitHub Desktop.
Favstar the Favotter Style
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 favstar the favotter style | |
// @include http://favstar.fm/* | |
// ==/UserScript== | |
(function() { | |
var tweetContainers = | |
document.evaluate('.//div[@class="tweetContainer"]', document, null, 5, null); | |
var tweetContainer; | |
while (tweetContainer = tweetContainers.iterateNext()) { | |
var tweet = document.evaluate('.//div[@class="theTweet"]', tweetContainer, | |
null, 9, null).singleNodeValue; | |
var stars = Number(document. | |
evaluate('.//div[starts-with(@class,"favouritesCount")]', tweetContainer, | |
null, 9, null).singleNodeValue.lastChild.nodeValue); | |
tweet.style.color = | |
stars >= 5 ? "#FF0000" : | |
stars >= 3 ? "#660099" : | |
stars >= 2 ? "#009900" : | |
stars >= 1 ? "#333333" : | |
""; | |
tweet.style.fontSize = | |
stars >= 6 ? "6em" : | |
stars >= 5 ? "5em" : | |
stars >= 4 ? "4em" : | |
stars >= 3 ? "3em" : | |
stars >= 2 ? "2em" : | |
stars >= 1 ? "" : | |
""; | |
tweet.style.fontWeight = | |
stars >= 2 ? "600" : | |
""; | |
tweet.style.lineHeight = "1.2"; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment