much more stable link attribute setting

This commit is contained in:
Jack Case
2025-10-26 10:36:27 -04:00
parent b1f4ad61ff
commit 432c8f09ee
2 changed files with 12 additions and 5 deletions

View File

@@ -69,13 +69,20 @@ function check_links(search_links) {
async function message_listener(message) { async function message_listener(message) {
// handle slop reports returned from the background script // handle slop reports returned from the background script
if(message.type === "check_result") { if(message.type === "check_result") {
console.log(message.url, message.result) if (message.domain) {
const link = page_links.get(message.url) const paths = page_links.getDomain(message.domain)
if ( message.result.slop_domain ) { paths.forEach((search_link) => {
search_link.node.setAttribute("style", "color: red;")
search_link.result = message.result
})
} else if (message.url) {
const link = page_links.getUrl(message.url)
link.node.setAttribute("style", "color: red;") link.node.setAttribute("style", "color: red;")
}
link.result = message.result link.result = message.result
} }
}
} }
function get_initial_links() { function get_initial_links() {

View File

@@ -198,7 +198,7 @@ async function message_listener(message, sender) {
let remote_slop = await check_remote_slop(not_found_local) let remote_slop = await check_remote_slop(not_found_local)
remote_slop.forEach((result) => { remote_slop.forEach((result) => {
browser.tabs.sendMessage(tabid, { type: "check_result", url: result.url, result: result }) browser.tabs.sendMessage(tabid, { type: "check_result", domain: result.domain_name, result: result })
}) })
} }
} }