Youtube video section cleaner

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);