Created
October 25, 2020 11:29
-
-
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.
This file contains hidden or 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
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that it breaks the Mastodon feed when scrolling down after executing: