修改 Tongyi 页面宽度

当页面打开 https://tongyi.aliyun.com/ 时,修改 class="sc-dChVcU ktbQOR" 元素的 width 样式为 1800。

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         修改 Tongyi 页面宽度
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  当页面打开 https://tongyi.aliyun.com/ 时,修改 class="sc-dChVcU ktbQOR" 元素的 width 样式为 1800。
// @author       YourName
// @match        https://tongyi.aliyun.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 定义一个函数来修改样式
    function modifyWidth() {
        const targetElement = document.querySelector('.sc-dChVcU.ktbQOR');
        if (targetElement) {
            console.log('找到目标元素:', targetElement);
            // 直接修改内联样式
            targetElement.style.width = '1800px';
            console.log('已将 width 修改为 1800px');
        } else {
            console.log('未找到目标元素');
        }
    }

    // 使用 MutationObserver 监听 DOM 变化
    const observer = new MutationObserver(() => {
        modifyWidth();
    });

    // 开始监听整个文档的变化
    observer.observe(document.body, {
        childList: true,
        subtree: true,
    });

    // 页面加载完成后执行一次
    window.addEventListener('load', () => {
        modifyWidth();
    });
})();