4 ms·
Share with HN: Bookmarklet to graph HN polls
I made a bookmarklet that makes a simple bar graph for HN polls. Nothing fancy, but it makes interpreting polls here way easier for me.
Tested in Safari and Firefox.
Make a new bookmark with the following location:
javascript:(function(cells){var%20totalPoints=0;for(var%20i=0;i<cells.length;i++){if(cells[i].className==%22default%22){totalPoints+=parseInt(cells[i].textContent.match(/^[0-9]+/),10);}}for(i=0;i<cells.length;i++){if(cells[i].className==%22default%22){var%20optionPoints=parseInt(cells[i].textContent.match(/^[0-9]+/),10);cells[i].setAttribute(%22style%22,%22padding-left:.25em;border-left:%22+(optionPoints/totalPoints)*500+%22px%20solid%20#dcb;%22);}}})(document.getElementsByTagName(%22table%22)[3].getElementsByTagName(%22td%22));
- markbao 17y agoWow, this is awesome! Tested it on http://news.ycombinator.com/item?id=692672 http://news.ycombinator.com/item?id=692672 if you need a quick test subject. Worked really well. (+1 for fitting in with the color scheme.)
- timf 17y agoNice work. Should be the default IMO.
- timf 17y agoscreenshot for the unmotivated: http://timfreeman.org/pollgraph.png http://timfreeman.org/pollgraph.png
- johnnybgoode 17y agoGood job. This would also work well as a Greasemonkey script.