Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save y-mamanaranu/294a63b663eb15fd06ea318d3f1a9e90 to your computer and use it in GitHub Desktop.
Tampermonkey script for PostPrime to hide prime post
// ==UserScript==
// @name PostPrime - Hide Prime Post
// @namespace https://github.com/y-muen
// @version 0.1.1
// @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/294a63b663eb15fd06ea318d3f1a9e90/raw/postprme-hide-prime-post.js
// ==/UserScript==
(function() {
'use strict';
const hidePrime_sub = (elem) => {
if (elem.style.display !="none" ){
if (elem.getElementsByClassName("Post_paidLabel__fGM2T").length){
elem.style.display="none";
}
}
};
const hidePrime = () => {
var Post_postWrapper__XXhlo = document.getElementsByClassName("Post_postWrapper__XXhlo");
Post_postWrapper__XXhlo = Array.from(Post_postWrapper__XXhlo);
Post_postWrapper__XXhlo.forEach((elem) => hidePrime_sub(elem));
};
hidePrime();
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
hidePrime()
});
});
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