Skip to content

Commit 1af57d3

Browse files
committed
Show more extractors if applicable
1 parent 721ef2e commit 1af57d3

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

chrome/extension/js/popup.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,18 @@ function show(totalResults) {
9393
totalResults.forEach((rs) => {
9494
merged[rs.url] = merged[rs.url] || { url: rs.url, results: [] };
9595
rs.results.forEach((r) => {
96-
if (
97-
!merged[rs.url].results.some(
98-
(x) => x.component == r.component && x.version == r.version
99-
)
100-
) {
101-
merged[rs.url].results.push(r);
96+
const existing = merged[rs.url].results.find(
97+
(x) => x.component == r.component && x.version == r.version
98+
);
99+
if (existing) {
100+
if (r.detection && !existing.detections.includes(r.detection)) {
101+
existing.detections.push(r.detection);
102+
}
103+
} else {
104+
merged[rs.url].results.push({
105+
...r,
106+
detections: r.detection ? [r.detection] : [],
107+
});
102108
}
103109
});
104110
});
@@ -194,12 +200,17 @@ function show(totalResults) {
194200
});
195201
}
196202

197-
let d = detMapping[r.detection] ?? r.detection;
203+
let dNames = (r.detections && r.detections.length > 0
204+
? r.detections
205+
: [r.detection]
206+
)
207+
.filter(Boolean)
208+
.map((d) => detMapping[d] ?? d);
198209
let urlDiv = document.createElement("div");
199210
urlDiv.className = "detection-url";
200211
urlDiv.textContent = `${r.url} `;
201212
let detSpan = document.createElement("span");
202-
detSpan.textContent = `(${d} detection)`;
213+
detSpan.textContent = `(${dNames.join(", ")} detection)`;
203214
detSpan.className = "detection-method";
204215
urlDiv.appendChild(detSpan);
205216
body.appendChild(urlDiv);

0 commit comments

Comments
 (0)