From 744d5b3a03ad09ee0154701527ff2764a2ee4b2b Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Thu, 28 May 2026 16:13:18 +0800 Subject: [PATCH] fix(dict): restore MDD eager init; CSP-safe audio handler; gate binary uploads on sync category (#4337) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(dict): restore MDD eager init; CSP-safe Vocabulary.com audio handler Two MDict fixes: 1. **Regression**: #4334 turned on `MDD.create(..., { lazy: true })` so the audio / resource side of every MDict would skip the upfront key-block decode + sort. That's the right trade-off on the MDX side (millions of headwords, ~80 s init saving), but it doesn't transfer to MDDs: js-mdict's lazy lookup binary-searches `keyInfoList` envelopes with `comp` (localeCompare), and MDDs store keys in byte-sorted order with `\` prefixes and case folding. The two orders disagree just often enough that `mdd.locateBytes('sound.png')` misses on resource paths that do exist — the icon's CSS `background-image: url(sound.png)` then stays unresolved and the speaker glyph disappears. Bisected to 93abca89 (#4334). Drop the flag for MDDs; MDXs keep the lazy win. 2. **New**: a CSP-safe replacement for the `onclick="v0r.v(this,'KEY')"` audio handler used by Vocabulary.com-derived MDicts. The dict's `j.js` is never loaded inside our shadow root (we don't execute MDX-supplied JavaScript), so without intervention the inline handler would throw `ReferenceError: v0r is not defined` on every click. The new helper parses the audio key from any matching onclick, strips that one attribute, and binds our own listener that probes the companion MDD for `.mp3` / `.m4a` / etc. and plays the bytes through an `