PostPrime - Make Video Controllable

Hide Marked Posts in PostPrime timeline

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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
// ==/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);
})();