51 lines
3.1 KiB
Markdown
51 lines
3.1 KiB
Markdown
# Plex Auto Skip
|
|
|
|
A small Chrome extension that automatically clicks "Skip Intro" and "Skip Credits" on Plex Web, so you don't have to reach for the mouse every time.
|
|
|
|
## Features
|
|
|
|
- Watches the Plex Web player and clicks "Skip Intro" / "Skip Credits" the instant either button appears.
|
|
- Works on `app.plex.tv` by default, or point it at your own server address (local IP, custom domain, whatever you use).
|
|
- Toggle Skip Intro and Skip Credits independently — both on by default.
|
|
- Settings save instantly and apply live, no reload required for toggle changes.
|
|
|
|
## Install
|
|
|
|
1. Download or clone this repo.
|
|
2. Open `chrome://extensions` in Chrome.
|
|
3. Turn on **Developer mode** (top right toggle).
|
|
4. Click **Load unpacked** and select this project's folder.
|
|
5. Click the extension's icon in the toolbar to open its settings.
|
|
|
|
## Settings
|
|
|
|
- **Plex URL** — defaults to `app.plex.tv`. Choose "Custom URL" and enter your own server address (e.g. `192.168.1.50:32400/web` or a custom domain) if you watch there instead.
|
|
- **Skip Intro** / **Skip Credits** — both on by default. Uncheck either one if you'd rather click it yourself sometimes.
|
|
|
|
Changing the Plex URL takes effect on your next page load — refresh your Plex tab after saving a new one. Toggle changes apply immediately.
|
|
|
|
## How it works
|
|
|
|
The extension's content script runs on every page but only activates once the page's hostname matches your configured Plex URL. From there it uses a `MutationObserver` to watch the page for any `<button>` or `[role="button"]` element whose visible text contains "skip intro" or "skip credit" (case-insensitive, so it still matches if Plex appends a countdown like "Skip Intro 0:05"). When a match appears and is actually visible, it clicks it — with a short cooldown per element so a single button can't be double-clicked in one burst, but can still be clicked again later if Plex reuses the same button for the next episode.
|
|
|
|
Settings (your Plex URL and the two toggles) are stored with `chrome.storage.sync`, so they follow you across machines if you're signed into Chrome.
|
|
|
|
## Testing
|
|
|
|
This project has an automated test suite that simulates the Plex Web DOM with [jsdom](https://github.com/jsdom/jsdom) and exercises the real extension code — no browser or live Plex server required.
|
|
|
|
```
|
|
npm install
|
|
npm test
|
|
```
|
|
|
|
The suite covers: clicking Skip Intro/Skip Credits, ignoring non-Plex pages, respecting the on/off toggles, matching a custom server URL, reacting to buttons added dynamically after page load, ignoring unrelated buttons, handling countdown suffixes in the button text, not clicking hidden buttons, correctly re-clicking a reused button after its cooldown, and the settings popup's save/validation/load behavior.
|
|
|
|
## Troubleshooting
|
|
|
|
If skipping stops working after a Plex Web update, it's most likely because Plex changed the button markup. Open DevTools on the player page, inspect the Skip Intro/Skip Credits button, and check whether it's still a `<button>` or `[role="button"]` element with "Skip Intro"/"Skip Credits" somewhere in its visible text. Open an issue (or a PR) with what you find.
|
|
|
|
## License
|
|
|
|
MIT — see [LICENSE](LICENSE).
|