forked from TussockyJoker/Aula-Fixer
excludes.txt -> keywords.txt
This commit is contained in:
10
content.js
10
content.js
@@ -1,9 +1,8 @@
|
|||||||
let keywords = [];
|
let keywords = [];
|
||||||
|
|
||||||
// Load excludes.txt first
|
|
||||||
async function loadKeywords() {
|
async function loadKeywords() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(chrome.runtime.getURL("excludes.txt"));
|
const response = await fetch(chrome.runtime.getURL("keywords.txt"));
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
|
|
||||||
keywords = text
|
keywords = text
|
||||||
@@ -13,10 +12,10 @@ async function loadKeywords() {
|
|||||||
|
|
||||||
console.log("Loaded keywords:", keywords);
|
console.log("Loaded keywords:", keywords);
|
||||||
|
|
||||||
startFiltering(); // start only after keywords are ready
|
startFiltering();
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to load excludes.txt:", error);
|
console.error("Failed to load keywords.txt:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,10 +36,8 @@ function filterNotifications() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startFiltering() {
|
function startFiltering() {
|
||||||
// Run once
|
|
||||||
filterNotifications();
|
filterNotifications();
|
||||||
|
|
||||||
// Watch for dynamically loaded notifications
|
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(() => {
|
||||||
filterNotifications();
|
filterNotifications();
|
||||||
});
|
});
|
||||||
@@ -51,5 +48,4 @@ function startFiltering() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start everything
|
|
||||||
loadKeywords();
|
loadKeywords();
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
{
|
{
|
||||||
"resources": ["excludes.txt"],
|
"resources": ["keywords.txt"],
|
||||||
"matches": ["https://coventry.aula.education/*"]
|
"matches": ["https://coventry.aula.education/*"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user