A browser extension that hides the comment section of link posts on reddit and hacker news if the article has not been read.
Project Tree
update the readme
Brett Robinson authored 6 years ago
README.md
A browser extension that hides the comment section of link posts on reddit and hacker news if the article has not been read.
Do you make sure to read the linked article on reddit and hacker news before you read the comments?
... Of course you do!
Except for that one time when the top comment was really interesting, and that other time when you wanted to share your experience on the topic of discussion.
Sometimes the comment section can be more exciting and engaging than the article itself.
ireadit helps promote and encourage readers to follow the link and read the article, by hiding the comment section until the article has been read. If you go to the comment section without having read the article, you will be greeted with a message stating that you have not read the article, and to do so to show the comment section. After viewing the link, the comment section will be available again. If you have read the article already on a different browser, you can choose to dismiss ireadit, allowing immediate access to the comments.
The extension adds a content script into pages that match one of the following urls:
https://news.ycombinator.com/item?id=\*
https://old.reddit.com/r/\*/comments/\*
https://i.reddit.com/r/\*/comments/\*
https://www.reddit.com/r/\*/comments/\*/.compact
https://www.reddit.com/\*
The script will first determine if the page is either a text or link post.
If it is a text post, the script will end.
If it finds the page to be a link post, it will try and parse the article link.
If a link is found, the script will send the parsed link to a background script.
The background script is needed to access the browser.history.getVisits() api.
This is also why the extension requires the history permission to function properly.
The background scripts purpose is to look up the given url in the browser history,
and return either a true
or false
value back to the content script.
If the content script receives true
, then the link has been viewed before,
and the script will end.
If the content script receives false
, then the link has not been viewed before.
To hide the comment section, the script adds a style element to the page changing the elements display
property to none
.
Lastly, an element will be inserted where the comment secion was before,
stating that the user has not read the article, and must do so to view the comment section.
Git clone or download the repository to your computer, then follow the guide below for your browser.