node文档助手

43 阅读1分钟

写了一个油猴脚本左侧和内容进行对应

// ==UserScript==
// @name         node中文文档助手
// @namespace    https://www.runoob.com/
// @version      0.1.0
// @description  优化node文档,控制滚动条,方便学习。
// @author       wk
// @match        https://nodejs.cn/api/*/*
// @run-at document-end
// ==/UserScript==

(function () {
    setInterval(() => {
       let a = document.querySelectorAll("#column2 > ul:nth-child(5) > li > a")
       a.forEach(element => {
         if (element.className.indexOf("active") > -1) {
            element.style.backgroundColor = "red"
            // element.scrollIntoView()
         }
       });
    }, 10 * 1000)

})();

安装地址: node中文文档助手 - 代码 (scriptcat.org)