Cambridge Dictionary Helper

Select text and press a configurable hotkey to show Cambridge Dictionary results with pronunciation + audio. Popup UI is style-isolated using Shadow DOM. Audio playback is CSP-safe by using blob URLs only. TrustedTypes-safe: no innerHTML. Modal key shield: blocks page/browser shortcuts while popup is open.

这些是此脚本变更过代码的版本。 显示所有版本。

  • v1.7.4 2025-12-27

    Changelog (v1.7.4)

    - Fixed a major regression where you could not type in the search box.
    - Root cause: document-level keydown capture was stopping key events before they reached the shadow input.
    - Fix: allow events that originate inside the popup, and stop them from escaping at the shadow root.

    - Added a proper “modal key shield” while the popup is open.
    - Document capture blocks keyboard shortcuts only when the event originates outside the popup.
    - Shadow root blocks key events from bubbling to the page/app while keeping typing/editing behavior intact.

    - Kept Esc handling consistent.
    - Esc closes the popup whether focus is inside or outside the popup.

    - Trusted Types compatibility preserved.
    - UI rendering avoids innerHTML-based updates for the popup content (TrustedHTML-required pages won’t block rendering).

  • v1.7.2 2025-12-27

    - Fixed popup failing on Trusted Types enforced pages (e.g., YouTube/Google properties) by removing all innerHTML usage.
    - Rebuilt Shadow UI and popup body rendering using DOM APIs only (createElement/textContent/appendChild) to be TrustedTypes-safe.
    - Kept existing behavior intact: isolated Shadow DOM UI, CSP-safe audio via blob URLs, hotkey capture, drag/position persistence, and Cambridge parsing.

  • v1.7.0 2025-12-27

    * Added configurable hotkey (capture UI + stored setting) instead of fixed Alt+D
    * Added “Shortcut” menu in the popup (toggles back to main view when clicked again)
    * Moved manual search UI into the header (new row) and removed the old Search button from the body/actions area
    * Added icon close button (✕) instead of text “Close”
    * Added separate UK/US pronunciation display (shows both when available)
    * Added UK/US audio playback buttons and implemented CSP-safe audio playback (fetch MP3 via GM_xmlhttpRequest and play using blob URL)
    * Added “Open” action for viewing the full Cambridge page (useful when extraction/audio fails)
    * Hardened style isolation using Shadow DOM to prevent page CSS from breaking the popup UI
    * Improved overall UI/UX (layout, readability, spacing, header structure) while keeping existing selection + manual typing behavior intact

  • v1.3.0 2025-12-27