Skip to content

Claude/fix options page loading t vy uo#3

Open
Extended3652 wants to merge 24 commits intomainfrom
claude/fix-options-page-loading-TVyUo
Open

Claude/fix options page loading t vy uo#3
Extended3652 wants to merge 24 commits intomainfrom
claude/fix-options-page-loading-TVyUo

Conversation

@Extended3652
Copy link
Copy Markdown
Owner

No description provided.

claude and others added 24 commits February 6, 2026 19:18
ChatGPT's previous fix (a55a0f2) added JS code for mentions fields
(category, aliases, includePatternInContent, note) in the "Add client"
form with null-checks, but never added the actual HTML elements. Also,
the dropdown visual styling (category color backgrounds) only worked on
edit-section selects because populateAddClientDropdowns moved children
from temp selects but left the change handlers on the discarded temps.

- Add missing mentions form fields to options.html (select, textarea,
  checkbox, input) so the JS getElementById calls resolve correctly
- Fix getCategoryStyleByName fColor default: #000000 -> #FFFFFF to
  match category creation default and prevent unreadable dropdown text
- Extract applySelectVisualForCategory as a standalone reusable function
  instead of a closure inside makeCategorySelect
- Wire up one-time change handlers on "Add client" form selects and
  apply styling after populateAddClientDropdowns repopulates them
- Add clients:[] to background.js default dictionary on first install

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
…ck-add

- Rename "Pattern" to "Client Name" and "Review (Default)" to "Default"
  in both the add-client form (HTML) and edit section (JS)
- Add visual separators between Default, Overrides, and Mentions sections
  in both the add form and expanded edit cards
- Move client search bar directly above the client list (was above the
  add-client form, too far from results)
- Reduce client list max-height from 420px to 210px
- Add Clear button to reset the add-client form without deleting data
- Add Save Clients button at bottom of clients section
- Add detected-client banner: options page queries all open tabs via
  chrome.tabs.sendMessage for getClientName, shows current CMS client
  name with a "Fill Form" button, and auto-expands the matching rule
- Add getClientName message handler to content.js so both options page
  and popup can detect the active CMS client
- Add client quick-add section to popup: detects current CMS client
  from active tab, shows rule status, and offers category dropdown +
  Add button if no rule exists yet

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
…ments

Matcher engine (matcher-core.js + tools/matcher.js):
- Wildcard * now matches apostrophes and hyphens (WILD_CH constant)
  Fixes: "d*t burn" matching "doesn't burn", "h*t rec*d" matching "Haven't received"
- Fix meta.isExact typo (was meta.exact), restoring exact-match overlap resolution

Content script (content.js) - full rewrite:
- fColor default fixed from #000000 to #FFFFFF
- Client rules sorted by specificity (non-wildcard first) via prepareClientRules()
- Mentions/aliases now compiled and matched in review text
- Skip client-name navbar element from text walker (prevents "Eliza" in "ElizabethArden")
- Image/photo/media content type detection for overrides
- Auto-refresh on storage.onChanged with 500ms debounce
- Centralized loadAndCompile() for init, refresh, and storage changes

Options page (options.js):
- Fill Form now loads all existing client fields (not just pattern name)
- Race condition fix: detection generation counter prevents stale responses
- Auto-re-detect client on window focus (handles CMS tab switching)

Popup (popup.html):
- Fix triple display:inline-block in .cat-accent CSS

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
Options page:
- Ignore list now renders as the top entry in the Categories section
  instead of a separate section, with "TOP PRIORITY" pill and help text
  explaining // for exact-match ignore entries
- Removed separate ignore list HTML section and JS handlers
- Quick-add and save work the same as before, just in the new location

Content script:
- Fix getStats response to use "categories" key (matches popup.js)

