Crunchyroll: Resize Player To Window Size

Moves the video to the top of the website and resizes it to the screen size.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name            Crunchyroll: Resize Player To Window Size
// @description     Moves the video to the top of the website and resizes it to the screen size.
// @author          Chris H (Zren / Shade)
// @icon            http://crunchyroll.com/favicon.ico
// @homepageURL     http://userscripts.org/scripts/show/157272
// @namespace       http://xshade.ca
// @version         1.1
// @include         http*://*.crunchyroll.c*/*
// @include         http*://crunchyroll.c*/*
// ==/UserScript==
(function() {
    // Can't use !important with javascript element.style.___ so we need to inject CSS.
    // http://stackoverflow.com/a/462603/947742
    function addNewStyle(newStyle) {
        var styleElement = document.getElementById('styles_js');
        if (!styleElement) {
            styleElement = document.createElement('style');
            styleElement.type = 'text/css';
            styleElement.id = 'styles_js';
            document.getElementsByTagName('head')[0].appendChild(styleElement);
        }
        styleElement.appendChild(document.createTextNode(newStyle));
    }
    
    var style = "html, body, #showmedia_video_box, #showmedia_video_box_wide, #showmedia_video_player { width: 100%; height: 100%; }";
    
    var videoBox = document.getElementById('showmedia_video_box') || document.getElementById('showmedia_video_box_wide');
    if (!videoBox) return;
    document.body.insertBefore(videoBox, document.body.firstChild);
    videoBox.style.width = '100%';
    videoBox.style.height = '100%';
    videoBox.style.backgroundColor = '#000';
    var videoPlayer = document.getElementById('showmedia_video_player');
    if (!videoPlayer) return;
    //var videoObject = videoBox.getElementsByTagName('object')[0];
    videoPlayer.width = '100%';
    videoPlayer.height = '100%';
    addNewStyle(style);
})();