Twitch Theatermode

Auto activate theater mode on twitch

// ==UserScript==
// @name         Twitch Theatermode
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Auto activate theater mode on twitch
// @author       Therrom
// @match        http*://*.twitch.tv/*
// @grant        none
// @license MIT
// ==/UserScript==

let tries = 0;

(function() {
    'use strict';

    tryTheatre();
})();

function tryTheatre() {
    var t = document.querySelector('button[data-a-target="player-theatre-mode-button"]');
    if (t) {
        t.click();
    } else {
        if (tries++ < 100) {
            setTimeout(tryTheatre, 1000);
        }
    }
}