check navigated page for slop
This commit is contained in:
@@ -5,9 +5,16 @@
|
|||||||
|
|
||||||
"description": "Crowd-source AI slop pages and domains",
|
"description": "Crowd-source AI slop pages and domains",
|
||||||
|
|
||||||
|
"permissions": [
|
||||||
|
"activeTab",
|
||||||
|
"storage",
|
||||||
|
"webNavigation"
|
||||||
|
],
|
||||||
|
|
||||||
"page_action": {
|
"page_action": {
|
||||||
"default_icon": "icons/virus-slash.png",
|
"default_icon": "icons/virus-slash.png",
|
||||||
"default_title": "report slop"
|
"default_title": "report slop",
|
||||||
|
"show_matches": ["<all_urls>"]
|
||||||
},
|
},
|
||||||
|
|
||||||
"background": {
|
"background": {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ async function get_slop_store(readwrite) {
|
|||||||
db_request.onsuccess = (event) => {
|
db_request.onsuccess = (event) => {
|
||||||
const db = event.target.result
|
const db = event.target.result
|
||||||
const transaction = db.transaction(["slop"], readwrite ? "readwrite" : undefined)
|
const transaction = db.transaction(["slop"], readwrite ? "readwrite" : undefined)
|
||||||
slop_store = transaction.objectStore("slop")
|
const slop_store = transaction.objectStore("slop")
|
||||||
resolve(slop_store)
|
resolve(slop_store)
|
||||||
}
|
}
|
||||||
db_request.onerror = (event) => {
|
db_request.onerror = (event) => {
|
||||||
@@ -95,7 +95,7 @@ async function check_slop(url) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
slop_object = await known_slop
|
const slop_object = await known_slop
|
||||||
let result = {slop_domain: false, slop_path: false}
|
let result = {slop_domain: false, slop_path: false}
|
||||||
if (slop_object) {
|
if (slop_object) {
|
||||||
// domain was found
|
// domain was found
|
||||||
@@ -119,5 +119,11 @@ async function on_button_clicked_handler(tab) {
|
|||||||
insert_slop(domain, path)
|
insert_slop(domain, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function update_page_action_icon(details) {
|
||||||
|
const is_slop = await check_slop(details.url)
|
||||||
|
console.log(is_slop)
|
||||||
|
}
|
||||||
|
|
||||||
browser.runtime.onInstalled.addListener(on_install_handler)
|
browser.runtime.onInstalled.addListener(on_install_handler)
|
||||||
browser.pageAction.onClicked.addListener(on_button_clicked_handler)
|
browser.pageAction.onClicked.addListener(on_button_clicked_handler)
|
||||||
|
browser.webNavigation.onCommitted.addListener(update_page_action_icon)
|
||||||
|
|||||||
Reference in New Issue
Block a user