added logic to always show site text count

This commit is contained in:
2026-01-19 19:17:57 -05:00
parent a5e413e216
commit d3f7b63a79
3 changed files with 148 additions and 10 deletions

View File

@@ -596,6 +596,7 @@ async function refreshToolbar() {
let refreshTimer = null;
let contentChangeTimer = null;
function scheduleToolbarRefresh() {
if (refreshTimer) return;
refreshTimer = window.setTimeout(() => {
@@ -610,9 +611,22 @@ function scheduleToolbarRefresh() {
}, 200);
}
function scheduleContentChangeNotice() {
if (contentChangeTimer) return;
contentChangeTimer = window.setTimeout(() => {
contentChangeTimer = null;
chrome.runtime.sendMessage({ type: "SITE_CONTENT_CHANGED" }, () => {
if (chrome.runtime.lastError) {
return;
}
});
}, 250);
}
const observer = new MutationObserver(() => {
if (suppressObserver) return;
scheduleToolbarRefresh();
scheduleContentChangeNotice();
});
observer.observe(document.documentElement, { childList: true, subtree: true });