# Highlands Statcast Chrome Extension

This unpacked Chrome extension captures the current GameChanger page HTML and uploads box score or All Plays imports to the Highlands Statcast backend queue from the extension popup. Schedule imports check the Statcast database first by GameChanger event id and skip box scores or play-by-play pages that are already loaded.

## Install locally

Version 0.1.11 also skips GameChanger's "Event is not scored" error pages,
including coach views. Batch imports stop trying the remaining pages of that game.

Version 0.1.8 skips schedule links and redirects ending in `/info`, including
Import Current Page. A redirect skips the remaining pages for that game.
After updating this folder, click Reload for the extension at `chrome://extensions`.

1. Open Chrome and go to `chrome://extensions`.
2. Turn on **Developer mode**.
3. Click **Load unpacked**.
4. Choose this folder: `chrome-extension`.

## Use it

1. Browse to a GameChanger box score or **Plays > All Plays** page.
2. Click the Highlands Statcast extension button.
3. Enter your Highlands Statcast username/password once.
4. Click **Import Current Page**.

## Batch import a team schedule

### Refresh visible teams (0.1.9)

Version 0.1.10 matches source names despite URL punctuation differences such as
`HTB` versus `(HTB)` and curly apostrophes. Season restrictions still apply.

Open Statcast, select a single season, then open the extension and click
**Refresh Visible Teams**. Keep the popup open until it finishes and stay signed
in to GameChanger. The extension reads saved source URLs for visible teams in
that season, opens their schedules in background tabs, and imports missing game
pages. Already imported pages and `/info` games are skipped. Missing source URLs
and unreadable schedules are reported at the end. This queues backend processing;
refresh Statcast after processing finishes to see updated totals.

1. Browse to the team's GameChanger schedule page.
2. Click the Highlands Statcast extension button.
3. Click **Import Schedule Games**.

The extension finds each schedule game link, captures the rendered `box-score` and `plays` pages, uploads them to the Statcast backend queue, and closes each temporary tab. AWS processes the raw HTML after upload so the popup does not have to wait for full stat parsing.

The extension stores the Statcast username/password in Chrome extension local storage. It does not use or store AWS credentials.
