Greasy Fork

GitHub 增强套件

融合 GitHub 增强功能:新窗口打开链接、MD 文件目录化、固定页面头部

作者
codeRookieyutaoliu
日安装量
0
总安装量
0
评分
0 0 0
版本
0.8
创建于
2025-03-15
更新于
2025-03-15
大小
11.7 KB
许可证
GPL-3.0
适用于

GitHub 增强套件 / GitHub Enhanced Suite

GitHub

GitHub 增强套件 是一个 Tampermonkey 用户脚本,旨在提升 GitHub、Gitee 和 npmjs 的浏览体验。它集成了多个实用功能,优化了页面交互和导航。


功能 / Features

目前实现的增强功能包括:

  • 新窗口打开链接
    点击 GitHub 内部链接时,自动在新窗口打开,便于多任务浏览。
    Open GitHub internal links in a new window automatically for multitasking.

  • MD 文件目录化
    为 README.md 等 Markdown 文件生成悬浮目录导航,支持拖动和滚动高亮,提升文档阅读效率。
    Generate a floating table of contents for README.md and other Markdown files, with drag support and scroll highlighting.

  • 固定页面头部
    将 GitHub 页面顶部的导航栏固定在屏幕顶部,滚动时始终可见,方便快速导航。
    Fix the GitHub page header at the top of the screen for easy navigation during scrolling.


功能演示 / Demo

固定页面头部 / Fixed Page Header

Fixed Header Demo
页面滚动时,顶部导航栏保持固定 / The top navigation bar remains fixed while scrolling.

MD 文件目录化 / Markdown TOC

TOC Demo
悬浮目录按钮,点击展开,支持拖动和高亮 / Floating TOC button, expandable, draggable, and with highlighting.


使用 / Usage

安装 / Installation

  1. 安装 Tampermonkey
    在你的浏览器(Chrome、Firefox、Edge 等)中安装 Tampermonkey 扩展

  2. 添加脚本

    • 复制以下完整脚本代码: ```javascript // ==UserScript== // @name GitHub 增强套件 // @namespace http://tampermonkey.net/ // @version 0.8 // @description 融合 GitHub 增强功能:新窗口打开链接、MD 文件目录化、固定页面头部 // @author lecoler & contributors // @match ://github.com/ // @match ://gitee.com//* // @match ://npmjs.com//* // @include *.md // @icon https://github.com/favicon.ico // @license GPL-3.0 // @run-at document-start // ==/UserScript== // ... (完整代码见上方改进版本) 打开 Tampermonkey 仪表盘,点击“+”新建脚本,将代码粘贴进去,保存即可。 验证 访问 GitHub(如 https://github.com),确认功能生效: 点击链接在新窗口打开。 README.md 页面显示目录按钮。 顶部导航栏固定。 注意事项 / Notes 兼容性 脚本已在 GitHub、Gitee 和 npmjs 上测试,可能不完全适配所有页面布局。如遇问题,请反馈。 调试 如果功能未生效,打开浏览器开发者工具 (F12),查看控制台是否有日志提示(如“未找到页面头部元素”)。 自定义 你可以编辑脚本代码,调整样式(如头部背景色)或禁用某些功能。 关于 / About GitHub 增强套件 灵感来源于社区需求和现有插件(如 github-enhance-plugin),旨在为开发者提供更高效的 GitHub 体验。

Inspired by community needs and existing plugins (e.g., github-enhance-plugin), enhancing the GitHub experience for developers.

开源许可 / License 本项目采用 GPL-3.0 开源许可。

贡献 / Contribution 欢迎提交问题或改进建议!请通过 GitHub Issues 反馈,或直接修改代码提交 Pull Request。

Footer © 2025 GitHub, Inc. | 由社区驱动的开源项目 / Community-driven open-source project

text