- TypeScript 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Ports a previously hand-maintained .user.js to the repo's TS/vite toolchain. Also splits the build into one Vite config per script (vite-plugin-monkey builds a single userscript per config), since this is now the second script sharing dist/. |
||
| dist | ||
| src | ||
| .gitignore | ||
| package.json | ||
| pnpm-lock.yaml | ||
| README.md | ||
| tsconfig.json | ||
| vite.config.cahiers-text-selection.ts | ||
| vite.config.gitlab-tab-titles.ts | ||
userscripts
Personal Tampermonkey userscripts, written in TypeScript and built with vite-plugin-monkey.
Scripts
GitLab Tab Titles (src/gitlab-tab-titles/)
Browsers show the page's <title> on a tab and truncate it from the end once
it's too long to fit. GitLab's issue/MR titles put the distinguishing part —
the #123 issue number or !456 MR number — at the end, e.g.:
Fix login redirect (!1070) · Merge requests · server / public-site · GitLab
With several GitLab tabs open, they all get cropped to the same prefix and become indistinguishable. This script rewrites the tab title so the id comes first instead:
!1070 · Fix login redirect
Currently matches https://gitlab.edc4it.com/*. To cover another GitLab
instance, add another match entry in vite.config.gitlab-tab-titles.ts —
the title format is the same across GitLab instances, so no logic changes are
needed.
Cahiers du Cinéma Text Selection (src/cahiers-text-selection/)
The Cahiers du Cinéma kiosque site disables text selection (user-select: none) on its reader pages, which also blocks browser translation. This
script injects a stylesheet that forces user-select: text everywhere.
Installing
Browsers require an explicit click to install any userscript, so there's one manual step no matter what — after that, Tampermonkey handles updates itself.
- Install once: open a built script's raw URL — e.g. https://forgejo.rappappa.com/rparree/userscripts/raw/branch/main/dist/gitlab-tab-titles.user.js or https://forgejo.rappappa.com/rparree/userscripts/raw/branch/main/dist/cahiers-text-selection.user.js — Tampermonkey will pop up its install dialog.
- Stay updated automatically: each script's
@updateURL/@downloadURLpoint at that same raw path. Tampermonkey periodically re-checks it (or use its "Check for userscript updates" action) and pulls in new commits with no further clicks.dist/is committed to git for exactly this reason — do not add it back to.gitignore.
Development
Each script has its own Vite config (vite.config.<script-name>.ts), since
vite-plugin-monkey builds one userscript per config.
pnpm install
pnpm dev:<script-name> # vite dev server with hot reload for that script
pnpm build # builds every script into dist/<name>.user.js
pnpm build:<script-name> # build just one script
pnpm test # vitest
For active development, pnpm dev:<script-name> prints a userscript URL that
installs a small loader pulling code live from the running dev server —
install that loader once, and further pnpm dev:<script-name> sessions
hot-reload without reinstalling. When done, run pnpm build and commit the
updated dist/ output so the @updateURL users are on picks it up.
Adding another script
- Create a new folder under
src/<script-name>/. Keep DOM-touching code in a thinmain.ts, and put the actual logic in a pure, unit-testable module (seegitlab-tab-titles/transform.tsfor the pattern) whenever there's meaningful non-DOM logic to test — a purely DOM-side-effect script likecahiers-text-selectiondoesn't need one. - Copy
vite.config.gitlab-tab-titles.tstovite.config.<script-name>.tsand adjustentry,userscript(including its own@updateURL/@downloadURL), andbuild.fileName. Keepbuild.emptyOutDir: falseso builds don't wipe other scripts' output. - Add matching
dev:<script-name>/build:<script-name>entries topackage.json, and include the newbuild:<script-name>inbuild.