您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Use similar controls as on YouTube when watching Showtime (`f` for full screen, `k` to play/pause, `c` for captions)
当前为
// ==UserScript== // @name YouTube-style keyboard controls on Showtime // @namespace showtime.keyboard // @version 0.1 // @description Use similar controls as on YouTube when watching Showtime (`f` for full screen, `k` to play/pause, `c` for captions) // @match https://showtime.com/* // @match https://www.showtime.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // change these constants if you prefer to use a different key // (or change the letter to uppercase if you want the shortcut to require the use of Shift) const FULL_SCREEN_KEY = 'f'; const PLAY_PAUSE_KEY = 'k'; const CLOSED_CAPTIONS_KEY = 'c'; function clickButton(className) { const buttons = document.querySelectorAll('button.' + className); if (buttons && buttons.length == 1) { buttons[0].click(); } else { console.error('Button not found!'); } } function isPlaying(videoElement) { return !!(videoElement.currentTime > 0 && !videoElement.paused && !videoElement.ended && videoElement.readyState > 2); } addEventListener("keypress", function(e) { if (e.ctrlKey || e.altKey) { // return early if any modifier key like Control or Alt is part of the key press return; } if (e.key == FULL_SCREEN_KEY) { if (window.innerHeight == screen.height) { clickButton('exit-fullscreen'); } else { clickButton('enter-fullscreen'); } } else if (e.key == PLAY_PAUSE_KEY) { const videos = document.getElementsByTagName('video'); if (videos && videos.length == 1 && isPlaying(videos[0])) { clickButton('pause'); } else { clickButton('play'); } } else if (e.key == CLOSED_CAPTIONS_KEY) { const ccContainer = document.querySelectorAll('div.player-closed-captioning-container > div'); if (ccContainer && ccContainer.length == 1) { if (ccContainer[0].classList.contains('closed-captioning-enabled')) { // already enabled clickButton('closed-captioning-disable'); } else { clickButton('closed-captioning-enable'); } } else { console.error('No CC container found'); } } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址