A monorepo with two whitelist-based implementations that force links to open in a new tab. The Chrome extension is the primary product; the Tampermonkey userscript remains available but is not on the same release track.
- Chrome Extension: native popup, options page, and content script
- Userscript: Tampermonkey / Greasemonkey menu + settings modal
📖 Official Website | 🧩 Chrome Web Store | 🎯 Greasy Fork Script | 🌟 Star on GitHub
The whitelist-based approach means:
- By default, NO websites are affected - The extension/script does nothing until you add domains
- You control which sites to modify - Add specific domains (e.g., github.com, reddit.com) to your whitelist
- Links open in new tabs only on whitelisted sites - Only the websites you add will have their links modified
- Easy to manage - Add or remove domains anytime through the popup interface or menu commands
- Some pages stay out of reach - Chrome blocks extensions on the Web Store and browser-internal pages; the extension stays silent there and the popup explains why
Example: If you add github.com to your whitelist, all links on GitHub will open in new tabs. Other websites like Google, Twitter, etc., will remain unchanged unless you also add them to the whitelist.
/OpenInNewTab/ (Monorepo Root)
├── userscript/ # Tampermonkey userscript version
│ ├── OpenInNewTab.user.js
│ ├── README.md
│ └── LICENSE
├── extension/ # Chrome extension version
│ ├── manifest.json
│ ├── background.js
│ ├── content.js
│ ├── popup.html
│ ├── popup.js
│ ├── popup.css
│ ├── icons/
│ └── README.md
├── website/ # Official landing page
│ ├── index.html
│ ├── styles.css
│ ├── script.js
│ └── README.md
├── shared/icons/ # Lucide-sourced SVG icons (website + extension)
├── shared/locales/ # i18n single source of truth (ext/us/site × en/zh-CN/zh-TW)
├── shared/i18n.js # Shared i18n runtime (createI18n)
├── scripts/ # Repo tooling (version sync, extension zip, i18n sync)
├── README.md # This file
└── LICENSE # MIT License
Choose your preferred version:
- Best for: Quick testing, development, or users who prefer Tampermonkey
- Install from: Greasy Fork | See userscript/README.md (中文)
- Features: Menu-based management, visited-link marking, dark mode, internationalization
- Best for: Production use, better performance, native browser integration
- Install from: Chrome Web Store | Manual install (中文)
- Features: Popup interface, auto-updates, Web Store distribution
For detailed documentation, please refer to the specific version you want to use:
- Userscript Version (中文) - Complete Tampermonkey/Greasemonkey documentation
- Chrome Extension Version (中文) - Complete Chrome extension documentation
Both versions share the same core functionality and features, but have different installation and usage instructions.
The extension and the userscript are independent products on independent SemVer tracks. They must not be kept in lockstep, and a change to one does not require a version bump on the other. Active development focuses on the extension.
| Product | Version source | Bump command |
|---|---|---|
| Chrome extension | extension/manifest.json; the website's <meta name="app-version" /> tags mirror it |
npm run version:bump:ext |
| Tampermonkey userscript | userscript/OpenInNewTab.user.js — both the // @version metadata line and the SCRIPT_VERSION constant must agree |
npm run version:bump:us |
npm run version:verify— fails if (a) the website meta tags disagree with the manifest, or (b) the userscript's two version locations disagree with each other. The two products are not compared against each other.- Do not bump a product's version unless that product is being released.
Git hook: pre-commit runs version:verify whenever extension/, userscript/, or website/ files are staged, and runs npm run pack:extension whenever extension/ files are staged. The hook no longer auto-bumps — set major / minor / patch manually in the relevant file or run the appropriate version:bump:* command, then commit.
See CHANGELOG.md for release notes (split per product).
Releases are built by CI, never by hand:
-
Bump the version and write the changelog entry in a normal PR (see above), then merge to
main. -
Push a namespaced tag on that merge commit:
git checkout main && git pull git tag extension-v1.7.5 git push origin extension-v1.7.5 -
.github/workflows/release-extension.ymlrunsversion:verify, lint, type-check and the test suite, packsrelease/OpenInNewTab-extension-<version>.zip, and publishes a GitHub Release whose body is the changelog section for that version.
The workflow fails instead of publishing when the tag disagrees with extension/manifest.json, when the tagged commit is not on main, when the changelog has no matching section, or when a release for that tag already exists. Tags are namespaced (extension-v…, later userscript-v…) because the two products have independent version numbers — a bare v1.8.0 would be ambiguous.
node scripts/changelog-section.mjs extension 1.7.5 prints the same notes locally. A dry run of the whole pipeline: tag a commit on a scratch branch and use Actions → Release extension → Run workflow with that tag; it will fail the "tag is on main" guard, which is the intended behaviour.
The Chrome Web Store upload stays manual: attach release/OpenInNewTab-extension-<version>.zip to the store listing, and keep the store assets in store/ in sync.
To skip hooks (e.g. git commit --amend), use HUSKY=0 git commit on Unix shells, or disable Husky for that command per your environment.
MIT License - see LICENSE file for details