Youtube video section cleaner

Unclutters the video page on Youtube's video section and resizes it

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Youtube video section cleaner
// @description Unclutters the video page on Youtube's video section and resizes it
// @include     /^http(|s)://www\.youtube\.com/watch\?v=.*$/
// @grant       none
// @author      iceman94
// @copyright   2014+, iceman94
// @version     0.01
// @grant       none
// @namespace   2883c859593dd67ceaea42331264acf6
// ==/UserScript==


// Wraps all the code in a single function to bypass issues with some browsers
function main()
{

// Gets browser's current height and width
var w = window.screen.availWidth;
var h = window.screen.availHeight;

// Sets video player size to browser's size minus reserved height and width
var rh = 5;
var rw = 5;
var vw = rw * w / 100;
vw = w - vw;
var vh = rh * w / 100;
vh = h - vh;

// Video container manipulation
var vidc = document.getElementsByClassName('html5-video-container')[0];
vidc.style.width = vw + 'px';
vidc.style.height = vh + 'px';

// Adds the video container directly to the body
var bdy = document.getElementById('body');
bdy.appendChild(vidc);

// Main video manipulation
var vidm = document.getElementsByClassName('video-stream html5-main-video')[0];
vidm.style.width = vw + 'px';
vidm.style.height = vh + 'px';

// Removes all clutter but the video container itself
var clutter = document.getElementById('body-container');
clutter.parentNode.removeChild(clutter);


}; //<-- DON'T REMOVE, CLOSES MAIN FUNCTION

// Call the main function with a delay of 1 second
setTimeout(main, 100);