Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

---

## [1.8.1] - 2026-05-20

### Fixed
- **Date stamp leaking into spoken body** — `DATE_RE` was using `\b` word boundaries, which silently fail when the Angular DOM renders inline elements without whitespace separators (e.g. `"AliceMay 20"`). Boundaries removed; the `\s+\d{1,2}` suffix is already specific enough to avoid false positives.
- **Last-name/badge residue in body** — `normalizeMsg` now strips each individual word of the sender's full name from the body start (catches the case where full-name stripping fails because another fragment precedes it), then strips any leading badge words. This closes the loop on messages still read as `FirstName Month Day FullName message`.

---

## [1.8.0] - 2026-05-19

### Changed
Expand Down
16 changes: 14 additions & 2 deletions streaming-message-reader.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Streaming Message Reader
// @namespace https://github.com/sbcmsbgithub/streaming-message-reader
// @version 1.8.0
// @version 1.8.1
// @description Reads live chat messages aloud on configured sites. Pick any element as the watched container. Includes playback controls, ignore list, voice/rate/volume settings, and time/first-name options.
// @match *://*/*
// @grant none
Expand Down Expand Up @@ -219,7 +219,9 @@
const URL_RE = /https?:\/\/\S+|www\.\S+/gi;
// Matches date stamps like "May 18" or "May 18, 2026" injected by the chat UI into
// the element's innerText — stripped from the body before speaking.
const DATE_RE = /\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2}(?:,?\s*\d{4})?\b/gi;
// No \b boundaries — the Angular DOM can concatenate inline elements without spaces
// (e.g. "AliceMay 20"), which breaks \b. The \s+\d{1,2} suffix is specific enough.
const DATE_RE = /(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2}(?:,?\s*\d{4})?/gi;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reinstate end boundary in date-stripping regex

Removing the trailing \b from DATE_RE makes the cleaner delete month/day substrings inside normal words such as "May 20th" (it now strips "May 20" and leaves "th"). This is a regression from the previous pattern and will corrupt spoken message content whenever users include ordinal dates, even though those are not UI-injected date chips.

Useful? React with 👍 / 👎.


function getMessageRoot(node) {
if (!(node instanceof HTMLElement)) return null;
Expand Down Expand Up @@ -422,6 +424,16 @@
msg.body = stripSenderFromStart(msg.body, firstName);
}
msg.body = msg.body.replace(TS_LEADING, '').trim();
// Strip individual name words (e.g. leftover last name when full-name match failed).
if (msg.fullSender) {
msg.fullSender.split(/\s+/).filter(p => p.length > 1).forEach(part => {
msg.body = stripSenderFromStart(msg.body, part);
Comment on lines +429 to +430

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require word boundary when stripping sender name parts

The new per-word sender stripping pass calls stripSenderFromStart for each token of fullSender, but that helper matches raw prefixes without a boundary. This means a sender part can delete the start of an unrelated word (e.g., sender "Ann Lee", body "Leeds won" becomes "ds won"), causing message text corruption in production chat reads.

Useful? React with 👍 / 👎.

});
}
// Strip any leading badge words that survived extraction.
const bw = msg.body.split(/\s+/);
while (bw.length && BADGE_WORDS.has(bw[0].toUpperCase())) bw.shift();
msg.body = bw.join(' ').trim();
// Final catch-all: if a "Name: " or "First Last: " prefix survived all the
// sender-specific passes, remove it. Targets the chat UI injecting the
// username into the body element itself.
Expand Down