No description
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
claude b5647334f0 Add Cahiers du Cinéma text-selection userscript
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/.
2026-07-09 09:05:37 +02:00
dist Add Cahiers du Cinéma text-selection userscript 2026-07-09 09:05:37 +02:00
src Add Cahiers du Cinéma text-selection userscript 2026-07-09 09:05:37 +02:00
.gitignore Enable auto-updates via committed dist and @updateURL/@downloadURL 2026-07-09 08:58:59 +02:00
package.json Add Cahiers du Cinéma text-selection userscript 2026-07-09 09:05:37 +02:00
pnpm-lock.yaml Add GitLab tab titles userscript 2026-07-09 08:50:53 +02:00
README.md Add Cahiers du Cinéma text-selection userscript 2026-07-09 09:05:37 +02:00
tsconfig.json Add GitLab tab titles userscript 2026-07-09 08:50:53 +02:00
vite.config.cahiers-text-selection.ts Add Cahiers du Cinéma text-selection userscript 2026-07-09 09:05:37 +02:00
vite.config.gitlab-tab-titles.ts Add Cahiers du Cinéma text-selection userscript 2026-07-09 09:05:37 +02:00

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.

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

  1. Create a new folder under src/<script-name>/. Keep DOM-touching code in a thin main.ts, and put the actual logic in a pure, unit-testable module (see gitlab-tab-titles/transform.ts for the pattern) whenever there's meaningful non-DOM logic to test — a purely DOM-side-effect script like cahiers-text-selection doesn't need one.
  2. Copy vite.config.gitlab-tab-titles.ts to vite.config.<script-name>.ts and adjust entry, userscript (including its own @updateURL/@downloadURL), and build.fileName. Keep build.emptyOutDir: false so builds don't wipe other scripts' output.
  3. Add matching dev:<script-name> / build:<script-name> entries to package.json, and include the new build:<script-name> in build.