

Share with HN: Bookmarklet to graph HN polls - bouncingsoul

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.<p>Tested in Safari and Firefox.<p>Make a new bookmark with the following location:<p><pre><code>  javascript:(function(cells){var%20totalPoints=0;for(var%20i=0;i&#60;cells.length;i++){if(cells[i].className==%22default%22){totalPoints+=parseInt(cells[i].textContent.match(/^[0-9]+/),10);}}for(i=0;i&#60;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));</code></pre>
======
markbao
Wow, this is awesome! Tested it on
<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
screenshot for the unmotivated: <http://timfreeman.org/pollgraph.png>

------
timf
Nice work. Should be the default IMO.

------
johnnybgoode
Good job. This would also work well as a Greasemonkey script.

