ScriptsForMsDocToc

MSDN TOC Enhance

目前為 2022-09-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name         ScriptsForMsDocToc
// @namespace    mailto:[email protected]
// @version      0.6.0
// @license      MIT
// @description  MSDN TOC Enhance
// @description:zh 微软文档目录功能新增
// @author       fish-404
// @match        *://docs.microsoft.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    try { 
        // Sticky TOC 
        document.getElementById("affixed-right-container").setAttribute("style", "position: sticky; top: 3vh");
        document.getElementById("right-rail-in-this-article-list").setAttribute("style", "overflow: auto; max-height: 70vh;");

        // Click Show More Button Default
        document.querySelector("button[data-bi-name='show-more-btn']").click();
        document.querySelector('#right-rail-in-this-article-list .is-expanded a').setAttribute("style", "outline: 0"); // remove dash border

        // Move Add Collection Button to TOC
        document.querySelector('div[data-bi-name="right-column"] article div')
            .insertAdjacentElement('beforeend', document.querySelector('button[data-bi-name="collection"]'));
    }
    catch {} // not all page has right sidebar TOC block
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址