Last active
April 17, 2022 13:46
-
-
Save y-mamanaranu/c6c6b0684b3cc4fc10ec410113815806 to your computer and use it in GitHub Desktop.
Tampermonkey script for PostPrime to add hide post botton in timeline
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 - Make Video Controllable | |
| // @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/c6c6b0684b3cc4fc10ec410113815806/raw/postprime-make-video-controllable.js | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| const videoControllable_sub = (elem) => { | |
| if (!elem.classList.contains('videoControllable')){ | |
| var res=elem.getElementsByTagName("video"); | |
| if (res.length){ | |
| var video = res[0]; | |
| video.controls=true; | |
| var over = elem.getElementsByClassName("VideoPlayer_playerOverlay__b8HZ_")[0]; | |
| over.remove(); | |
| elem.classList.add('videoControllable'); | |
| } | |
| } | |
| }; | |
| const videoControllable = () => { | |
| var Post_postWrapper__XXhlo = document.getElementsByClassName("Post_postWrapper__XXhlo"); | |
| Post_postWrapper__XXhlo = Array.from(Post_postWrapper__XXhlo); | |
| Post_postWrapper__XXhlo.forEach((elem) => videoControllable_sub(elem)); | |
| }; | |
| videoControllable(); | |
| const observer = new MutationObserver((mutations) => { | |
| mutations.forEach((mutation) => { | |
| videoControllable() | |
| }); | |
| }); | |
| 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