CLICK TO PAUSE/PLAY

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

2023/12/21のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください

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