CLICK TO PAUSE/PLAY

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

Fra og med 15.12.2023. Se den nyeste version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

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