您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
文档滚动时目录悬浮
// ==UserScript== // @name 网道文档助手 // @namespace http://tampermonkey.net/ // @version 1.0.0-2024-05-22 // @description 文档滚动时目录悬浮 // @author cshaptx4869 // @match https://wangdoc.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=wangdoc.com // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Your code here... var tocElement = document.querySelector('.article-toc'); var fixedElement = tocElement.cloneNode(true); var panelInfoElement = document.querySelector('.panel-info'); fixedElement.style.display = 'none'; fixedElement.style.position = 'sticky'; fixedElement.style.top = '1.5rem'; panelInfoElement.after(fixedElement); window.addEventListener('scroll', function() { var rect = panelInfoElement.getBoundingClientRect(); if (rect.top < 0 || rect.bottom > window.innerHeight) { fixedElement.style.display = 'block'; } else { fixedElement.style.display = 'none'; } }); })();