Youtube - Wide video container

wide video container on youtube

Tính đến 11-03-2019. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Youtube - Wide video container
// @namespace   1N07
// @author      1N07
// @description wide video container on youtube
// @include     https://www.youtube.com/*
// @version     1.6.1
// @grant       none
// ==/UserScript==

if(!!document.getElementById("early-body")) { //if old youtube
    document.getElementById("content").setAttribute("style", "width: 99%;");
} else { //new youtube
	addGlobalStyle(`
		#page-manager > ytd-browse:not([page-subtype="playlist"]) ytd-two-column-browse-results-renderer.ytd-browse,
		ytd-browse ytd-video-masthead-ad-v3-renderer.ytd-browse 
		{
			box-sizing: border-box;
			width: 99%;
			width: calc(100% - 20px) !important;
			position: relative !important;
		}
	`);
}

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}