gitee左侧宽度自适应

将 index_goodlook-scroller___xbXb 同级的 w-76 宽度设为 auto !important

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         gitee左侧宽度自适应
// @namespace    http://tampermonkey.net/
// @license MIT
// @version      1.0
// @description  将 index_goodlook-scroller___xbXb 同级的 w-76 宽度设为 auto !important
// @author       zr
// @match        https://gitee.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    if (location.origin !== 'https://gitee.com') return;

    /* 立即执行一次 */
    fixSiblingW76();

    /* 监听后续动态插入 */
    const obs = new MutationObserver(fixSiblingW76);
    obs.observe(document.body, { childList: true, subtree: true });

    function fixSiblingW76() {
        // 找到所有 index_goodlook-scroller___xbXb 节点
        document.querySelectorAll('.index_goodlook-scroller___xbXb').forEach(scroller => {
            // 获取它的父节点,然后在其所有直接子节点中筛选 .w-76
            scroller.parentElement
                   ?.querySelectorAll(':scope > .w-76')
                   .forEach(el => el.style.setProperty('width', 'auto', 'important'));
        });
    }
})();