您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Fixes YouTube’s oversized thumbnails with a customizable grid: More videos per row, full width, and no gaps — for a compact, efficient layout.
当前为
- // ==UserScript==
- // @name YouTube Big Thumbnails Fix
- // @namespace https://greasyfork.org/users/1461079
- // @version 1.4
- // @description Fixes YouTube’s oversized thumbnails with a customizable grid: More videos per row, full width, and no gaps — for a compact, efficient layout.
- // @author Michaelsoft
- // @match *://www.youtube.com/*
- // @grant GM_addStyle
- // @run-at document-start
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- // === SETTINGS ===
- const settings = {
- videosPerRow: 6, // Change this to set videos per row (e.g. 4, 5, 6, etc.)
- disableShorts: false, // Set to true to completely hide the Shorts section
- enableShowMoreFix: true, // Set to false to show only 1 row of Shorts (disables "Show More" force-expand)
- };
- // === Apply CSS customizations ===
- GM_addStyle(`
- ytd-rich-grid-renderer {
- --ytd-rich-grid-items-per-row: ${settings.videosPerRow} !important;
- --ytd-rich-grid-posts-per-row: ${settings.videosPerRow} !important;
- --ytd-rich-grid-gutter-margin: 0px !important;
- --ytd-rich-grid-slim-items-per-row: 7 !important; /* Number of shorts per row */
- --ytd-rich-grid-game-cards-per-row: 7 !important; /* Number of game cards per row (possibly redundant) */
- }
- ytd-two-column-browse-results-renderer.grid-${settings.videosPerRow}-columns {
- width: 100% !important;
- }
- ytd-two-column-browse-results-renderer.grid:not(.grid-disabled) {
- max-width: 100% !important;
- }
- /* Hide Shorts completely if setting is enabled */
- ${settings.disableShorts ? `
- ytd-rich-section-renderer.style-scope.ytd-rich-grid-renderer {
- display: none !important;
- }
- ` : ''}
- `);
- // === "Show More" / hidden content fix ===
- if (settings.enableShowMoreFix) {
- const observer = new MutationObserver(() => {
- document.querySelectorAll('ytd-rich-item-renderer[hidden]').forEach(el => {
- el.removeAttribute('hidden');
- });
- document.querySelectorAll('ytd-rich-shelf-renderer').forEach(el => {
- el.setAttribute('is-show-more-hidden', '');
- });
- });
- observer.observe(document.documentElement, {
- childList: true,
- subtree: true
- });
- }
- })();