CLICK TO PAUSE/PLAY

Userscript that enables pause/play on click for kick.com

Verze ze dne 21. 12. 2023. Zobrazit nejnovější verzi.

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        CLICK TO PAUSE/PLAY
    // @description Userscript that enables pause/play on click for kick.com
    // @version     4.0
    // @grant       none
    // @author      Trilla_G
    // @include     https://kick.com/*
    // @namespace https://greasyfork.org/en/users/1200587-trilla-g
    // @license MIT
    // ==/UserScript==
     
    (function() {
        document.addEventListener("click", clickHandler, false);
     
        function clickHandler(e) {
            // Check if the click is on the video element
            let player = getPlayer();
            if (!player || e.target !== player) {
                return;
            }
     
            // Prevent default action and toggle play/pause
            e.preventDefault();
            if (player.paused) {
                player.play();
            } else {
                player.pause();
            }
        }
     
        function getPlayer() {
            var possibleVideo = document.querySelector('.vjs-tech');
            if (!possibleVideo || possibleVideo.nodeName !== "VIDEO") {
                return null;
            }
            return possibleVideo;
        }
    })();