From 9559111ba61788f7f1217a280626e0dacc8869d7 Mon Sep 17 00:00:00 2001 From: Tussocky Joker Date: Sat, 21 Feb 2026 20:08:30 +0000 Subject: [PATCH] excludes.txt -> keywords.txt --- .DS_Store | Bin 6148 -> 6148 bytes content.js | 64 ++++++++++++++++------------------- excludes.txt => keywords.txt | 0 manifest.json | 2 +- 4 files changed, 31 insertions(+), 35 deletions(-) rename excludes.txt => keywords.txt (100%) diff --git a/.DS_Store b/.DS_Store index 1b8f36fe393fa06a8fa498ddf7d32fa54ee55571..b9c25561081b2f5bc672eff486926f249eb00081 100644 GIT binary patch literal 6148 zcmeHKOHRWu5PdF{Xv;^H*szQ^KqPJuO1r28Ea(ABKOjD7i~13Cmosn_E(mXItE!W9 zi%>Nqd7fkYdEzH!CI(s8-;}wfAa%G<59CPg_c`0L!*AqZD*Gp>_kF<%L?vyZJLQ<}_qhB#UkQ=W2 z^X?A43mVk67-gE}&(2p=+dBnVv&Cvh4%Mpys(>o6Q9$xT#3q<{%pBU(K_|sa=Bt8Y z?8|S0VB|6Jm^tJO%{VI2QH{T17)R%LB`mu~2NHo+2aD#DLwC4MbQb^RqN<7UK|P+1QZEw3(fQp9837vmnQJ Z=E?jbmI4ewz{tSB1f^LvM~JLp1^~vP53v9M diff --git a/content.js b/content.js index 48f9dce..0f87f81 100644 --- a/content.js +++ b/content.js @@ -1,55 +1,51 @@ let keywords = []; -// Load excludes.txt first async function loadKeywords() { - try { - const response = await fetch(chrome.runtime.getURL("excludes.txt")); - const text = await response.text(); + try { + const response = await fetch(chrome.runtime.getURL("keywords.txt")); + const text = await response.text(); - keywords = text - .split("\n") - .map(k => k.trim().toLowerCase()) - .filter(Boolean); + keywords = text + .split("\n") + .map(k => k.trim().toLowerCase()) + .filter(Boolean); - console.log("Loaded keywords:", keywords); + console.log("Loaded keywords:", keywords); - startFiltering(); // start only after keywords are ready + startFiltering(); - } catch (error) { - console.error("Failed to load excludes.txt:", error); - } + } catch (error) { + console.error("Failed to load keywords.txt:", error); + } } function filterNotifications() { - const notifications = document.querySelectorAll('div[role="button"]'); + const notifications = document.querySelectorAll('div[role="button"]'); - notifications.forEach(notification => { - const text = notification.innerText.toLowerCase(); + notifications.forEach(notification => { + const text = notification.innerText.toLowerCase(); - const containsKeyword = keywords.some(keyword => - text.includes(keyword) - ); + const containsKeyword = keywords.some(keyword => + text.includes(keyword) + ); - if (containsKeyword) { - notification.remove(); - } - }); + if (containsKeyword) { + notification.remove(); + } + }); } function startFiltering() { - // Run once - filterNotifications(); - - // Watch for dynamically loaded notifications - const observer = new MutationObserver(() => { filterNotifications(); - }); - observer.observe(document.body, { - childList: true, - subtree: true - }); + const observer = new MutationObserver(() => { + filterNotifications(); + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); } -// Start everything loadKeywords(); \ No newline at end of file diff --git a/excludes.txt b/keywords.txt similarity index 100% rename from excludes.txt rename to keywords.txt diff --git a/manifest.json b/manifest.json index 5125d4e..6f67855 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "web_accessible_resources": [ { - "resources": ["excludes.txt"], + "resources": ["keywords.txt"], "matches": ["https://coventry.aula.education/*"] } ]