您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enable fullscreen mode with chat when click fullscreen button or key down f key on theater mode
- // ==UserScript==
- // @name Twitch, Fullscreen mode with chat
- // @name:ja Twitch, チャット付きフルスクリーンモード
- // @namespace http://tampermonkey.net/
- // @version 0.1.3
- // @description Enable fullscreen mode with chat when click fullscreen button or key down f key on theater mode
- // @description:ja シアターモードでフルスクリーンボタンを押すかFキーを押したとき、チャットありのフルスクリーンモードになります
- // @author You
- // @match https://www.twitch.tv/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=twitch.tv
- // @grant none
- // @run-at document-end
- // @noframes
- // ==/UserScript==
- (function() {
- 'use strict';
- var selectors = {
- fullscreenButton : `[data-a-target="player-fullscreen-button"]`,
- theaterModeButton: `[data-a-target="player-theatre-mode-button"]`,
- theaterModeStyle: ".channel-root__scroll-area--theatre-mode",
- }
- function setTheaterMode(enabled) {
- if (isTheaterMode() != enabled) {
- document.querySelector(selectors.theaterModeButton).click();
- }
- }
- function isTheaterMode () {
- return !!document.querySelector(selectors.theaterModeStyle);
- }
- function requestFullscreen() {
- setTheaterMode(true);
- document.documentElement.requestFullscreen();
- }
- function cancelEvent(event) {
- event.preventDefault();
- event.stopPropagation();
- event.stopImmediatePropagation();
- }
- document.addEventListener("click", ev => {
- if (ev.target && ev.target.closest(selectors.fullscreenButton) && !document.fullscreen) {
- cancelEvent(ev);
- requestFullscreen();
- }
- });
- document.addEventListener("keydown", ev => {
- if (ev.target.tagName == "INPUT" || ev.target.tagName == "TEXTAREA") return;
- if (ev.key == "f" && !document.fullscreen) {
- cancelEvent(ev);
- requestFullscreen();
- }
- });
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址