Skip to content

FeikoWielsma/psu-tier-userscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

70 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PSU Tier List Userscript πŸ”Œ

Firefox Add-on Chrome Web Store Build Status Latest Release Platforms License Ruff ESLint

A tool that turns SPL's PSU Tier List (a Google Sheet) into a userscript that injects coloured Tier badges directly onto power-supply listings on PCPartPicker (all regions) and Tweakers.net, so you can judge PSU quality at a glance.

Badges show match confidence: a solid badge is a confident match, a dashed Tier X? badge is a likely match. Click any badge for full specs, the confidence score, and other candidate matches.

Warning

Manufacturer naming is inconsistent across the tier sheet, PCPartPicker and Tweakers (and those three disagree with each other). The matcher is good but false positives/negatives happen β€” always confirm on the official spreadsheet before buying. The badge confidence and "other possible matches" list are there to make disagreement visible rather than hidden.

πŸš€ Installation

The easiest way is the official store listing for your browser β€” one click, with automatic updates. Prefer not to use a store? Manual and userscript options are below.

Option 1: Official browser stores (Recommended)

Get the Firefox Add-on
🦊 Get it for Firefox
Get it on the Chrome Web Store
🟒 Get it for Chrome
  • Firefox β†’ Add to Firefox from Mozilla Add-ons (AMO).
  • Chrome β†’ Add to Chrome from the Chrome Web Store.
  • Brave, Edge, Opera, Vivaldi & other Chromium browsers β†’ install straight from the Chrome Web Store link above β€” these browsers accept Chrome Web Store extensions directly. Notes:
    • Brave: open the Chrome Web Store link, click Add to Brave. If prompted, allow Chrome Web Store extensions (Brave enables this by default).
    • Edge: open the link in Edge; the first time you may see a banner to Allow extensions from other stores β€” click it, then Add to Chrome β†’ Add extension.
    • Opera: install Install Chrome Extensions first, then use the Chrome Web Store link.

Option 2: Manual install (no store account / sideload)

Firefox

  1. Go to the Releases page.
  2. Download the signed psutier-extension.xpi file.
  3. Open Firefox, drag and drop the .xpi file into the browser (or press Ctrl+O / Cmd+O and select it) to install it. No extension manager required!

Chrome / Brave / Edge

  1. Download psutier-extension.zip from the Releases page and extract it.
  2. Open chrome://extensions, brave://extensions, or edge://extensions.
  3. Toggle Developer mode on (top-right).
  4. Click Load unpacked and select the extracted folder.

Option 3: Userscript (Requires Manager)

  1. Install a userscript manager:
    • Brave / Chrome / Edge (Chromium): install Violentmonkey (or Tampermonkey) from the Chrome Web Store.
    • Firefox: install Violentmonkey/Tampermonkey from Add-ons.
  2. Brave/Chrome only β€” enable user scripts (required since Chromium tightened Manifest V3): open the extension's Details, and turn on "Allow User Scripts" if shown; on older builds toggle Developer mode on brave://extensions instead. (One-time step.)
  3. Download the latest psutier.user.js from the Releases page β€” your manager will offer to install it.

Option 4: Tweakers custom CSS (no extension, Tweakers only)

Tweakers' own custom CSS carries the tier badges with no extension or userscript manager at all β€” just enable the shared snippet:

β–Ά Enable the snippet on Tweakers β€” toggle it on and reload the Pricewatch.

It's Tweakers Pricewatch only (no PCPartPicker) and a static snapshot of the tier list β€” new products / tier changes appear when the snippet is updated.

To (re)generate it yourself (or build a different variant), see tools/README-tweakers-css.md:

  • boxed (default, ~40 KB) β€” filled tier pills, matching the extension's look.
  • lite (~37 KB) β€” colored tier letter only.
  • popup β€” pills plus a hover spec popup, abusing ::before content.

Finally, visit a PCPartPicker PSU listing or the Tweakers Pricewatch and look for the badges.

πŸ“Έ Screenshots

Badges on PCPartPicker

PCPartPicker Badges

Detail Specs Popup (after clicking badge)

Details Popup

Badges on Tweakers.net

Tweakers Badges

🧠 How it works

