Last active
April 17, 2022 13:46
-
-
Save y-mamanaranu/294a63b663eb15fd06ea318d3f1a9e90 to your computer and use it in GitHub Desktop.
Tampermonkey script for PostPrime to hide prime post
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
| // ==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