YouTube Pinned Video & Scrolling Comments Layout

Modernizes 1080p layout, when scrolling downward it pins the YouTube video to the left-side page, allowing you to watch the video while also providing the ability to scroll/read through comments on the right-side.

目前為 2015-04-07 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name YouTube Pinned Video & Scrolling Comments Layout
// @namespace YFVP3
// @description Modernizes 1080p layout, when scrolling downward it pins the YouTube video to the left-side page, allowing you to watch the video while also providing the ability to scroll/read through comments on the right-side.
// @version 14.25.14.0247
// @include http://*youtube.com/*v=*
// @include https://*youtube.com/*v=*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @author drhouse
// @locale en
// ==/UserScript==

var player = document.getElementById('player')
, content = document.getElementById('watch7-content')
, sideWatch = document.getElementById('watch7-sidebar-contents')
, footer = document.getElementById('footer-container')
, playerRect = player.getBoundingClientRect()

$(document).ready(function () {
    var button = document.createElement("button");
    button.setAttribute("id", "SideButton");
    
    button.setAttribute("class","yt-uix-tooltip-reverse yt-uix-button yt-uix-tooltip");
    button.setAttribute("aria-pressed", "false");
    button.setAttribute("role","button");
    button.setAttribute("type","button");
    button.setAttribute("title","SideButton");
    
    var spant = document.createElement("span");
    spant.setAttribute("class","yt-uix-button-content");
    spant.innerHTML="Toggle";
    
    button.appendChild(spant);
    content.style.display = "block";
    
    document.getElementById('appbar-guide-button-container').appendChild(button);
    document.getElementById('SideButton').addEventListener('click', function() { toggle_visibility(content); }, false);
    
    function toggle_visibility(e){
        if(e.style.display == 'block')
            e.style.display = 'none';
        else
            e.style.display = 'block';
    }
    
});

footer.style.visibility = 'hidden'

window.onload = function(e) {
    player.style.position = 'fixed'
    player.style.top = '0px'
    player.style.right = '750px'
    player.style.zIndex = 997
    
    content.style.position = 'relative'
    content.style.zIndex = 998
    content.style.top = '0px'
    content.style.width = '650px'
    content.style.left = '755px'
    
    sideWatch.style.zIndex = 999
    
}

window.onscroll = function(e) {
    
    if(window.pageYOffset >= playerRect.top && window.pageYOffset > 0) {
        player.style.position = 'fixed'
        player.style.top = '0px'
        player.style.right = '750px'
        player.style.zIndex = 997
                
        content.style.position = 'relative'
        content.style.zIndex = 998
        content.style.top = '80px'
        content.style.width = '650px'
        content.style.left = '755px'
        
        sideWatch.style.zIndex = 999
        
    } else {
        
        player.style.position = ''
        player.style.top = ''
        
        sideWatch.style.position = ''
        sideWatch.style.top = ''
        
        content.style.position = ''
        content.style.top = ''
    }
}