Skip to content

Repository files navigation

⏭️ GitHub Page Jump

github-page-jump-demo-2

A zero-build Chrome Manifest V3 extension that adds to GitHub's numeric pagination:

  • ⏮️ Jump-to-first-page button
  • 🔢 Type a page number and press Enter to jump
  • ⏭️ Jump-to-last-page button
  • 📌 Click the toolbar icon to toggle "Fixed pagination", which pins the paginator to the bottom of the viewport (off by default)

🎨 Controls use GitHub's Primer color variables, automatically adapting to GitHub's light, dark, and high-contrast themes, and support GitHub's partial page navigation.

📦 Install

  1. Open chrome://extensions/ in Chrome.
  2. Enable "Developer mode" in the top-right corner.
  3. Click "Load unpacked".
  4. Select the cloned folder (the one containing manifest.json).
  5. Open or refresh any GitHub page with numeric pagination.

🔒 The extension only runs on https://github.com/*, uses the storage permission solely to remember your preferences, and never collects or sends data.

🐒 Userscript

Every release also ships a Tampermonkey userscript built from the same sources:

  1. Install the Tampermonkey extension.
  2. Download github-page-jump.user.js from the latest release.
  3. Confirm the Tampermonkey install prompt.

The "Fixed pagination" toggle lives in the Tampermonkey menu, and new releases update automatically through the release attachment.

🛠️ Development

The extension has no runtime dependencies and no build step. Run the full test suite with:

npm test

The source is split by responsibility:

  • src/core.js contains pure pagination and URL logic.
  • src/shared.js owns localization, setting definitions, and the Chrome Storage adapter.
  • src/pagination.js adapts GitHub pagination markup and manages injected controls.
  • src/content.js and src/popup.js are thin entry points.
  • scripts/build-userscript.js packages the shared modules into the Tampermonkey userscript (npm run build:userscript).
  • scripts/userscript-boot.js provides the userscript-only storage adapter, menu toggle, and boot.

Add support for new GitHub markup through PAGINATION_ADAPTERS. Register new preferences once in SETTING_DEFINITIONS, then consume them through the shared settings store. Keep manifest.json and tests/fixture.html script order aligned when adding a source module.

Releases

Keep the versions in package.json and manifest.json identical. On every push to main, GitHub Actions checks whether the v<version> tag exists on the remote; when it does not, the workflow runs the tests, packages the extension and the userscript, creates the tag, and publishes a GitHub Release with both attached. Versions that already have a tag are skipped.

📄 License

MIT


🇨🇳 中文

一个无需构建步骤的 Chrome Manifest V3 扩展,为 GitHub 数字分页器增加:

  • ⏮️ 跳转到第一页按钮
  • 🔢 输入页码并按回车跳转
  • ⏭️ 跳转到最后一页按钮
  • 📌 点击工具栏图标可开关“固定分页器”,开启后分页器悬浮固定在视口底部(默认关闭)

🎨 控件使用 GitHub 的 Primer 颜色变量,自动适配 GitHub 的亮色、暗色与高对比度主题,并支持 GitHub 的局部页面导航。

📦 安装

  1. 打开 Chrome 的 chrome://extensions/
  2. 打开右上角的“开发者模式”。
  3. 点击“加载已解压的扩展程序”。
  4. 选择克隆下来的项目文件夹(即包含 manifest.json 的目录)。
  5. 打开或刷新任意带数字分页器的 GitHub 页面。

🔒 扩展只在 https://github.com/* 中运行,storage 权限仅用于记住你的偏好设置,不会收集或发送数据。

🐒 油猴脚本

每个 Release 都会附带由同一套源码构建的 Tampermonkey 用户脚本:

  1. 安装 Tampermonkey 扩展。
  2. 从最新 Release 下载 github-page-jump.user.js
  3. 在 Tampermonkey 的安装提示中确认即可。

“固定分页器”开关位于 Tampermonkey 菜单中,发布新版本后会通过 Release 附件自动更新。

🛠️ 开发

扩展没有运行时依赖,也不需要构建。运行完整测试:

npm test

源码按职责拆分:core.js 负责纯分页逻辑,shared.js 负责本地化与设置存储,pagination.js 负责适配 GitHub DOM 和控件生命周期,content.jspopup.js 只负责启动与绑定;scripts/build-userscript.js 把共享模块打包成 Tampermonkey 用户脚本(npm run build:userscript),scripts/userscript-boot.js 提供用户脚本专用的存储适配器、菜单开关与引导。

支持新的 GitHub 分页结构时扩展 PAGINATION_ADAPTERS;增加偏好设置时先在 SETTING_DEFINITIONS 中注册,再通过共享设置存储访问。新增源码模块后,需要同步 manifest.jsontests/fixture.html 中的脚本顺序。

发布

package.jsonmanifest.json 中的版本号必须保持一致。每次推送到 main 后,GitHub Actions 会检查远端是否存在对应的 v<版本号> tag:不存在时自动运行测试、打包扩展与油猴脚本、创建 tag,并发布附带两者的 GitHub Release;已有 tag 的版本会自动跳过。

📄 许可证

MIT

About

Adds first-page, last-page, and direct page-jump controls to every GitHub pagination — jump to any page in one click or keystroke.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages