Twitch Pause Carousel

Pause home page carousel

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         Twitch Pause Carousel
// @namespace    https://github.com/dotmick/
// @version      0.2
// @description  Pause home page carousel
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @author       dotmick
// @match        *://www.twitch.tv
// @grant        none
// @license      GPL-3.0-or-later
// ==/UserScript==


// Ugly, but that works
$(document).ready(() => {
	console.log('Running Twitch Pause Carousel (TPC)');

    var checkExist = setInterval(function() {
        if ($('.video-player__container video').get(0).readyState == 4) {
            console.log("TPC – Video ready to be paused");
            clearInterval(checkExist);
            var nbPausing = 100;
            var forcePausing = setInterval(function() {
                console.log("TPC – Forcing pause...");
                $('.video-player__container video').get(0).pause();
                nbPausing--;
                if(nbPausing == 0)
                {
                    clearInterval(forcePausing);
                    console.log("TPC – Forcing pause done (x" + nbPausing + ")");
                }

            }, 100);
        }
    }, 100);
});