TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Share with HN: Bookmarklet to graph HN polls

25 pointsby bouncingsoulalmost 16 years ago
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>

4 comments

markbaoalmost 16 years ago
Wow, this is awesome! Tested it on <a href="http://news.ycombinator.com/item?id=692672" rel="nofollow">http://news.ycombinator.com/item?id=692672</a> if you need a quick test subject. Worked really well. (+1 for fitting in with the color scheme.)
timfalmost 16 years ago
screenshot for the unmotivated: <a href="http://timfreeman.org/pollgraph.png" rel="nofollow">http://timfreeman.org/pollgraph.png</a>
timfalmost 16 years ago
Nice work. Should be the default IMO.
johnnybgoodealmost 16 years ago
Good job. This would also work well as a Greasemonkey script.