YouTube Normal Thumbnails

Restores normal thumbnails size

目前为 2019-10-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         YouTube Normal Thumbnails
// @namespace    http://gf.qytechs.cn
// @version      0.2
// @description  Restores normal thumbnails size
// @author       NeoCortex
// @match        https://www.youtube.com/
// @grant        none
// ==/UserScript==

(function() {
    const target = document.querySelector('ytd-rich-grid-renderer'),
        config = {
            attributes: true,
            childList: false,
            subtree: false
        },
        fixStyle = function() {
            target.style.cssText =
                target.style.cssText.replace(
                    /\-\-ytd\-rich\-grid\-items\-per\-row\:\s*\d{1,3}\;/,
                    '--ytd-rich-grid-items-per-row: 5;'
                );
        },
        callback = function(mutationsList, observer) {
            for (let mutation of mutationsList) {
                if (mutation.attributeName == 'style') {
                    observer.disconnect();
                    fixStyle();
                    observer.observe(target, config);
                }
            }
        };

    fixStyle();
    const observer = new MutationObserver(callback);
    observer.observe(target, config);

    var s = document.createElement('style');
    s.innerHTML = 'ytd-rich-grid-video-renderer[mini-mode] #video-title.ytd-rich-grid-video-renderer {font-size: 1.3rem;}';
    document.body.appendChild(s);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址