let's just not bother with imports for the content script

This commit is contained in:
Jack Case
2025-11-06 16:47:40 +00:00
parent 8cc0f3aa64
commit 71545bb08e
4 changed files with 13 additions and 22 deletions

View File

@@ -27,7 +27,7 @@
"content_scripts": [
{
"matches": ["*://*.duckduckgo.com/*q=*"],
"js": ["scripts/hide-slop.js"],
"js": ["scripts/content-script.js"],
"type":"module"
}
]

View File

@@ -17,6 +17,4 @@
<button id="login-button">login</button>
</form>
<h2 style="visibility: collapse;" id="login-status">You're logged in.</h2>
</body>

View File

@@ -1,5 +1,3 @@
let common: any
class SearchLink {
node: Element
@@ -78,7 +76,7 @@ function check_links(search_links: SearchLink[]) {
return search_link.target
})
common.send_message_to_background({type: "check", urls: urls})
browser.runtime.sendMessage({type: "check", urls: urls})
}
async function backend_message_listener(message: any) {
@@ -97,7 +95,6 @@ async function backend_message_listener(message: any) {
link.result = message.result
}
break
}
}
@@ -156,8 +153,6 @@ async function onload_handler() {
setup_result_observer()
}
import("./common.js").then((module) => {
common = module
// listen for messages from the background script
browser.runtime.onMessage.addListener(backend_message_listener)
@@ -167,6 +162,3 @@ import("./common.js").then((module) => {
} else {
wait_for_results().then(onload_handler)
}
})

View File

@@ -7,6 +7,7 @@
"sourceMap": true,
"target": "esnext",
"baseUrl": "src/",
"module": "esnext"
"module": "esnext",
"noFallthroughCasesInSwitch": true
}
}