Fit video on Browser Window

Adds a button at the right of the video title that makes the video take up the entire window space.

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Fit video on Browser Window
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a button at the right of the video title that makes the video take up the entire window space.
// @author       Matías Pierdoménico
// @match        https://www.youtube.com/*
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// @run-at document-end
// ==/UserScript==

window.addEventListener("spfdone", run);
window.addEventListener("yt-navigate-start", run);

(function() {
    'use strict';

    if (document.readyState == "complete" || document.readyState == "loaded" || document.readyState == "interactive") {
        run();
    } else {
        document.addEventListener("DOMContentLoaded", function(event) {
            run();
        });
    }
})();

function run() {
    var popupUrl = window.location.href.replace(/watch/, "watch_popup");
    $("#watch-headline-title").append("<div><a href='".concat(popupUrl).concat("'><button id='fill-win-btn'>Fill window</button></a></div>"));
    //css styling
    $("#fill-win-btn").css({
        "color": "#fefefe",
        "background-color": "#e62117",
        "padding": "8px",
        "float":"right",
        "cursor":"pointer"
    });
    $("#watch-headline-title .watch-title-container").css({
        "float":"left"
    });
}