YouTube Comfort In Black

By mcbd Last update Dec 18, 2008 — Installed 13,671 times.

There are 30 previous versions of this script.

Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)

// ==UserScript==
// @name           YouTube Comfort In Black
// @description    A dark skin for YouTube video pages.
// @namespace      http://userscripts.org/users/57930
// @include        http://*.youtube.com/watch?*
// @include        http://*.youtube.com/share_inline?*
// @version        0.6b6
// ==/UserScript==

(function() {
    
    var videoPlayerWidth = 700 ;
    /**
      *   pixels
      *   (default: 700)
      *   (youtube default: 640)
      */
    
    var rightPaneWidth = 360 ;
    /**
      *   pixels
      *   (default: 360)
      *   (youtube default: 300)
      */
    
    var moreFromPanelMaximumHeight = 302 ;
    var relatedVideosPanelMaximumHeight = 302 ;
    var playlistPanelMaximumHeight = 175 ;
    var quickListPanelMaximumHeight = 175 ;
    /**
      *   pixels
      *   (default: 302, 302, 175 and 175)
      */
    
    var videoControllerOpacity = 0.7 ;
    /**
      *   between 0 to 1.0
      *   (default: 0.7)
      */
    
    var videoControllerTurnOnDelayTime = 300 ;
    var videoControllerTurnOffDelayTime = 900 ;
    /**
      *   milliseconds
      *   (default: 300 and 900)
      */
    
    var enableHugePlayer = 1 ;
    /**
      *   0 : disabled
      *   1 : enabled (default)
      */
    
    var hugePlayerMinimumMarginWidth = 16 ;
    /**
      *   pixels
      *   (default: 16)
      */
    
    var addFmtToVideoLinks = 0 ;
    /**
      *   integer
      *   (default: 0 as disabled)
      */ 
    
    var autoScrollMode = 0 ;
    /**
      *   0 : disabled (default)
      *   1 : align with player bottom
      *   2 : align with player top
      */
    
    var enableChannelBanner = 1 ;
    /**
      *   0 : disabled
      *   1 : enabled (default)
      */
    
    
    
    GM_addStyle(<><![CDATA[
        
        /* ---- Remove Elements ---- */
        #masthead .logo,
        #masthead #lang-locale-picker-links-wrapper,
        #masthead #upload-wrapper,
        #masthead .nav-item,
        #masthead #masthead-search-term ~ *,
        #masthead .search-left-cap,
        #masthead .search-right-cap,
        #old-footer,
        #copyright,
        #baseDiv > div[class="clear"] ~ div,
        #watch-other-vids #watch-channel-brand-div,
        #watch-other-vids #subscribeDiv,
        #watch-other-vids #watch-url-div,
        #watch-other-vids #watch-embed-div,
        #watch-other-vids #watch-content-badges,
        #watch-other-vids > div:not([id]),
        #watch-this-vid-info #watch-comment-post,
        #watch-this-vid-info #div_main_comment
        {
            display: none !important;
        }
        
        
        /* ---- Background Colors ---- */
        body[class],
        .confirmBox,
        .errorBox,
        #watch-this-vid-info #watch-video-response,
        #watch-this-vid-info #watch-main-area div.watch-action-result
        {
            background: black !important;
        }
        
        #watch-this-vid-info #watch-comments-stats .watch-tabs td,
        #watch-this-vid-info .watch-comment-pagination,
        #watch-this-vid-info .watch-comment-auth-head,
        #watch-this-vid-info #watch-main-area div.signInBoxContent,
        #watch-this-vid-info #commentsHelp
        {
            background: #2d2d2d !important;
        }
        
        #baseDiv > div.title
        {
            background: #151515 !important;
        }
        
        #watch-other-vids #watch-channel-vids-div,
        #watch-other-vids #watch-customize-embed-div,
        #watch-other-vids form.google-checkout,
        #watch-other-vids .watch-body,
        #watch-other-vids .watch-playlist-row-playing,
        #watch-this-vid-info #watch-main-area,
        #watch-this-vid-info #watch-main-area * div,
        #watch-this-vid-info #watch-main-area td,
        #watch-this-vid-info #watch-comments-stats,
        #watch-this-vid-info #watch-comments-stats .watch-tabs td.watch-tab-sel,
        #watch-this-vid-info .watch-comment-head,
        #watch-this-vid-info .watch-comment-head-hidden,
        #watch-this-vid-info .header,
        #watch-this-vid-info .watch-comment-spam,
        #watch-this-vid-info #watch-flag-menu *,
        #masthead #account-dropdown a:hover,
        #masthead #account-dropdown,
        #masthead #account-dropdown div,
        body
        {
            background: #1f1f1f !important;
        }
        
        
        /* ---- Borders ---- */
        #watch-other-vids #watch-channel-vids-div,
        #watch-other-vids .watch-body,
        #watch-this-vid-info .watch-comment-pagination,
        #watch-this-vid-info #watch-video-response
        {
            border: 1px solid #444444 !important;
        }
        
        #watch-other-vids #watch-channel-vids-div,
        #watch-other-vids .watch-body,
        #watch-this-vid-info #watch-video-response,
        #watch-this-vid-info .watch-action-result,
        #watch-this-vid-info #commentsHelp
        {
            -moz-border-radius: 3px !important;
        }
        
        #watch-this-vid-info #watch-main-area,
        #watch-this-vid-info #watch-comments-stats,
        #watch-this-vid-info #watch-comments-stats .watch-tabs td.watch-tab-sel,
        #watch-other-vids .watch-playlist-row-playing,
        #watch-highlight-racy-box
        {
            border: none !important;
        }
        
        #watch-this-vid-info #watch-comments-stats .watch-tabs td,
        #watch-this-vid-info .watch-comment-auth-head
        {
            border-left: 1px solid #444444 !important;
            border-bottom: 1px solid #444444 !important;
        }
        
        #watch-this-vid-info #watch-main-area td
        {
            border-bottom: 1px solid #666666 !important;
        }
        
        #watch-this-vid-info .watch-action-text,
        #watch-this-vid-info #aggregationServicesDiv a,
        #watch-this-vid-info #watch-comments-stats a,
        #baseDiv a.eLink
        {
            border-bottom: none !important;
        }
        
        #watch-this-vid-info .watch-action-result
        {
            border: 1px solid yellowgreen !important;
        }
        
        #masthead #account-dropdown,
        #masthead #account-dropdown div,
        #masthead .util-item,
        #watch-other-vids .watch-discoverbox-divider,
        #watch-other-vids .watch-playlist-container,
        #watch-this-vid-info #watch-active-sharing,
        #watch-this-vid-info #watch-flag-menu *
        {
            border-color: #999999 !important;
        }
        
        #watch-other-vids #watch-url-div,
        #watch-other-vids .watch-extra-desc,
        #watch-other-vids #watch-customize-embed-div,
        #watch-other-vids #watch-customize-embed-theme-swatches,
        #watch-other-vids .watch-google-checkout,
        #watch-this-vid-info .shv-box-title,
        #watch-this-vid-info .watch-shareopts-sectitle,
        #watch-this-vid-info .small-expand-panel,
        #watch-this-vid-info .watch-comment-entry,
        #watch-this-vid-info .watch-comment-marked-spam
        {
            border-color: #666666 !important;
        }
        
        #watch-this-vid-info .shv-box-title,
        #watch-this-vid-info .watch-shareopts-sectitle,
        #watch-this-vid-info .watch-comment-entry,
        #watch-this-vid-info .watch-comment-marked-spam
        {
            border-top-style: dotted !important;
        }
        
        
        /* ---- Text Colors ---- */
        body,
        #watch-other-vids .post-date,
        #watch-this-vid-info h3,
        #watch-this-vid-info .shv-box-titletxt,
        #watch-this-vid-info #watch-some-stats td .watch-stat
        {
            color: silver !important;
        }
        
        #baseDiv > div.title h1,
        #masthead .user-info,
        #masthead  a,
        #watch-other-vids a.expand-header,
        #watch-other-vids #playlist-panel a.expand-header:link,
        #watch-other-vids .smallLabel,
        #watch-other-vids .google-checkout-header,
        #watch-this-vid-info #watch-comments-summary,
        #watch-this-vid-info #watch-comments-summary span,
        #watch-this-vid-info #watch-some-stats td,
        #watch-this-vid-info #watch-some-stats td .lightLabel,
        #watch-this-vid-info .watch-video-response-duration
        {
            color: #999999 !important;
        }
        
        #watch-this-vid-info .watch-comment-action,
        #watch-this-vid-info .watch-comment-action a,
        #watch-this-vid-info .ratedMessage,
        #watch-other-vids #watch-attributions-div .watch-extra-desc,
        #watch-other-vids .vfacets,
        #watch-other-vids .vfacets a,
        #watch-other-vids .quicklist-inlist a,
        .confirmBox
        {
            color: #666666 !important;
        }
        
        #shv-form .button
        {
            color: black !important;
        }
        
        .errorBox
        {
            color: darkorange !important;
        }
        
        a:link,
        a[href$="#"]:visited,
        #watch-other-vids #playlist-panel a:visited,
        #watch-this-vid-info .watch-action-text,
        #watch-this-vid-info a.watch-comment-head-link,
        #masthead #account-dropdown a
        {
            color: #d8f7f7 !important;
        }
        
        a:visited
        {
            color: #92c52a !important;
        }
        
        a:hover,
        a[href$="#"]:hover,
        #watch-other-vids #playlist-panel a:hover,
        #watch-this-vid-info .watch-comment-action a:hover,
        #watch-this-vid-info a.watch-comment-head-link:hover,
        #masthead #account-dropdown a:hover
        {
            color: pink !important;
        }
        
        
        /* ---- Header ---- */
        #masthead
        {
            padding: 0 !important;
            margin: 5px 0 3px 0 !important;
        }
        
        
        /* ---- Header UserInfo ---- */
        #masthead .user-info
        {
            width: auto !important;
            height: auto !important;
            margin: 0 !important;
            padding: 0 5px 0 0 !important;
        }
        
        #masthead #top-margin-links-wrapper
        {
            padding-top: 8px !important;
        }
        
        
        /* ---- Header SearchBar ---- */
        #masthead .search-form
        {
            margin: 0 !important;
            padding: 0 !important;
            position: absolute !important;
            top: 0px !important;
            left: 0px !important;
            width: auto !important;
            height: auto !important;
        }
        
        #masthead .bar
        {
            position: absolute !important;
            top: 0px !important;
            left: 0px !important;
            background: none !important;
            width: auto !important;
            min-width: 450px !important;
            height: auto !important;
            margin: 0 !important;
            padding: 0 !important;
            border: 0 !important;
        }
        
        #masthead .search-wrapper
        {
            margin: 0 !important;
        }
        
        #masthead #masthead-search-term
        {
            border: 1px dashed black !important;
            background: none !important;
            color: #e8de74 !important;
            text-align: center !important;
        }
        
        #masthead #masthead-search-term:hover
        {
            border: 1px dashed #666666 !important;
        }
        
        #masthead #masthead-search-container .search-button-text
        {
            background: none !important;
            -moz-border-radius: 3px !important;
            border: 2px solid darkorange !important;
            color: darkorange !important;
            height: 1.6em !important;
            line-height: 1.6em !important;
            padding: 0 0.8em !important;
        }
        
        
        /* ---- Header Title ---- */
        #baseDiv > div.title
        {
            text-align: center !important;
            padding: 0.3em 0 !important;
            margin: 0 0 20px 0 !important;
        }
        
        
        /* ---- Channel Stat ---- */
        #watch-other-vids #watch-channel-stats
        {
            width: auto !important;
            max-width: 200px !important;
        }
        
        #watch-other-vids #watch-channel-subscribe,
        #watch-other-vids #watch-badges
        {
            width: auto !important;
            max-width: 100px !important;
        }
        
        
        /* ---- Video Quality Setting ---- */
        #watch-this-vid-info #watch-video-quality-setting
        {
            height: 1.6em !important;
            line-height: 1.6em !important;
        }
        
        
        /* ---- Commentary Panel ---- */
        #watch-this-vid-info #watch-comments-stats
        {
            padding-bottom: 1em !important;
            margin-bottom: 1.5em !important;
        }
        
        
        /* ---- Video Controller Mask ---- */
        #watch-this-vid #controller_mask
        {
            height: 25px !important;
            background: black !important;
            position: absolute !important;
        }
        
        #watch-this-vid #watch-player-div
        {
            position: relative !important;
        }
        
        
        /* ---- Rating Stars ---- */
        #watch-this-vid-info #ratingStars
        {
            margin-top: 2px !important;
        }
        
        #watch-this-vid-info #ratingStars img.icn_star_full_19x20,
        #watch-this-vid-info #ratingStars img.icn_star_half_19x20,
        #watch-this-vid-info #ratingStars img.icn_star_empty_19x20
        {
            width: 16px !important;
            height: 16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.icn_star_full_19x20
        {
            background-position: 0px 0px !important;
        }
        
        #watch-this-vid-info #ratingStars img.icn_star_half_19x20
        {
            background-position: -64px -16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.icn_star_empty_19x20
        {
            background-position: -80px -32px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL
        {
            width: 80px !important;
            height: 16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-5\.0
        {
            background-position: 0px 0px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-4\.5
        {
            background-position: 0px -16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-4\.0
        {
            background-position: -16px 0px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-3\.5
        {
            background-position: -16px -16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-3\.0
        {
            background-position: -32px 0px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-2\.5
        {
            background-position: -32px -16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-2\.0
        {
            background-position: -48px 0px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-1\.5
        {
            background-position: -48px -16px !important;
        }
        
        #watch-this-vid-info #ratingStars img.ratingL-1\.0
        {
            background-position: -64px 0px !important;
        }
        
        #watch-this-vid-info #ratingStars img
        {
            background-color: transparent !important;
            background-repeat: no-repeat !important;
            background-attachment: scroll !important;
            background-image: url("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAFAAAAAgCAYAAACFM/9sAAAJW2lDQ1BJQ0MgUHJvZmlsZQAAeAHtlnk41N8awM8Mw2TfKdvY15iGsWdnyJrsEmNmMJ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6/VicXHxWs0PrOZnGmwoXvtGBsjzp7udIAiQSr3l5WV4PB7U/MBqfmhWRJEceqkXCgXkcjnk83kEAgHMz8+LHMe11/zAan4oyGhud8sZqEDc2dnBzMwMgsGg7IdKn3JM+3lV49eJ9O/GaRkoAYxEIpidnUUsFlP9ULWMYdXPk9OLDuXiF9NFSHueBI8eVxweHmJzc/OcH6oClH6Jmh+o8UMNdTJACaKUiVJNSCDP+aEqQFb9PCUDy8WfIz90b28P2WxWfono9Xp0d3crEnlU7SxW/TyFRvn4j2Be8KCnpwdTU1OwWq0g0IrkPEBW/TyFRrX4KQuTW1tblv7+ftCoSOSx5gee4XhVP/Nf8MrdnvotLwAAAAAASUVORK5CYII=") !important;
        }
        
        
        /* ---- Rating Message ---- */
        #watch-this-vid-info #ratingMessage
        {
            width: 300px !important;
            float: none !important;
            clear: none !important;
        }
        
        
        /* ---- Main Area Alignment ---- */
        #watch-this-vid-info #watch-actions-area table
        {
            width: 100% !important;
        }
        
        #watch-this-vid-info #watch-comments-stats table
        {
            width: 100% !important;
        }
        
        #watch-this-vid-info #watch-views-div
        {
            float: right !important;
        }
        
        #watch-this-vid-info #watch-video-responses-children
        {
            margin-left: auto !important;
            margin-right: auto !important;
            width: 626px !important;
        }
        
        #watch-this-vid-info,
        #watch-this-vid #watch-player-div
        {
            margin: 0 !important;
            padding: 0 !important;
        }
        
        #watch-this-vid-info .watch-comment-spam
        {
            margin-left: 0.5em !important;
        }
        
        .shv-message-submit
        {
            margin-left: 266px !important;
        }
        
        
        /* ---- Theater View---- */
        .watch-this-vid-info-longform
        {
            padding-top: 0px !important;
        }
        
        #watch-longform-buttons,
        #watch-longform-ad
        {
            display: none !important;
        }
        
        #watch-longform-vid-title-non h1
        {
            float: none !important;
        }
        
        #baseDiv
        {
            padding: 0 !important;
            margin: auto !important;
        }
        
        
        /* ---- Responses Arrows ---- */
        #watch-this-vid-info .SingleArrowBox img
        {
            height: 44px !important;
        }
        
        #watch-this-vid-info a .LeftSingleArrow
        {
            background-position: 0 -333px !important;
        }
        
        #watch-this-vid-info a:hover .LeftSingleArrow
        {
            background-position: -39px -333px !important;
        }
        
        #watch-this-vid-info a:active .LeftSingleArrow
        {
            background-position: -78px -333px !important;
        }
        
        #watch-this-vid-info a .RightSingleArrow
        {
            background-position: -19px -333px !important;
        }
        
        #watch-this-vid-info a:hover .RightSingleArrow
        {
            background-position: -58px -333px !important;
        }
        
        #watch-this-vid-info a:active .RightSingleArrow
        {
            background-position: -97px -333px !important;
        }
        
        
        /* ---- Video Entry List ---- */
        #watch-other-vids .watch-discoverbox-body
        {
            padding-left: 6px !important;
        }
        
        #watch-other-vids .video-entry
        {
            border-bottom: 1px dotted #777777 !important;
            padding-bottom: 0.2em !important;
            margin-bottom: 0.2em !important;
            margin-right: 6px !important;
        }
        
        #watch-other-vids .video-entry .video-main-content
        {
            float: none !important;
            padding-left: 102px !important;
            width: auto !important;
        }
        
        #watch-other-vids .video-entry .video-view-count,
        #watch-other-vids .video-entry .video-username
        {
            display: inline !important;
            line-height: 1.6em !important;
            height: auto !important;
            margin-right: 0.5em !important;
            color: #aaaaaa !important;
        }
        
        .v90WrapperOuter,
        .v50WrapperOuter,
        .vimg90,
        .vimg50
        {
            border: 1px solid #999999 !important;
        }
        
        .v90WrapperInner,
        .v50WrapperInner
        {
            border: 1px solid #eeeeee !important;
        }
        
    ]]></>);
    
    
    /* ---- Size Layout ---- */
    var watchOtherVidsLeftSpacerWidth = 35;
    var controllerHeight = 25;
    var videoPlayerAspectRatio = 4/3 ;
    
    var videoPlayerHeight = Math.round(videoPlayerWidth * (1/videoPlayerAspectRatio)) + controllerHeight;
    var pageWidth = videoPlayerWidth + rightPaneWidth + watchOtherVidsLeftSpacerWidth;
    GM_addStyle([
        '#baseDiv, #masthead, #baseDiv > div.title',
        '{width: ' + pageWidth + 'px !important;}',
        '#watch-this-vid-info,#watch-this-vid, #watch-this-vid #movie_player',
        '{width: ' + videoPlayerWidth + 'px !important;}',
        '#watch-this-vid #movie_player',
        '{height: ' + videoPlayerHeight + 'px !important;}',
        '#watch-other-vids, #watch-other-vids #watch-channel-brand-cap img',
        '{width: ' + rightPaneWidth + 'px !important;}',
        '#watch-other-vids .watch-playlist-row-middle, #watch-other-vids .watch-playlist-row-middle div',
        '{width: ' + (132 + rightPaneWidth - 300) + 'px !important;}',
        '#watch-other-vids #watch-channel-vids-body .watch-discoverbox',
        '{height: auto !important; max-height: ' + moreFromPanelMaximumHeight + 'px !important;}',
        '#watch-other-vids #more_channel_videos',
        '{height: auto !important; max-height: ' + moreFromPanelMaximumHeight + 'px !important;}',
        '#watch-other-vids #playlistContainer_PL',
        '{height: auto !important; max-height: ' + playlistPanelMaximumHeight + 'px !important;}',
        '#watch-other-vids #playlistContainer_QL',
        '{height: auto !important; max-height: ' + quickListPanelMaximumHeight + 'px !important;}',
        '#watch-other-vids #watch-related-vids-body .watch-discoverbox',
        '{height: auto !important; max-height: ' + relatedVideosPanelMaximumHeight + 'px !important;}',
        '#watch-other-vids #watch-featured-vids-body .watch-discoverbox',
        '{height: auto !important; max-height: ' + relatedVideosPanelMaximumHeight + 'px !important;}'
    ].join(' '));
    
    
    
    /* ---- Functions ---- */
    var doc = document;
    var moviePlayer = doc.getElementById('movie_player');
    
    var forEachElements = function(xpath, func, node) {
        if (!node) node = doc;
        var nodesSnapshot = doc.evaluate(xpath, node, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        for (var i=0; i < nodesSnapshot.snapshotLength; i++) {
            func(nodesSnapshot.snapshotItem(i));
        }
    };
    
    var toggleSearchBarItems = function() {
        var showedSearchBarItems = false;
        var inputFieldID = 'masthead-search-term';
        doc.getElementById(inputFieldID).addEventListener('keyup', function() {
            var textExist = Boolean(this.value);
            if (showedSearchBarItems == textExist) return;
            showedSearchBarItems = textExist;
            var xpath = '//div[@class="search-wrapper"]/*[position()>1]';
            var property = 'display: ' + ((textExist) ? 'inline' : 'none') + ' !important;';
            forEachElements(xpath, function(e) {e.setAttribute('style', property);});
        },
        false);
    };
    
    var stripUrlParameters = function(id, param) {
        var xpath = '//div[@id="' + id + '"]//a[contains(@href, "/watch?")]';
        forEachElements(xpath, function(e) {e.href = e.href.replace(param, '');});
    };
    
    var scrollIntoView = function(elementID, alignWithTop) {
        doc.getElementById(elementID).scrollIntoView(Boolean(alignWithTop));
    };
    
    var appendVideoInfo = function() {
        var toggleAdditionalVideoInfo = function() {
            var xpath = '//div[@id="watch-url-div" or @id="watch-embed-div" or @id="watch-content-badges"]';
            var property = 'display: ' + ((this.id) ? 'block' : 'none') + ' !important;';
            forEachElements(xpath, function(e) {e.setAttribute('style', property);});
        };
        var xpath = '//div[@id="watch-video-details-toggle"]//a';
        forEachElements(xpath, function(e) {e.addEventListener('click', toggleAdditionalVideoInfo, false);});
    };
    
    var expandPlayer = function() {
        var playerExpanded = false;
        moviePlayer.addEventListener('dblclick', function(e) {
            if (e.layerY - moviePlayer.offsetTop >= moviePlayer.clientHeight - controllerHeight) return;
            var watchOtherVids = doc.getElementById('watch-other-vids');
            var controllerMask = doc.getElementById('controller_mask');
            if (playerExpanded) {
                moviePlayer.removeAttribute('style');
                watchOtherVids.style.marginTop = 0;
                if (videoControllerOpacity) {
                    controllerMask.style.width = '100%';
                    controllerMask.style.top = (videoPlayerHeight - controllerHeight) + 'px';
                    controllerMask.style.marginLeft = 0;
                }
                (autoScrollMode) ? scrollIntoView('movie_player', autoScrollMode - 1) : doc.documentElement.scrollIntoView(true);
                playerExpanded = false;
            }
            else {
                var hugePlayer = {
                    width: 0,
                    height: 0,
                    marginBottom: hugePlayerMinimumMarginWidth,
                    marginTop: hugePlayerMinimumMarginWidth,
                    marginLeft: hugePlayerMinimumMarginWidth,
                    style: ''
                };
                var innerHeight = doc.documentElement.clientHeight - (hugePlayer.marginBottom + hugePlayer.marginTop + controllerHeight);
                var innerWidth = doc.documentElement.clientWidth - hugePlayer.marginLeft * 2;
                hugePlayer.width = (innerHeight/innerWidth >= (1/videoPlayerAspectRatio)) ? innerWidth : Math.round(innerHeight * videoPlayerAspectRatio);
                hugePlayer.height = Math.round(hugePlayer.width * (1/videoPlayerAspectRatio)) + controllerHeight;
                if (innerHeight + controllerHeight > hugePlayer.height) {
                    var additionalVerticalMargin = Math.ceil(((innerHeight + controllerHeight) - hugePlayer.height) * 1/2);
                    hugePlayer.marginBottom += additionalVerticalMargin;
                    hugePlayer.marginTop += additionalVerticalMargin;
                }
                if (innerWidth > hugePlayer.width) {
                    if (countElements('//embed[@id="movie_player" and contains(@flashvars, "&fmt_map=22")]') && countElements('//div[@id="watch-video-quality-setting" and @class="high"]')) {
                        hugePlayer.width = (innerWidth/(hugePlayer.height - controllerHeight)<= 16/9) ? innerWidth : Math.round((hugePlayer.height - controllerHeight) * 16/9);
                    }
                    hugePlayer.marginLeft = Math.round((doc.documentElement.clientWidth - hugePlayer.width) * 1/2);
                }
                if (doc.documentElement.clientWidth > pageWidth) {
                    hugePlayer.marginLeft = Math.round((pageWidth - hugePlayer.width) * 1/2);
                }
                
                
                hugePlayer.style = [
                    'height: ' + hugePlayer.height + 'px !important',
                    'width: ' + hugePlayer.width + 'px !important',
                    'margin-bottom: ' + hugePlayer.marginBottom + 'px !important',
                    'margin-top: ' + hugePlayer.marginTop + 'px !important',
                    'margin-left: ' + hugePlayer.marginLeft + 'px !important'
                ].join(';');
                moviePlayer.setAttribute('style', hugePlayer.style);
                watchOtherVids.style.marginTop = (hugePlayer.marginTop + hugePlayer.height + hugePlayer.marginBottom + 10) + 'px';
                if (videoControllerOpacity) {
                    controllerMask.style.width = hugePlayer.width + 'px';
                    controllerMask.style.top = (hugePlayer.marginTop + hugePlayer.height - controllerHeight) + 'px';
                    controllerMask.style.marginLeft = hugePlayer.marginLeft + 'px';
                }
                scrollIntoView('watch-player-div', true);
                playerExpanded = true;
            }
        },
        false);
    };
    
    var dimController = function() {
        var controllerMask = doc.createElement('div');
        controllerMask.id = 'controller_mask';
        controllerMask.style.width = '100%';
        controllerMask.style.top = (videoPlayerHeight - controllerHeight) + 'px';
        controllerMask.style.display = 'block';
        controllerMask.style.opacity = videoControllerOpacity;
        doc.getElementById('watch-player-div').appendChild(controllerMask);
        
        var timeoutID = null;
        
        var toggleControllerMask = function(displayStyle, delayTime) {
            if (timeoutID) return;
            if (controllerMask.style.display == displayStyle) return;
            timeoutID = window.setTimeout(function() {
                controllerMask.style.display = displayStyle;
                timeoutID = null;
            },
            delayTime);
        };
        
        var cancelSetTimeout = function() {
            if (!timeoutID) return false;
            window.clearTimeout(timeoutID);
            timeoutID = null;
            return true;
        };
        
        controllerMask.addEventListener('mouseover', function() {
            toggleControllerMask('none', videoControllerTurnOnDelayTime);
        }, false);
        controllerMask.addEventListener('mouseout', function() {
            cancelSetTimeout() || toggleControllerMask('block', videoControllerTurnOnDelayTime);
        }, false);
        moviePlayer.addEventListener('mouseout', function() {
            toggleControllerMask('block', videoControllerTurnOffDelayTime);
        }, false);
        moviePlayer.addEventListener('mousemove', function(e) {
            if (e.layerY - moviePlayer.offsetTop < moviePlayer.clientHeight - controllerHeight) {toggleControllerMask('block', videoControllerTurnOffDelayTime);}
            else {cancelSetTimeout();}
        }, false);
        moviePlayer.addEventListener('mouseover', function(e) {
            if (e.layerY - moviePlayer.offsetTop >= moviePlayer.clientHeight - controllerHeight) cancelSetTimeout();
        }, false);
    };
    
    var countElements = function(xpath) {
        var count = 0;
        forEachElements(xpath, function(e) {count++});
        return count;
    };
    
    var onClickMoreFromPanelHeader = function(id) {
        var clickedMoreFromPanelHeader = false;
        var xpath = '//div[@id="' + id + '"]/a[@class="expand-header"]';
        forEachElements(xpath, function(e) {e.addEventListener('click', function() {
            if (clickedMoreFromPanelHeader) return;
            var intervalID = window.setInterval(function() {
                if (countElements('//div[@id="' + id + '"]//div[@class="watch-discoverbox-more-link"]') < 1) return;
                setTimeout(function() {
                    if (moreFromPanelMaximumHeight > 302) {
                        if (id == 'watch-channel-videos-panel') {
                            unsafeWindow.performDelayLoad('channel');
                        }
                        else if (id == 'more-from-panel') {
                            unsafeWindow.performDelayLoad('channel_videos');
                        }
                    }
                    stripUrlParameters(id, /&feature=[^&]+/);
                    addFmtParameter(id);
                },
                300);
                clearInterval(intervalID);
            },
            200);
            clickedMoreFromPanelHeader = true;
        },
        false);});
    };
    
    var onClickVideoResponsesArrows = function() {
        var id = 'watch-video-responses-children';
        var xpath = '//div[@id="' + id + '"]/div[contains(@class, "SingleArrowBox")]/a';
        forEachElements(xpath, function(e) {e.addEventListener('click', function() {
            window.setTimeout(function() {
                stripUrlParameters(id, '&watch_response');
                addFmtParameter(id);
            },
            500);
        },
        false);});
    };
    
    var completeQuickListLoad = function() {
        if ((quickListPanelMaximumHeight <= 175 && addFmtToVideoLinks < 1) || doc.getElementById('quicklistDiv').className.indexOf('hide') > -1) return;
        unsafeWindow.completePlaylistLoad();
        var intervalID = window.setInterval(function() {
            if (countElements('//div[@id="playlistRows_QL"]/div[contains(@class, "loading")]') > 0) return;
            window.setTimeout(function() {
                addFmtParameter('quicklistDiv');
                if (countElements('//div[@id="playlistRows_QL"]/div[contains(@class, "watch-playlist-row-playing")]') > 0) {
                    unsafeWindow.scrollPlaylistToVideo('QL', unsafeWindow.qlAutoscrollDestination);
                }
            },
            300);
            clearInterval(intervalID);
        },
        100);
    };
    
    var modPanels = function() {
        var intervalID = window.setInterval(function() {
            if (countElements('//div[@id="watch-related-vids-body" or @id="watch-featured-vids-body"]//div[@class="watch-discoverbox-more-link"]') < 1) return;
            window.setTimeout(function() {
                if (doc.getElementById('watch-channel-videos-panel')) {
                    stripUrlParameters('watch-channel-videos-panel', '&feature=channel');
                    addFmtParameter('watch-channel-videos-panel');
                    onClickMoreFromPanelHeader('watch-channel-videos-panel');
                    if (moreFromPanelMaximumHeight > 302) unsafeWindow.performDelayLoad('channel');
                }
                else if (doc.getElementById('more-from-panel')) {
                    stripUrlParameters('more-from-panel', '&feature=user');
                    addFmtParameter('more-from-panel');
                    onClickMoreFromPanelHeader('more-from-panel');
                    if (moreFromPanelMaximumHeight > 302) unsafeWindow.performDelayLoad('channel_videos');
                }
                
                if (doc.getElementById('watch-related-vids-body')) {
                    stripUrlParameters('watch-related-vids-body', '&feature=related');
                    addFmtParameter('watch-related-vids-body');
                    if (relatedVideosPanelMaximumHeight > 302) unsafeWindow.performDelayLoad('related');
                }
                else if (doc.getElementById('watch-featured-vids-body')) {
                    stripUrlParameters('watch-featured-vids-body', '&feature=featured');
                    addFmtParameter('watch-featured-vids-body');
                    if (relatedVideosPanelMaximumHeight > 302) unsafeWindow.performDelayLoad('featured');
                }
                
                if (doc.getElementById('watch-video-responses-children')) {
                    stripUrlParameters('watch-video-responses-children', '&watch_response');
                    addFmtParameter('watch-video-responses-children');
                    onClickVideoResponsesArrows();
                }
            },
            300);
            clearInterval(intervalID);
        },
        200);
    };
    
    var addFmtParameter = function(id) {
        if (addFmtToVideoLinks < 1) return;
        var xpath = '//div[@id="' + id + '"]//a[contains(@href, "/watch?") and not(contains(@href, "&fmt="))]';
        forEachElements(xpath, function(e) {e.href += '&fmt=' + addFmtToVideoLinks;});
    };
    
    var removeChannelBanner = function() {
        GM_addStyle('#watch-other-vids #watch-channel-brand-cap {display: none !important;}');
    };
    
    var removeTextDecoration = function() {
        var xpath = '//div[@id="watch-other-vids"]//div[@class="watch-playlist-row-middle"]/*';
        forEachElements(xpath, function(e) {
            e.style.textDecoration = 'none';
        });
    };
    
    
    moviePlayer.setAttribute('wmode', 'transparent');
    if (videoControllerOpacity) dimController();
    if (!enableChannelBanner) removeChannelBanner();
    window.addEventListener('load', function() {
        if (autoScrollMode) scrollIntoView('movie_player', autoScrollMode - 1);
        if (enableHugePlayer) expandPlayer();
        removeTextDecoration();
        appendVideoInfo();
        toggleSearchBarItems();
        completeQuickListLoad();
        modPanels();
        addFmtParameter('baseDiv');
    },
    false);
})();