YouTube评论精选固定

YouTube评论区精选滚动条

// ==UserScript==
// @name         YouTube评论精选固定
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  YouTube评论区精选滚动条
// @author       Aoki
// @match        *://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    var css = '{display:none !important;height:0 !important}';
    css += '::-webkit-scrollbar-thumb{background-color: #888;border-radius: 4px;}';
    css += '::-webkit-scrollbar-thumb:hover{background-color: #555;}';
    css += '::-webkit-scrollbar-track{background-color: #f5f5f5;}';
    css += '::-webkit-scrollbar-track:hover{background-color: #ddd;}';
    css += '#sections{overflow: scroll;height: 70rem;}';
    css += '#secondary{overflow: scroll;height: 80rem;}';
    css += '::-webkit-scrollbar{width: 8px;background-color: #f5f5f5;}';

    loadStyle(css)
    function loadStyle(css) {
        var style = document.createElement('style');
        style.type = 'text/css';
        style.rel = 'stylesheet';
        style.appendChild(document.createTextNode(css));
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(style);
    }
})();