PC端,能否修改utb首页每行显示视频的数量?
一行显示4个还是5个都行,但只显示3个太浪费页面了。之前某次改版的时候,我把左侧侧栏收起来,一行还是能显示4个。而最近的改版,收起侧栏都不管用了。通过页面缩放到80%,虽然也能显示4个视频,但是字体小得没法看了。我总不能浏览首页的时候收缩到80%,看视频留言的时候再放大,来来回回太麻烦了 本帖最后由 sunny_am 于 2025-4-26 20:34 编辑ublock origin
youtube.com##ytd-rich-grid-renderer:style(--ytd-rich-grid-items-per-row: 4 !important;)
再加一条改善对齐
youtube.com##ytd-rich-grid-renderer:style(--ytd-rich-grid-gutter-margin: 0px !important;)
https://www.reddit.com/r/youtube/comments/1fkkcn1/comment/lnw8xu0/ 本帖最后由 rrpw777 于 2025-4-26 20:47 编辑
编辑完发现和楼上的出处一样。我记得【有关】原来是违禁词啊。
https://www.reddit.com/r/【有关】/comments/1fkkcn1/comment/lnw8xu0/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
ubo还在的话直接按照里面说的加规则就行。由于我上次被chrome忽悠把UBO卸载了,换成lite了,所以让ds改写了一个油猴脚本,没有仔细测过。注意自己查找替换一下文字
--ytd-rich-grid-items-per-row是每行几个
--ytd-rich-grid-slim-items-per-row是shorts的
// ==UserScript==
// @Name 【有关】 Multi-Column Layout
// @namespace http://tampermonkey.net/
// @version 1.0
// @descriptionMakes 【有关】 display more videos per row by modifying CSS variables
// @author Your Name
// @Match https://www.【有关】.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to apply the styles
function applyStyles() {
// Create a style element
const style = document.createElement('style');
style.id = '【有关】-multi-column-style';
// CSS rules based on the uBlock Origin filters
style.textContent = `
ytd-rich-grid-renderer {
--ytd-rich-grid-items-per-row: 6 !important;
--ytd-rich-grid-posts-per-row: 6 !important;
--ytd-rich-grid-gutter-margin: 0px !important;
}
ytd-two-column-browse-results-renderer.grid-6-columns {
width: 100% !important;
}
ytd-two-column-browse-results-renderer.grid:not(.grid-disabled) {
max-width: 100% !important;
}
ytd-rich-grid-renderer, html {
--ytd-rich-grid-slim-items-per-row: 7 !important;
--ytd-rich-grid-game-cards-per-row: 7 !important;
}
`;
// Add the style to the head of the document
document.head.appendChild(style);
}
// Function to hide rich shelf renderer
function hideRichShelfRenderer() {
const elements = document.querySelectorAll('ytd-rich-shelf-renderer');
elements.forEach(el => {
el.setAttribute('is-show-more-hidden', '');
});
}
// Function to remove hidden attribute from rich item renderer
function removeHiddenFromRichItemRenderer() {
const elements = document.querySelectorAll('ytd-rich-item-renderer');
elements.forEach(el => {
el.removeAttribute('hidden');
});
}
// Apply styles immediately
applyStyles();
// Run the other functions immediately and on navigation
hideRichShelfRenderer();
removeHiddenFromRichItemRenderer();
// 【有关】 uses AJAX navigation, so we need to reapply on navigation
const observer = new MutationObserver(() => {
applyStyles();
hideRichShelfRenderer();
removeHiddenFromRichItemRenderer();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})(); https://greasyfork.org/zh-CN/scripts/533051-%E4%BF%AE%E6%94%B9youtube%E9%A6%96%E9%A1%B5%E5%B8%83%E5%B1%80 我现在用的有个叫Youtube Row Fixer的附加组件
----发送自 STAGE1 App for Android. 一并谢过楼上诸位
页:
[1]