您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动根据窗口大小调整 YouTube 首页视频列数,居中排版,封面尺寸统一,频道页不影响!
// ==UserScript== // @name YouTube 自适应列数 + 居中 + 卡片统一高度 // @namespace http://tampermonkey.net/ // @version 1.6 // @description 自动根据窗口大小调整 YouTube 首页视频列数,居中排版,封面尺寸统一,频道页不影响! // @author ChatGPT // @match https://www.youtube.com/ // @match https://www.youtube.com/?* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; const isHomePage = location.pathname === "/" && !location.pathname.startsWith("/channel") && !location.pathname.startsWith("/@"); if (!isHomePage) return; const style = document.createElement('style'); style.innerHTML = ` ytd-rich-grid-renderer #contents { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important; column-gap: 16px !important; row-gap: 0px !important; max-width: 100% !important; margin: 0 auto !important; padding: 0 24px !important; box-sizing: border-box !important; } ytd-rich-item-renderer { width: 100% !important; box-sizing: border-box !important; margin: 0 !important; height: 300px !important; overflow: hidden !important; } ytd-thumbnail.ytd-rich-grid-media { aspect-ratio: 16 / 9 !important; height: auto !important; width: 100% !important; overflow: hidden !important; } ytd-thumbnail.ytd-rich-grid-media img { width: 100% !important; height: 100% !important; object-fit: cover !important; } ytd-thumbnail.ytd-rich-grid-media img { height: 100% !important; object-fit: cover !important; } #video-title { max-height: 2.8em !important; overflow: hidden !important; display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; } ytd-rich-section-renderer { display: none !important; } `; document.head.appendChild(style); })();