YouTube 3 Video Grid Fix

Youtube 3 Grid Fix

目前為 2025-04-24 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         YouTube 3 Video Grid Fix
// @namespace    http://tampermonkey.net/
// @version      1.1.2
// @description  Youtube 3 Grid Fix
// @author       Horizon
// @match        https://www.youtube.com/*
// @exclude      https://www.youtube.com/watch*
// @exclude      https://accounts.youtube.com/*
// @grant        GM_addStyle
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    /* simple but works */
    const p = location.pathname;
    if (p.startsWith('/watch') || p.startsWith('/embed') || p.startsWith('/@') || p.startsWith('/shorts')) {
        return;
    }

    GM_addStyle(`
        ytd-rich-grid-renderer {
            --ytd-rich-grid-items-per-row: 5 !important;
        }

        ytd-rich-grid-renderer > #contents > ytd-rich-grid-row,
        ytd-item-section-renderer ytd-rich-grid-row {
            display: grid !important;
            grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
            gap: var(--ytd-rich-grid-gutter-margin, 16px) !important;
            width: 100% !important;
        }

        ytd-thumbnail {
            max-height: none !important;
            height: auto !important;
            width: 100% !important;
        }

        ytd-thumbnail img {
            width: 100% !important;
            height: 100% !important;
            object-fit: cover !important;
        }
    `);
})();