Youtube Home/Subs - Set videos per row

Allows you to set the number of videos/thumnails per row in the youtube grid system on Home and Subscriptions pages.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ==UserStyle==
@name           Youtube Home/Subs - Set videos per row
@namespace      1N07
@version        0.2.1
@description    Allows you to set the number of videos/thumnails per row in the youtube grid system on Home and Subscriptions pages.
@author         1N07
@license        unlicense
@preprocessor   default

@var number   videosPerRow720   "720p: Videos per row"    [4, 1, 20, 1]
@var number   shortsPerRow720   "720p: Shorts per row"    [6, 1, 20, 1]

@var number   videosPerRow1080  "1080p: Videos per row"   [5, 1, 20, 1]
@var number   shortsPerRow1080  "1080p: Shorts per row"   [8, 1, 20, 1]

@var number   videosPerRow1440  "1440p: Videos per row"   [6, 1, 20, 1]
@var number   shortsPerRow1440  "1440p: Shorts per row"   [10, 1, 20, 1]

@var number   videosPerRow2160  "4K: Videos per row"      [7, 1, 20, 1]
@var number   shortsPerRow2160  "4K: Shorts per row"      [12, 1, 20, 1]
==/UserStyle== */

@-moz-document domain("youtube.com") {
    @media (min-width: 1280px) {
        ytd-browse[page-subtype="subscriptions"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] #contents.ytd-rich-shelf-renderer {
            --ytd-rich-grid-items-per-row: var(--videosPerRow720) !important;
        }
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer {
            --ytd-rich-grid-slim-items-per-row: var(--shortsPerRow720) !important;
        }
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer,
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer {
             --ytd-rich-grid-items-per-row: var(--shortsPerRow720) !important;
        }
    }
    
    @media (min-width: 1920px) {
        ytd-browse[page-subtype="subscriptions"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] #contents.ytd-rich-shelf-renderer {
            --ytd-rich-grid-items-per-row: var(--videosPerRow1080) !important;
        }
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer {
            --ytd-rich-grid-slim-items-per-row: var(--shortsPerRow1080) !important;
        }
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer,
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer {
             --ytd-rich-grid-items-per-row: var(--shortsPerRow1080) !important;
        }
    }
    
    @media (min-width: 2560px) {
        ytd-browse[page-subtype="subscriptions"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] #contents.ytd-rich-shelf-renderer {
            --ytd-rich-grid-items-per-row: var(--videosPerRow1440) !important;
        }
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer {
            --ytd-rich-grid-slim-items-per-row: var(--shortsPerRow1440) !important;
        }
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer,
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer {
             --ytd-rich-grid-items-per-row: var(--shortsPerRow1440) !important;
        }
    }
    
    @media (min-width: 3840px) {
        ytd-browse[page-subtype="subscriptions"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-grid-renderer,
        ytd-browse[page-subtype="home"] #contents.ytd-rich-shelf-renderer {
            --ytd-rich-grid-items-per-row: var(--videosPerRow2160) !important;
        }
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer,
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer {
            --ytd-rich-grid-slim-items-per-row: var(--shortsPerRow2160) !important;
        }
        ytd-browse[page-subtype="home"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer,
        ytd-browse[page-subtype="subscriptions"] ytd-rich-section-renderer #contents.ytd-rich-shelf-renderer {
             --ytd-rich-grid-items-per-row: var(--shortsPerRow2160) !important;
        }
    }
}