Last active
September 24, 2015 19:13
-
-
Save lazywithclass/3829c35a916a2e593009 to your computer and use it in GitHub Desktop.
Marking comments as read on HN, the hacky way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug: comments on comments remain, but I don't really care, for my use case is fine as it is.