Skip to content

Instantly share code, notes, and snippets.

@y-mamanaranu
Last active April 17, 2022 13:48
Show Gist options
  • Select an option

  • Save y-mamanaranu/bbd0be9a136d300bef8f3268e5082efc to your computer and use it in GitHub Desktop.

Select an option

Save y-mamanaranu/bbd0be9a136d300bef8f3268e5082efc to your computer and use it in GitHub Desktop.
Tampermonkey script for PostPrime to Hide Marked Posts in timeline
// ==UserScript==
// @name PostPrime - Hide Marked Posts
// @namespace https://github.com/y-muen
// @version 0.1.3
// @description Hide Marked Posts in PostPrime timeline
// @author Yoiduki <y-muen>
// @match *://postprime.com/*
// @icon https://www.google.com/s2/favicons?domain=postprime.com
// @grant none
// @updateURL https://gist.github.com/y-muen/bbd0be9a136d300bef8f3268e5082efc/raw/postprime-hide-marked-posts.js
// ==/UserScript==
(function() {
'use strict';
const hideMarked_sub = (elem) => {
if (elem.style.display =="" ){
var res = elem.getElementsByClassName("PostReActions_icon___YvyJ")
res = res[0].getElementsByTagName("img")
if (res[1].src.match(/heart-on/)){
elem.style.display="none";
}
}
};
const hideMarked = () => {
var Post_postWrapper__XXhlo = document.getElementsByClassName("Post_postWrapper__XXhlo");
Post_postWrapper__XXhlo = Array.from(Post_postWrapper__XXhlo);
Post_postWrapper__XXhlo.forEach((elem) => hideMarked_sub(elem));
};
hideMarked();
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
hideMarked()
});
});
const config = {
attributes: false,
childList: true,
characterData: false,
subtree:true
};
observer.observe(document, config);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment