highlighting

master
km0 3 years ago
parent 698997b1ce
commit c74a3b86e9

@ -20,7 +20,6 @@ const syncCategories = function (selected) {
let checkbox = accordion.querySelector(".switch input"); let checkbox = accordion.querySelector(".switch input");
let category = checkbox.id; let category = checkbox.id;
console.log(category);
checkbox.checked = selected.includes(category); checkbox.checked = selected.includes(category);
checkbox.addEventListener("change", () => { checkbox.addEventListener("change", () => {

@ -1,15 +1,21 @@
let categories = { let categories = {
collect: { collect: {
title: "Collection of Data", title: "Collection of Data",
keywords: ["data", "collect"], keywords: ["data center", "data", "collect", "content and data", "collect data"],
}, },
usage: { usage: {
title: "How do they use this data", title: "How do they use this data",
keywords: ["usage", "use"], keywords: ["data to", "data from", "your data", "use of data"],
}, },
third: { third: {
title: "Usage of Data", title: "Sharing your data",
keywords: ["share", "third", "companies", "party"], keywords: [
"share content",
"share information",
"share your",
"third party",
"third countries",
],
}, },
location: { location: {
title: "Location", title: "Location",
@ -17,7 +23,7 @@ let categories = {
}, },
permission: { permission: {
title: "Permission and Consent", title: "Permission and Consent",
keywords: ["permission", "consent"], keywords: ["your permission", "device permission"],
}, },
upload: { upload: {
title: "Uploaded Contents", title: "Uploaded Contents",
@ -25,7 +31,7 @@ let categories = {
}, },
suspension: { suspension: {
title: "Suspension of the account", title: "Suspension of the account",
keywords: ["suspension", "termination", "ban", "suspend", "disable", "account", "breached"], keywords: ["suspension", "termination", "ban", "suspend", "disable", "breached"],
}, },
}; };

@ -51,8 +51,12 @@ activate.addEventListener("click", async () => {
function highlightSelected(active) { function highlightSelected(active) {
chrome.storage.sync.get(["categories", "selected"], (result) => { chrome.storage.sync.get(["categories", "selected"], (result) => {
for (const el of document.querySelectorAll("*")) { for (const el of document.querySelectorAll("*:not(html, body)")) {
el.style.visibility = active ? "hidden" : "visible"; el.style.visibility = active ? "hidden" : "visible";
el.style.backgroundColor = "";
el.style.color = "";
// el.style.height = "0px";
// el.style.display = active ? "none" : "";
} }
if (active) { if (active) {
@ -69,9 +73,18 @@ function highlightSelected(active) {
wrapped.innerHTML = finding.textContent; wrapped.innerHTML = finding.textContent;
wrapped.style.visibility = "visible"; wrapped.style.visibility = "visible";
wrapped.style.backgroundColor = "#1834e9";
wrapped.style.color = "white";
let target = finding.parentElement; let target = finding.parentElement;
target.replaceChild(wrapped, finding); target.replaceChild(wrapped, finding);
// wrapped.style.display = "";
// let upper = target;
// while (upper.parentElement) {
// upper.style.display = "";
// upper = upper.parentElement;
// }
} }
} }
}); });

Loading…
Cancel
Save