Created
January 27, 2009 03:50
-
-
Save andyed/53159 to your computer and use it in GitHub Desktop.
Greasemonkey Tweak of Feeds.Mozilla.com
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 feeds.mozilla.com | |
// @namespace feeds.mozilla.com | |
// @include http://feeds.mozilla.com* | |
// ==/UserScript== | |
/* | |
* Version 0.0.1 Jan 26, 2009 | |
* Initial version by Andy Edmonds | |
* This script is licensed under the MPL. | |
*/ | |
var feedHack = { | |
refresh: 800, | |
timeout: false, | |
counts: {}, | |
ems: .8, | |
baseEm: .9, | |
inactiveEm: .8, | |
}; | |
feedHack.init = function init() { | |
window.setInterval(this.feedHack, this.refresh); | |
$ = unsafeWindow.jQuery; | |
$("li.filter").css("opacity", .5); | |
$("li.filter").css("font-size", this.inactiveEm + 'em'); | |
} | |
feedHack.feedHack = function () { | |
for(var type in feedHack.counts) { | |
feedHack.counts[type]=0; | |
$("li.filter.group-" + type).css("opacity", 1); | |
} | |
$ = unsafeWindow.jQuery; | |
$("li.entry:visible").each( | |
function( offset ){ | |
var arClass = this.className.split(" "); | |
for(var classOffset = 0; classOffset < arClass.length; classOffset++) { | |
if(arClass[classOffset].indexOf("group-") > -1) { | |
var type = arClass[classOffset].split("-")[1]; | |
if(!feedHack.counts[type]) feedHack.counts[type]=0; | |
feedHack.counts[type]++; | |
} | |
} | |
}); | |
var sum = 0; | |
for(var type in feedHack.counts) { | |
sum += feedHack.counts[type]; | |
} | |
for(var type in feedHack.counts) { | |
//console.log("Bouns ems " + (feedHack.counts[type]/sum)+ " " + ((1.0 * feedHack.baseEm + ((feedHack.counts[type]/sum)*feedHack.ems)) + "em") ); | |
$("li.group-"+ type + ".filter" ).css("font-size", (1.0 * feedHack.baseEm + ((feedHack.counts[type]/sum)*feedHack.ems)) + "em") ; | |
} | |
} | |
feedHack.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment