找回密码
 立即注册
查看: 476|回复: 5

[网络] PC端,能否修改utb首页每行显示视频的数量?

[复制链接]
     
发表于 2025-4-26 17:33 | 显示全部楼层 |阅读模式
一行显示4个还是5个都行,但只显示3个太浪费页面了。之前某次改版的时候,我把左侧侧栏收起来,一行还是能显示4个。而最近的改版,收起侧栏都不管用了。通过页面缩放到80%,虽然也能显示4个视频,但是字体小得没法看了。我总不能浏览首页的时候收缩到80%,看视频留言的时候再放大,来来回回太麻烦了
回复

使用道具 举报

发表于 2025-4-26 20:29 | 显示全部楼层
本帖最后由 sunny_am 于 2025-4-26 20:34 编辑

ublock origin
  1. youtube.com##ytd-rich-grid-renderer:style(--ytd-rich-grid-items-per-row: 4 !important;)
复制代码


再加一条改善对齐
  1. youtube.com##ytd-rich-grid-renderer:style(--ytd-rich-grid-gutter-margin: 0px !important;)
复制代码


https://www.reddit.com/r/youtube ... n1/comment/lnw8xu0/
回复

使用道具 举报

     
发表于 2025-4-26 20:42 | 显示全部楼层
本帖最后由 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的

  1. // ==UserScript==
  2. // @Name         【有关】 Multi-Column Layout
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.0
  5. // @description  Makes 【有关】 display more videos per row by modifying CSS variables
  6. // @author       Your Name
  7. // @Match        https://www.【有关】.com/*
  8. // @grant        none
  9. // ==/UserScript==

  10. (function() {
  11.     'use strict';

  12.     // Function to apply the styles
  13.     function applyStyles() {
  14.         // Create a style element
  15.         const style = document.createElement('style');
  16.         style.id = '【有关】-multi-column-style';

  17.         // CSS rules based on the uBlock Origin filters
  18.         style.textContent = `
  19.             ytd-rich-grid-renderer {
  20.                 --ytd-rich-grid-items-per-row: 6 !important;
  21.                 --ytd-rich-grid-posts-per-row: 6 !important;
  22.                 --ytd-rich-grid-gutter-margin: 0px !important;
  23.             }

  24.             ytd-two-column-browse-results-renderer.grid-6-columns {
  25.                 width: 100% !important;
  26.             }

  27.             ytd-two-column-browse-results-renderer.grid:not(.grid-disabled) {
  28.                 max-width: 100% !important;
  29.             }

  30.             ytd-rich-grid-renderer, html {
  31.                 --ytd-rich-grid-slim-items-per-row: 7 !important;
  32.                 --ytd-rich-grid-game-cards-per-row: 7 !important;
  33.             }
  34.         `;

  35.         // Add the style to the head of the document
  36.         document.head.appendChild(style);
  37.     }

  38.     // Function to hide rich shelf renderer
  39.     function hideRichShelfRenderer() {
  40.         const elements = document.querySelectorAll('ytd-rich-shelf-renderer');
  41.         elements.forEach(el => {
  42.             el.setAttribute('is-show-more-hidden', '');
  43.         });
  44.     }

  45.     // Function to remove hidden attribute from rich item renderer
  46.     function removeHiddenFromRichItemRenderer() {
  47.         const elements = document.querySelectorAll('ytd-rich-item-renderer[hidden]');
  48.         elements.forEach(el => {
  49.             el.removeAttribute('hidden');
  50.         });
  51.     }

  52.     // Apply styles immediately
  53.     applyStyles();

  54.     // Run the other functions immediately and on navigation
  55.     hideRichShelfRenderer();
  56.     removeHiddenFromRichItemRenderer();

  57.     // 【有关】 uses AJAX navigation, so we need to reapply on navigation
  58.     const observer = new MutationObserver(() => {
  59.         applyStyles();
  60.         hideRichShelfRenderer();
  61.         removeHiddenFromRichItemRenderer();
  62.     });

  63.     observer.observe(document.body, {
  64.         childList: true,
  65.         subtree: true
  66.     });
  67. })();
复制代码
回复

使用道具 举报

     
发表于 2025-4-26 21:06 | 显示全部楼层
回复

使用道具 举报

     
发表于 2025-4-26 21:53 来自手机 | 显示全部楼层
我现在用的有个叫Youtube Row Fixer的附加组件



----发送自 STAGE1 App for Android.
回复

使用道具 举报

     
 楼主| 发表于 2025-4-27 01:12 | 显示全部楼层
一并谢过楼上诸位
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|上海互联网违法和不良信息举报中心|网上有害信息举报专区|962110 反电信诈骗|举报电话 021-62035905|Stage1st ( 沪ICP备13020230号-1|沪公网安备 31010702007642号 )

GMT+8, 2025-4-28 16:59 , Processed in 0.037139 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表