Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Hacker News Polls Visualisation JavaScript Bookmarklet
javascript:(function(){
var s = document.createElement("script");
s.setAttribute("src", "http://code.jquery.com/jquery.js");
document.body.appendChild(s);
s.addEventListener("load", function() {
var $ = jQuery;
var max = 0;
var table = "table tr:eq(3) table:eq(1) ";
$(table).width("100%");
$(table + "tr td:eq(0)").width("15px");
$(table + ".comhead span").each(function() {
var v = parseInt($(this).text());
if (v > max) max = v;
$(this).data("val", v);
}).each(function() {
$(this)
.css({
"width": (100*$(this).data("val")/max)+"%",
"background-color":"white",
"border": "1px solid black",
"display": "block"
});
});
});
})();
javascript:(function(){var a=document.createElement("script");a.setAttribute("src","http://code.jquery.com/jquery.js");document.body.appendChild(a);a.addEventListener("load",function(){var b=jQuery,a=0;b("table tr:eq(3) table:eq(1) ").width("100%");b("table tr:eq(3) table:eq(1) tr td:eq(0)").width("15px");b("table tr:eq(3) table:eq(1) .comhead span").each(function(){var c=parseInt(b(this).text());c>a&&(a=c);b(this).data("val",c)}).each(function(){b(this).css({width:100*b(this).data("val")/a+"%","background-color":"white",border:"1px solid black",display:"block"})})})})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment