// ==UserScript==
// @name CrunchyRoll Theater Mode
// @namespace https://bblok.tech
// @version 1.2
// @description Watch anime in a comfortable wide view
// @author Theblockbuster1
// @icon https://www.crunchyroll.com/favicons/favicon-32x32.png
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @match https://www.crunchyroll.com/*
// @match https://crunchyroll.com/*
// @grant none
// @downloadURL none
// ==/UserScript==
var jq = jQuery.noConflict();
jq(function() {
if (!jq('#showmedia_video_player')[0]) return; // only run on a video page
// some parts "borrowed" and edited from https://chrome.google.com/webstore/detail/crunchyroll-theater-mode/fccfjcklfpanhmcgbpcmpjhgindhmlbp
jq('head').prepend(``);
// Remove banner and ad elements
jq('#marketing_banner').remove();
jq('.game-banner-wrapper').remove();
jq('#showmedia_free_trial_signup').remove();
jq('').insertBefore('.showmedia-submenu #sharing_add_queue_button');
jq(`
`).prependTo('.header-userpanel > ul');
let parent = jq('#showmedia_video_box').parent();
jq('#toggle-theater').click(function() {
if (jq(this).hasClass('not-queued')) {
localStorage.theater = 'true';
jq(this).removeClass('not-queued').addClass('in-queue');
jq('body').addClass('crunchyroll-theater-mode');
document.documentElement.style.setProperty('--player-height', jq('#showmedia_video_player').css('height'));
document.documentElement.style.setProperty('--container-width', jq('#template_container').css('width'));
window.scroll({top: jq('.site-header').height()+1, left: 0, behavior: 'smooth'});
} else {
localStorage.theater = 'false';
jq(this).removeClass('in-queue').addClass('not-queued');
jq('body').removeClass('crunchyroll-theater-mode');
}
});
if (localStorage.theater === 'true') jq('#toggle-theater').click();
jq(window).resize(function() {
document.documentElement.style.setProperty('--player-height', jq('#showmedia_video_player').css('height'));
document.documentElement.style.setProperty('--container-width', jq('#template_container').css('width'));
});
});