婆罗门
精华
|
战斗力 鹅
|
回帖 0
注册时间 2012-6-10
|
本帖最后由 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
- // @description Makes 【有关】 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[hidden]');
- 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
- });
- })();
复制代码 |
|