Google Sheet ──gviz CSV──► fetch_sheet.py ──► psu_tier.csv
                                              β”‚
                          parse_tier_list.py β”€β”˜β”€β”€β–Ί psu_data.json
                                              β”‚
        β”Œβ”€β”€ src/matcher.js  (matching engine, single source of truth)
        β”œβ”€β”€ src/adapters.js (per-site DOM extraction)
        β”œβ”€β”€ data/normalization_rules.json (declarative tuning)
        └── src/userscript.template.js (UI)
                                              β”‚
                        generate_userscript.py ──► psutier.user.js
  • Data source is the sheet's gviz CSV export (stable columns, no HTML scraping, no third-party Python deps).
  • Matching (src/matcher.js) tokenizes the product name and each candidate model and scores a weighted token overlap. It also uses the storefront's structured columns as signals, not just the name: wattage and form factor (ATX vs SFX) are hard filters, and efficiency disambiguates variants. When a name is too thin to score on its own (e.g. "NZXT C750" β†’ just "c"), those signals resolve it by constraint (wattage + efficiency + form factor). The winning score is the confidence shown on the badge. This is the single source of truth β€” the userscript and the test suite run the exact same code.
  • There are no hardcoded per-product hacks. Naming quirks are fixed by editing data, not code (see below).

Fixing a naming mismatch (the extension point)

Edit data/normalization_rules.json:

  • aliases β€” rewrite incoming product names (e.g. ASUS "850G" β†’ "850 gold").
  • strip β€” remove descriptors that differ across sources and never identify a model (ATX version tags, the 80+ prefix, …); applied to both sides.
  • generic / noise β€” words that score low / are dropped.
  • thresholds / weights β€” confidence bands and scoring balance.

Add a case to tests/corpus.json, run npm test, done.

Supporting a new site

Add one entry to src/adapters.js: { id, match, selector, filter?, extract, insertBadge }, where extract(row) returns { name, wattage, efficiency, formFactor, modular } (pull as many of those from structured columns as the site exposes β€” the matcher uses them).

πŸ› οΈ Development

Prerequisites: Python 3 (standard library only) and Node.js 20+. This repo uses uv for Python.

git clone https://github.com/FeikoWielsma/psu-tier-userscript.git
cd psu-tier-userscript
npm install

Build + test (deterministic, no network β€” uses the committed data snapshot):

python test_suite.py        # build + lint + typecheck + run npm test
npm run check               # eslint + tsc --checkJs + tests
npm test                    # just the JS tests
npm run lint                # ESLint (src, tests, tools)
npm run typecheck           # tsc --checkJs (type inference, no JSDoc needed)
uvx ruff check .            # Python lint

Refresh data from the live sheet and rebuild:

python generate_userscript.py --update

Testing

  • npm test β€” offline, deterministic, CI-safe:
    • tests/test_matching.js runs the real matcher over tests/corpus.json (hand-labelled cases, incl. verbose real PCPP names) against the committed tests/fixtures/sample_psu_data.json.
    • tests/test_adapters.js runs the real adapters over saved HTML fixtures via linkedom β€” including full real PCPartPicker pages in tests/fixtures/pcpp/ (100 rows each) to catch name/wattage extraction and DOM drift.
    • tests/test_coverage.js runs the matcher over ~900 real, deduplicated product names (tests/fixtures/pcpp-products.json) and asserts it never throws and overall match coverage stays above a floor. (A full listing includes many genuinely unrated units, so <100% is expected.)
  • Live browser (local, on demand β€” never in CI):
    npx playwright install chromium          # once
    npm run capture                          # refresh tests/fixtures/*.html
    npm run smoke                             # inject the script, report matches
    # drive Brave instead of bundled Chromium:
    node tools/live_capture.mjs --smoke --browser-path "C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe" --headed
    These do a handful of normal page loads with pauses β€” not bulk scraping.

πŸ€– CI/CD

  • CI (.github/workflows/ci.yml): runs npm test (the deterministic gate), does a non-fatal live fetch/parse structure check, then builds and uploads the userscript artifact.
  • Release (.github/workflows/release.yml): pushing a v* tag runs the tests, builds from the latest sheet, and publishes a GitHub Release with psutier.user.js.

πŸ“œ Credits


Not affiliated with PCPartPicker, Tweakers, or the spreadsheet maintainers.

About

Userscript that injects coloured PSU quality Tier badges (from SPL's PSU Tier List) onto PCPartPicker and Tweakers.net power-supply listings, with match-confidence indicators.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors