Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Last active September 24, 2015 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazywithclass/3829c35a916a2e593009 to your computer and use it in GitHub Desktop.
Save lazywithclass/3829c35a916a2e593009 to your computer and use it in GitHub Desktop.
Marking comments as read on HN, the hacky way
// these are to be pasted into the console
// remove by clicking on the up arrow
// the useful thing is that you remove comments and add the removed id to
// an array, so next time you know exactly what you've considered
// (use case might be monthly "Who is hiring?")
function remove(id) {
document.getElementById(id).parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.remove();
}
[].forEach.call(
document.getElementsByTagName("a"),
function(item) {
item.onclick = function(e) {
e.preventDefault();
var ids = localStorage.getItem('ids').split(',');
ids.push(item.id);
localStorage.setItem('ids', ids.toString());
remove(item.id);
}
}
);
localStorage.getItem('ids').split(',').forEach(remove);
@lazywithclass
Copy link
Author

Bug: comments on comments remain, but I don't really care, for my use case is fine as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment