9anime Theatre Mode

9anime Auto Theatre Mode and other small "fixes"

As of 2021-07-06. See the latest version.

// ==UserScript==
// @name          9anime Theatre Mode
// @description	  9anime Auto Theatre Mode and other small "fixes"
// @author        cckats
// @match        *.9anime.to/watch/*
// @grant        none
// @version       1.0
// @namespace https://greasyfork.org/users/661487
// ==/UserScript==

(function() {
    'use strict';
    const interval = setInterval(function() {
        if (document.getElementsByClassName("ctl resize desktop")[0].innerText == " Expand"){
            document.getElementsByClassName("ctl resize desktop")[0].click();
            var css = `header {
    padding: 0.5em 0!important;
}

@media screen and (min-width: 800px ){
.player-wrapper{
    top: -10px!important;
    height: 97vh!important;
    max-width:100vw;
   width: 98.5vw!important;
    left: -10px!important;
}
    header {
    position: absolute!important;
    top: 107%!important;
    z-index: 100!important;
    left: calc((100% - (82.4vh * 16 / 9))/2)!important;
}
    aside.main,aside.sidebar{
        padding-top: 100vh!important;
}
}
@media screen and (min-width: 1366px){
.player-wrapper{
    top: -10px!important;
    height: 97vh!important;
    max-width:100vw;
    width: calc(96vh * 16 / 9)!important;
    left: calc((100% - (96vh * 16 / 9))/2)!important;
}
header {
    position: absolute!important;
    top: 115vh!important;
    z-index: 100!important;
    left: calc((100% - (96vh * 16 / 9))/2)!important;
}
aside.main,aside.sidebar{
        padding-top: 111vh!important;
}
}


.player-wrapper #controls>div {
    line-height: 19px;
    height: 19px;
}`
            if (typeof GM_addStyle != "undefined") {
                GM_addStyle(css);
            } else if (typeof PRO_addStyle != "undefined") {
                PRO_addStyle(css);
            } else if (typeof addStyle != "undefined") {
                addStyle(css);
            } else {
                var node1 = document.createElement("style");
                node1.id="darkmode";
                node1.type = "text/css";
                node1.appendChild(document.createTextNode(css));
                var heads1 = document.getElementsByTagName("head");
                if(document.getElementById("darkmode") == null){
                    if (heads1.length > 0) {
                        heads1[0].appendChild(node1);
                    } else {
                        // no head yet, stick it whereever
                        document.documentElement.appendChild(node1);
                    }
                }
            }
        }
        document.getElementsByClassName("episodes")[0].onclick = function(){window.scrollTo({top: 0, behavior: 'smooth'});};

        if (document.getElementsByClassName("message")[0] != undefined){
            if (document.getElementsByClassName("message")[0].innerText == "There is something wrong, please refresh the page then try again."){
                location.reload();
            }
        }
    },1000)
})();