4 ms·
Show HN: HN Unread Comments v1.1 released (chrome extension)
- bambax 16y agoInteresting. Looking at the source I see that you calculate and store an md5 hash for each comment: var commentContentMd5 = md5($this.find('table td:eq(2) span.comment').text()); However each comment on HN has a unique id, that can be found on the links of the up and down keys: <a id="up_1943152" href="vote?for=1943152&... Wouldn't it be easier (and maybe faster) to use these ids to identify comments?
- jules 16y agoThe hash approach has the advantage of marking edited comments as unread? Perhaps you could do both and mark edited comments with a different color.
- CWIZO 16y agoThat is how it was done in the v1.0, but once you vote on a comment that id is gone. Or maybe I missed something :) Will have a look if I can use the IDs instead. edit: bonus "feature" of md5-ing the comments is, that if a comment changes it is marked as unread again ...
- bambax 16y ago> but once you vote on a comment that id is gone The score is in a span that has the same id: <span id="score_1944875">3 points</span> > if a comment changes it is marked as unread again But identical comments in different conversations are marked as read... ;-)
- CWIZO 16y agoI guess I really did miss something then :) HN's markup is really a mess ... >But identical comments in different conversations are marked as read... ;-) true, but that seems highly unlikely here on HN, where you don't have comments like "lol :)" everywhere.
- raganwald 16y agoIf one person writes LOL and another repeats it, I consider it a feature that the second one is also marked as read. YMMV ;-)
- kgermino 16y agoTwo thoughts: 1) If you've already read a comment you've already read it regardless of where you read it, and if the comments are exactly the same they are probably not terribly context sensitive. 2) I believe that if a submitted comment is exactly the same as one in memory than it is auto-killed so in general this is a moot point anyway.
- pmjordan 16y agoUnless I've missed something, the ID can be found in the 'link' link URL for that comment.
- swombat 16y agoHow does it work in the long run? Am I going to store the entire HN database in Chrome, until my computer slows down to a crawl? Otherwise, pretty cool. Installed.
- CWIZO 16y agoI've got plans to address this issue in the next release. I've been using this for more than 2 months now, and I haven't noticed any slow down, but I will do something about this never the less.
- bambax 16y agoYou can store the highest comment id for each article: any comment with an (id > stored highest id for the current article) is new. The hash thing is interesting for detecting edits, but since comments can be edited only for a limited amount of time (an hour maybe?) it doesn't need to be stored for a long time. Therefore maybe you could do: - hash => sessionStorage - article_id;highest_comment_id => localStorage
- swombat 16y agoThat seems like a very smart approach.
- chapel 16y agoI like the idea of this, but I find the red outline to be jarring and well quite frankly ugly. I think a more visually pleasing way of showing new vs old comments would be to make the text of old comments a light shade of grey, and the new comments normal black. Similar to how a link will have a different color once it has been visited.
- CWIZO 16y agoThe colour is actually the same as your HN colour that you can set in your settings page. Making read comments a lighter shade of grey would, unfortunately, not go well with how HN handles comments with <= 0 score. If you have any more ideas please share them, I know this isn't the optimal solution right now, but I can't find anything better ...
- chapel 16y agoI would just make it a lighter shade, but not as light as a <= 0 score comment. Those happen to be hard to read. Maybe you could give the option for the user to set their own CSS values for read and unread.
- CWIZO 16y agoMaybe I'll make it so that you can configure it, yes. So you'll be able to set the colour of the font and select whether you wish for a box to appear around unread comments.
- wvl 16y agoI've been using a simple left border to highlight new comments in my extension (http://hckrnews.com/about.html http://hckrnews.com/about.html), and I've found it works pretty well at highlighting new comments without being too obtrusive.
- raganwald 16y agoThank you! If I haven't read any of the comments on a post, there is no need to show me that they are new. The entire thread is new, I know that. In essence, the extension gives comments two states: new or old. I perceive that there are three states: new, old, and new-since-last-viewed. I am only interested in special highlighting for the third state, new for threads I have visited before.
- cj 16y agoLove it... but it'd be much less intrusive if you displayed the red border around new comments the second time you visit a comment thread. So the extensions would only change the screen if you visit a comment page more than once. The red border is unbearable.
- wvl 16y agoThis functionality has been available in my hckrnews extension for a while. It works only for individual item pages, since it tracks (in localstorage) the last comment id for each page. It uses a simple left border to highlight new omments, which I think is a little less intrusive (yet easy to spot) than the screenshot for this extension. It's available here: http://hckrnews.com/about.html http://hckrnews.com/about.html