Twitch Auto Theatre

auto click theatre mode button

目前为 2022-07-23 提交的版本。查看 最新版本

// ==UserScript==
// @name               Twitch Auto Theatre
// @name:zh-TW         Twitch 自動劇院模式
// @namespace          http://tampermonkey.net/
// @version            1.0.2
// @description        auto click theatre mode button
// @description:zh-tw  進入頁面自動啟動劇院模式
// @author             Long
// @match              https://www.twitch.tv/*
// @icon               https://www.google.com/s2/favicons?domain=twitch.tv
// @grant              none
// ==/UserScript==

(function () {
  "use strict"

  let twitchAutoTheatreIntervalRetry = 300
  const twitchAutoTheatreInterval = setInterval(function () {
    if (!twitchAutoTheatreIntervalRetry) {
      clearInterval(twitchAutoTheatreInterval)
      console.warn("[Twitch-Auto-Theatre] theatre-mode-button not found.")
      return
    }

    const $persistentPlayer = document.querySelector('.persistent-player')
    if (!$persistentPlayer) {
      console.warn("[Twitch-Auto-Theatre] .persistent-player not found.")
      twitchAutoTheatreIntervalRetry--
      return
    }

    const isEnabled = $persistentPlayer.classList.contains('persistent-player--theatre')
    if (isEnabled) {
      clearInterval(twitchAutoTheatreInterval)
      console.log("[Twitch-Auto-Theatre] theatre-mode enabled.")
      return
    }

    const $theatreModeButton = document.querySelector('[data-a-target="player-theatre-mode-button"]')
    if ($theatreModeButton) {
      $theatreModeButton.click()
      console.log("[Twitch-Auto-Theatre] theatre-mode-button clicked.")
    }
    twitchAutoTheatreIntervalRetry--
  }, 500)
})()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址