added logic to always show site text count
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user