Greasy Fork 还支持 简体中文。

CLICK TO PAUSE/PLAY

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

目前為 2023-12-15 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name CLICK TO PAUSE/PLAY
  3. // @description Userscript that enables pause/play on click for kick.com
  4. // @version 3
  5. // @grant none
  6. // @author Trilla_G
  7. // @include https://kick.com/*
  8. // @namespace https://greasyfork.org/en/users/1200587-trilla-g
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12.  
  13. (function() {
  14. document.addEventListener("click", clickHandler, false);
  15.  
  16. function clickHandler(e) {
  17. // Check if the click is on the video element
  18. let player = getPlayer();
  19. if (!player || e.target !== player) {
  20. return;
  21. }
  22.  
  23. // Prevent default action and toggle play/pause
  24.  
  25. if (player.paused) {
  26. player.play();
  27. } else {
  28. player.pause();
  29. }
  30. }
  31.  
  32. function getPlayer() {
  33. var possibleVideo = document.querySelector('.vjs-tech');
  34. if (!possibleVideo || possibleVideo.nodeName !== "VIDEO") {
  35. return null;
  36. }
  37. return possibleVideo;
  38. }
  39. })();
  40.