Skip to content

Instantly share code, notes, and snippets.

@jibe-b
Created October 25, 2020 11:29
Show Gist options
  • Save jibe-b/f5851d78bde66231a5b33586ad6f0385 to your computer and use it in GitHub Desktop.
Save jibe-b/f5851d78bde66231a5b33586ad6f0385 to your computer and use it in GitHub Desktop.
I wrote a small js script that get the ids of the Mastodon posts that have been displayed on my screen and removes the ones that already appeared. Hence enabling to only see freesh posts.
var store_seen_posts_ids = function () {
var alreadyseenpostsids = localStorage.getItem("alreadyseenpostsids")
for (el of document.querySelectorAll(".status")) {
alreadyseenpostsids += "," + el.dataset.id.toString()
}
localStorage.setItem("alreadyseenpostsids", alreadyseenpostsids)
}
var remove_already_seen_posts = function () {
var alreadyseenpostsids = localStorage.getItem("alreadyseenpostsids").split(",")
for (el of document.querySelectorAll("div.status")){
if (alreadyseenpostsids.includes(el.dataset.id.toString())){
el.remove()
}
}
}
store_seen_posts_ids()
remove_already_seen_posts()
@jibe-b
Copy link
Author

jibe-b commented Oct 25, 2020

Note that it breaks the Mastodon feed when scrolling down after executing:

Screenshot from 2020-10-25 12-29-39

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