CLICK TO PAUSE/PLAY

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

Stan na 15-12-2023. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        CLICK TO PAUSE/PLAY
// @description Userscript that enables pause/play on click for kick.com
// @version     2.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;
        }

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