> HN New Comment Highlight

 > Projects

Home

Preface

This page contains documentation pertaining to a browser extension that I've created which enhances the user interface of Y-Combinator's Hacker News forum. The meta-data of the extension contains the following as a description:

Refresh a Hacker News [HN] page and highlight new comments since the last visit.

To view this meta-data, and the project as a whole, visit its GitHub repository at HN-new_comment_highlight. Read on to get a better feel of what this extension accomplishes and how these goals are accomplished.


Hacker News - New Comment Highlight

Sometimes Y Combinator's Hacker News (HN) has an interesting post with an even more interesting comment section. As discussion grows, HN places comment threads in an unpredictable manner. Navigating multiple conversations can be a bit difficult considering how comment threads are nested and might move around relative to other primary comments. This extension seeks to rectify this problem as the user revisits the page looking for new comments.

This extension works by using chrome.storage.local to keep track of the unix timestamps noted by HN markup. It observes the timestamp given in the initial post upon revisiting a page and takes a look at each subsequent comment's timestamp and uses this information to determine how many new comments have been made. The extension informs the user that there are new comments within the header of the primary post:

Additionally, the primary post's header has a link inserted that allows the user to jump to the first unread post. Each subsequent post will also have links embedded that allows the user to jump to the next.

The comments that have been added since a pages' last visit will also be modified to signify that it is new. This is indicated by changing the time element's font-weight and color while also setting the background color of the comment's content:

Comment threads are tracked for up to a month after the lastest comment since the lastest visit of a page. Afer this month, they are trimmed from local storage (storage.local) upon visiting some HN post.


How to Install

As of writing this README, this extension hasn't been added to the Chrome Web Store. In the meantime, this extension can be side loaded into chromium-based browsers. Start by downloading this repository. If not familiar with git, the repository can be downloaded by selecting the < > code button near the top of the repository and selecting Download ZIP.

Extract the resultant archive using a utility such as 7zip.

Chromium Browsers

To install on a browser based on chromium, access the extensions menu and click through to Manage extensions.

This will open a new tab with to extension manager. Here, select the Load unpacked button located in the top-left of the manager.

Select the folder that was extracted from the initial zip archive.

Gecko Browsers

More information noted within source repository issue #3.