Skip to content
Merged
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
9 changes: 5 additions & 4 deletions content-scripts/content.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let highlights = [];
let currentUrl = window.location.href;
let currentUrl = window.location.href.replace(/#selection-[\d.]+-[\d.]+$/, '');

let currentColors = [];
const contentCore = window.TextHighlighterCore;
Expand Down Expand Up @@ -68,15 +68,16 @@ function injectNavigationBridge() {
}

function handleUrlChange(nextUrl, trigger = 'unknown') {
if (!nextUrl || nextUrl === currentUrl) return;
const normalizedUrl = nextUrl ? nextUrl.replace(/#selection-[\d.]+-[\d.]+$/, '') : nextUrl;
if (!normalizedUrl || normalizedUrl === currentUrl) return;

debugLog('Detected URL change:', {
trigger,
previousUrl: currentUrl,
nextUrl,
nextUrl: normalizedUrl,
});

currentUrl = nextUrl;
currentUrl = normalizedUrl;
highlights = [];

if (typeof hideHighlightControls === 'function') {
Expand Down
Loading