A personal collection of Tampermonkey
userscripts. Each script is self-contained under scripts/<name>/ with its own
src/, tests, meta.json, and built dist/<name>.user.js.
| Script | What it does | Install |
|---|---|---|
| Masonry Image Gallery | View every image on any page as a Pinterest-style masonry wall, with lightbox + keyboard nav (Ctrl+Alt+G), plus single/batch/zip image downloads. |
Install |
Clicking Install with Tampermonkey enabled opens the install prompt directly; Tampermonkey then auto-updates the script when a new version is pushed.
Built with vite-plugin-monkey.
npm install # one-time: dev deps (vite, vite-plugin-monkey, vitest, playwright)
npm run build # build every script -> scripts/<name>/dist/<name>.user.js
npm run build <name> # build just one script
npm run dev <name> # hot-reload dev server for one script (see below)
npm test # vitest unit tests across all scripts
npm run test:e2e # playwright e2e (build first)npm run dev <name> starts a vite dev server for that script. It prints an
Install URL — open it once with Tampermonkey to install a tiny proxy
userscript that loads your locally-served code. After that, every edit to
src/ live-updates in the browser, no rebuild or re-paste. Stop the server and
run npm run build <name> for the final committed artifact.
- Create
scripts/<name>/with:meta.json— userscript metadata (see below).vite.config.js— copy an existing one; it readsmeta.json, so usually no edits beyond the path are needed.src/main.js— entry point; import the rest ofsrc/from here.test/— optional*.test.js(vitest) and*.spec.js(playwright e2e).README.md— what it does + install.
npm run build <name>producesscripts/<name>/dist/<name>.user.js.- Add a row to the table above.
vite.config.js feeds this file to vite-plugin-monkey, which renders the
==UserScript== header and auto-fills @namespace, @downloadURL, and
@updateURL from the repo coordinates in vite.config.js. version here is
the single source of truth — bump it and push the rebuilt dist/ to ship an
update.
{
"name": "Masonry Image Gallery",
"slug": "masonry-image-gallery",
"version": "1.1.0",
"description": "…",
"author": "kouxing2000",
"match": ["*://*/*"],
"grant": ["GM_registerMenuCommand", "GM_getValue", "GM_setValue"],
"runAt": "document-idle",
"noframes": true
}Supported keys: name, slug, version, description, author, match[],
include[], grant[], require[], runAt, noframes.
- Bump
versionin the script'smeta.json. npm run build <name>and commit the changeddist/<name>.user.js.- Push to
main. Tampermonkey picks up the new version via@updateURL.