From 6b6d9c2a7a406712b24018c114c02f4fd339c9a8 Mon Sep 17 00:00:00 2001 From: KAWAKAMI Moeki Date: Wed, 29 Apr 2026 09:31:55 +0900 Subject: [PATCH] swift/ax_text: include image alt + src in browser capture document.body.innerText silently drops nodes, so Cosense's icon notation [name.icon] (rendered as name) was captured as a blank space. Replace each with a text node containing "alt src" (whichever exist) on a body clone before reading innerText, so both the human-readable label and the resource URL flow into the captured text in document order. Co-Authored-By: Claude Opus 4.7 --- swift/ax_text.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/ax_text.swift b/swift/ax_text.swift index d917d75..007496d 100644 --- a/swift/ax_text.swift +++ b/swift/ax_text.swift @@ -93,7 +93,7 @@ func getBrowserTabTexts(appScriptName: String) -> [[String: Any]] { set u to URL of tab i of window w try tell tab i of window w - set txt to execute javascript "document.body.innerText.substring(0, 5000)" + set txt to execute javascript "(function(){var c=document.body.cloneNode(true);c.querySelectorAll('img').forEach(function(i){var a=(i.getAttribute('alt')||'').trim();var s=i.src||'';var p=[a,s].filter(Boolean).join(' ');if(p){i.parentNode.replaceChild(document.createTextNode(' '+p+' '),i);}});return c.innerText.substring(0,5000);})()" end tell on error set txt to ""