// ==UserScript==
// @name twitch auto theatre mode
// @namespace fent
// @version 0.1.5
// @include /https?:\/\/www\.twitch\.tv\/videos\/\d+/
// ==/UserScript==

const getSlider = (callback) => {
const search = () => document.querySelector(‘.qa-theatre-mode-button’);
let maxAttempts = 10;
let iid = setInterval(() => {
const $theatre = search();
if ($theatre || –maxAttempts === 0) {
clearInterval(iid);
}
if ($theatre) {
callback($theatre);
}
}, 1000);
};

getSlider(($theatre) => {
$theatre.click();
});