鸿蒙文档 侧边目录宽度调整

调整鸿蒙OS文档的侧边目录的宽度

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         鸿蒙文档 侧边目录宽度调整
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  调整鸿蒙OS文档的侧边目录的宽度
// @author       Asjun
// @match        https://developer.harmonyos.com/cn/docs/*
// @icon         https://www.google.com/s2/favicons?domain=harmonyos.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(function() { setWidth(); }, 2000);
})();

function setWidth() {
    if (document.querySelector("#documentMenu") == undefined) {
         return;
    }
    var width = '216px';
    var node = document.querySelector("#auiAnchorTarget > div > app-document-page > div:nth-child(1) > nz-layout > nz-sider.left-sider.ant-layout-sider");

    node.style.minWidth = width;
    node.style.maxWidth = width;
    node.style.width = width;

    node = document.querySelector("#documentMenu");
    node.style.width =width;
    
    node = document.querySelector("#documentMenu > div");
    node.style.marginLeft='16px';
    
    node = document.querySelector("#auiAnchorTarget > div > app-document-page > div:nth-child(1) > nz-layout > nz-content > div");
    node.style.marginLeft = '32px';
    node.style.marginRight = '32px';
}