fix: restore missing isInNonChatArea + SKIP_REVEAL_TAGS from unmerged branch
Root cause found: commit 9a11896 (v2.0.14) added isInNonChatArea()
and expanded SKIP_REVEAL_TAGS with NAV/ASIDE/HEADER/FOOTER, but that
commit was on a branch that was never merged into main. When we started
our work from main, these fixes were missing.
Restored:
- isInNonChatArea() function — prevents reveal from touching sidebars,
navigation, headers, footers, and other non-chat UI
- SKIP_REVEAL_TAGS expanded with NAV, ASIDE, HEADER, FOOTER
- isInNonChatArea checks added to revealInElement, unrevealInElement,
and highlightMatches (both element-level and walker-level)
https://claude.ai/code/session_01KF4i7Ra7zCEDskxDBaNtcT
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Silent Send",
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.15",
|
||||
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Silent Send",
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.15",
|
||||
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
||||
"permissions": [
|
||||
"storage",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "silent-send",
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.15",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"description": "Browser extension that substitutes personal data before sending to AI services",
|
||||
|
||||
+12
-1
@@ -1504,8 +1504,8 @@
|
||||
function revealInElement(el) {
|
||||
if (SKIP_REVEAL_TAGS.has(el.tagName)) return;
|
||||
if (el.classList?.contains('ss-reveal-badge')) return;
|
||||
// Never touch contenteditable elements (chat input boxes)
|
||||
if (el.isContentEditable) return;
|
||||
if (isInNonChatArea(el)) return;
|
||||
|
||||
const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, {
|
||||
acceptNode(node) {
|
||||
@@ -1513,6 +1513,7 @@
|
||||
if (parent && SKIP_REVEAL_TAGS.has(parent.tagName)) return NodeFilter.FILTER_REJECT;
|
||||
if (parent?.closest?.('.ss-autodetect-warning, .ss-presend-warning, .ss-reveal-badge')) return NodeFilter.FILTER_REJECT;
|
||||
if (parent?.closest?.('[contenteditable="true"]')) return NodeFilter.FILTER_REJECT;
|
||||
if (isInNonChatArea(parent)) return NodeFilter.FILTER_REJECT;
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
}
|
||||
});
|
||||
@@ -1532,11 +1533,13 @@
|
||||
function unrevealInElement(el) {
|
||||
if (SKIP_REVEAL_TAGS.has(el.tagName)) return;
|
||||
if (el.isContentEditable) return;
|
||||
if (isInNonChatArea(el)) return;
|
||||
|
||||
const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, {
|
||||
acceptNode(node) {
|
||||
const parent = node.parentElement;
|
||||
if (parent?.closest?.('[contenteditable="true"]')) return NodeFilter.FILTER_REJECT;
|
||||
if (isInNonChatArea(parent)) return NodeFilter.FILTER_REJECT;
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
}
|
||||
});
|
||||
@@ -1571,6 +1574,7 @@
|
||||
if (parent && SKIP_REVEAL_TAGS.has(parent.tagName)) return NodeFilter.FILTER_REJECT;
|
||||
if (parent?.closest?.('.ss-autodetect-warning, .ss-presend-warning, .ss-reveal-badge')) return NodeFilter.FILTER_REJECT;
|
||||
if (parent?.closest?.('[contenteditable="true"]')) return NodeFilter.FILTER_REJECT;
|
||||
if (isInNonChatArea(parent)) return NodeFilter.FILTER_REJECT;
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
}
|
||||
});
|
||||
@@ -1612,8 +1616,15 @@
|
||||
// Elements to skip when revealing (inputs, scripts, styles, extension UI)
|
||||
const SKIP_REVEAL_TAGS = new Set([
|
||||
'SCRIPT', 'STYLE', 'NOSCRIPT', 'IFRAME', 'INPUT', 'TEXTAREA', 'SELECT',
|
||||
'NAV', 'ASIDE', 'HEADER', 'FOOTER',
|
||||
]);
|
||||
|
||||
// Skip reveal in navigation, sidebars, headers, and other non-chat UI
|
||||
function isInNonChatArea(el) {
|
||||
if (!el) return false;
|
||||
return !!el.closest('nav, aside, header, footer, [role="navigation"], [role="banner"], [role="complementary"], [data-sidebar], [class*="sidebar"], [class*="Sidebar"], [class*="nav-"], [class*="Nav"], [class*="menu"], [class*="Menu"], [class*="header"], [class*="Header"]');
|
||||
}
|
||||
|
||||
// Reveal ALL text on the page + apply highlights
|
||||
function revealAllResponses() {
|
||||
const pairs = getRevealPairs();
|
||||
|
||||
@@ -629,7 +629,7 @@
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>Silent Send v0.9.14</p>
|
||||
<p>Silent Send v0.9.15</p>
|
||||
<p style="font-size:11px;color:#9ca3af;margin-top:6px;max-width:600px">
|
||||
Silent Send is a convenience tool, not a security guarantee. Third-party sites may change how they send data at any time, which can cause missed substitutions without warning. You are responsible for verifying your data before sending. See the <a href="https://github.com/outis1one/silent-send/blob/main/LICENSE" target="_blank" style="color:#6b7280">LICENSE</a> for full terms.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user