Tests (tools/test_ignore.js):
- 36 focused tests covering ignore list behavior:
  - Substring vs exact (//) ignore entries
  - Wildcard ignore patterns (d*t burn, gifted by *)
  - Boundary space ignore patterns (" elf ")
  - Overlap behavior (store/stores, cups/ups)
  - Case-sensitive ignore entries (CS:)
  - Category priority and overlap resolution
  - Wildcard apostrophe/hyphen matching
  - Multi-word ignore patterns
  - Edge cases (empty, disabled, full-text match)

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Popup: add openEditor() that force-opens without toggling, so
  add/edit/remove/move operations keep the category drawer open
- Popup: drag-and-drop now tracks open editor by category ID so
  reordering doesn't switch which editor is shown
- Background: apply exact/CS flags to ignore list context menu adds
- Content: handle "notify" action from background (was falling to error)
- Options: add duplicate check in quick-add for ignore list and categories

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Delete 4 dead Python patch files (dev artifacts)
- Fix .gitignore duplicate line
- Options: sync ignoreEditorOpen when opening/closing sections
  (prevents ignore list re-opening unexpectedly after re-render)
- Options: quick-add now syncs textarea into array before insert
  (prevents losing manual textarea edits)
- Popup: auto-focus add input after add/edit/remove operations
  (user can keep typing without re-clicking)
- convert.js: add enabled:true to output categories (consistency)

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
Options page:
- Reorder: Categories (top, expanded) > Clients (collapsed) > Import/Export (collapsed)
- All three sections are collapsible with click-to-toggle headers
- Client add-form hidden behind a toggle (reduces visual clutter)
- Auto-expand Clients section + add-form when CMS client is detected

Popup:
- Show detected client name in stats bar (e.g. "3 highlights | 5 categories | ON | Boots")
- Move hint text ("click to edit, Shift+click...") to a persistent spot below search
  instead of repeating it in every open editor

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
User requested Clients list appear before Categories in the options
page layout. Both sections are expanded by default.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
Comprehensive tests covering: exact match boundaries, wildcard
behavior, case sensitivity, boundary spaces, overlap resolution,
ignore interactions, duplicate entries, real-world scenarios,
unicode handling, and degenerate inputs.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Straight/curly quotes now treated as equivalent in matching:
  ' (U+0027) matches ' (U+2018) and ' (U+2019), and vice versa.
  Same for double quotes: " matches " and ".
  Works in patterns, wildcards, LIT: prefix, and ignore list.

- Added 14 new tests: 7 for quote normalization, 7 for escape
  patterns (\*\**, *\*\*, \?, LIT:, mixed escapes).
  Total: 127 tests passing (36 + 91).

- Dictionary audit on options page: automatically scans for
  duplicates, redundant entries (substring makes //exact pointless),
  cross-category shadows, and ignore-vs-category conflicts.
  Shows collapsible warning banner in Categories section.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
The 210px max-height was too small to see a fully expanded client
card with all its fields. Removed the constraint so the list grows
to fit content.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Fix engine bug where "* word" patterns matched with leading space
  (WILD_CH* could match zero chars). Now uses WILD_CH+ in optional
  group for leading wildcards, and WILD_CH+ for trailing wildcards.
- Set client list max-height to 500px (was "none" which was too tall)
- Add search input for filtering categories by word content
- Sort word lists alphabetically when saving (both categories and
  ignore list) using existing sortKey() that strips prefixes
- Add 19 user-reported bug scenario tests (all 146 tests pass)

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
When a middle * has at least 2 literal chars on each side (e.g.
wal*mart), it can now bridge a single space gap, matching "walmart",
"wal mart", and "wal-mart". Short patterns like h*d or s*n still
stay within one word to avoid false positives. Added 3 wal*mart
tests. All 149 tests pass.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
The content script previously matched text per individual text node,
so multi-word patterns like "help with itching" would fail when the
CMS rendered them as separate inline elements (e.g. <span>help with
</span><span>itching</span>).

Now groups consecutive text nodes under the same block-level ancestor,
concatenates their text for matching, then maps matches back to
individual nodes for rendering. This fixes all user-reported cases
where multi-word phrases only partially highlighted or didn't match.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
…actor

Critical fixes:
- Options page now listens for chrome.storage.onChanged to reload
  dictionary when modified by popup or context menu, preventing stale
  overwrites that caused entries to disappear during shifts
- Reverted incomplete merged-regex refactor in tools/matcher.js that
  broke compileAll() (findMatches couldn't iterate categories without
  regexes property)
- Popup: Alt+click move dialog now includes "Ignore List" as a
  destination when moving from a category
- Added 11 new tests for user-reported patterns: bait?*?switch,
  ease of appl*, r*utine* vs //routine, I contacted, along with the,
  discomfort (160 total tests, all passing)
- Added tools/bench.js performance benchmark

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Fix MutationObserver using parentElement instead of blockAncestor() for
  text nodes, which broke cross-node matching on dynamically loaded content
- Fix category renames not updating client override references (overrides
  would silently break when pointing to a renamed category)
- Fix category deletion not cleaning up client override references
- Add diagnostic console logging to client highlight flow so failures
  in client name detection, content type detection, or category lookup
  are visible in DevTools
- Add fallback selectors for client name element detection
- Add save confirmation messages for client override changes
- Add stable sort tiebreaker for client rules
- Remove dev server URL from manifest host_permissions
- Replace silent catch blocks with console.warn logging

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Add fallback selectors for decisionAreaLabel (content type detection)
- Enhance client highlight logging to show available categories, override
  details, and loaded client patterns so issues are visible in DevTools
- Helps debug when overrides appear "not connected" — console will show
  exactly which step fails (selector, rule match, category lookup, etc.)

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
console.debug is hidden by default in Chrome DevTools (requires Verbose
filter). Switch to console.log so client highlight diagnostics are always
visible without changing DevTools settings.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Add getContentRoots() that prefers div.ugcAndDetails, dd.moderatable,
  div.read over document.body — avoids walking the entire DOM
- Add highlightPage() wrapper, replace all highlightAll(document.body)
  calls in init, applyHighlights, toggle handler, and observer
- Trim client rules log (was printing all 307 patterns to console)
- Observer still watches document.body for mutations, but scoped roots
  are used for the actual text node walk + highlight pass

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Normalize NBSP, zero-width chars, and multi-space runs in parseWordEntry()
  so patterns stored from CMS selections match against actual page text
- Update globToRegexFragment() to handle all Unicode whitespace (not just ASCII space)
  in wildcard context checks and space-to-\s+ conversion
- Sanitize context menu selection text in background.js before storing
- Revert aggressive content root scoping (div.ugcAndDetails only) back to
  document.body to ensure all CMS content areas are highlighted
- Auto-scroll to detected client card on options page
- Add 37 new tests covering NBSP, zero-width chars, and reported pattern issues

All 197 tests pass (124 edge + 36 ignore + 19 reported + 18 whitespace).

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
- Fix observer root dedup to check all ancestors (not just direct parent),
  preventing double-highlighting when grandparent and descendant are both
  in the mutation batch
- Disconnect observer during removeAllHighlights() to prevent self-triggered
  mutation processing from queuing up spurious work
- Add characterData watching to MutationObserver so in-place text edits by
  the CMS SPA are caught and re-highlighted
- Clear MARKER_ATTR on changed text nodes' parents so they can be re-walked
- Remove dead code: highlightTextNode() (unused after cross-node matching),
  hasLiteralSpace (declared but never read)
- Improve detectCurrentClient() to prefer the active tab before falling
  back to all tabs (deterministic when multiple CMS tabs are open)

All 197 tests pass.

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
…ation

The characterData observer change introduced in the previous commit created
an infinite cycle: highlighting adds spans → observer sees new text nodes →
MARKER_ATTR cleared → re-highlights → infinite loop.

Three targeted fixes:
- Tag characterData mutations with isCharacterData flag
- Skip addedNodes text nodes whose parent already has MARKER_ATTR (our highlights)
- Only clear MARKER_ATTR for genuine characterData mutations (in-place edits)

https://claude.ai/code/session_012But4vtfTYYQxp2wQZL7Xo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants