I want to use the same type of tables as described in the
"Web Labels: Support multiple scripts per row" feature request.
So here a simply patch that ads support for multiple scripts per row.
I hope this can be added,
Thank You
---
content/externalLicenseChecker.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/content/externalLicenseChecker.js
b/content/externalLicenseChecker.js
index f59eed8..69a3386 100644
--- a/content/externalLicenseChecker.js
+++ b/content/externalLicenseChecker.js
@@ -46,15 +46,16 @@
doc.head.appendChild(doc.createElement("base")).href =
webLabelsUrl;
}
const link = a => ({ url: a.href, label: a.textContent });
- const firstLink = parent => link(parent.querySelector("a"));
const allLinks = parent =>
Array.prototype.map.call(parent.querySelectorAll("a"), link);
for (const row of doc.querySelectorAll("table#jslicense-labels1 >
tbody > tr")) {
try {
const cols = row.querySelectorAll("td");
- const script = firstLink(cols[0]);
+ const scripts = allLinks(cols[0]);
const licenseLinks = allLinks(cols[1]);
const sources = cols[2] ? allLinks(cols[2]) : [];
- map.set(script.url, { script, licenseLinks, sources });
+ scripts.forEach((script) => {
+ map.set(script.url, { script, licenseLinks, sources });
+ });
} catch (e) {
console.error("LibreJS: error parsing Web Labels at %s, row
%s", webLabelsUrl, row.innerHTML, e);
}
--
2.46.0