let's just not bother with imports for the content script
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["*://*.duckduckgo.com/*q=*"],
|
"matches": ["*://*.duckduckgo.com/*q=*"],
|
||||||
"js": ["scripts/hide-slop.js"],
|
"js": ["scripts/content-script.js"],
|
||||||
"type":"module"
|
"type":"module"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -17,6 +17,4 @@
|
|||||||
<button id="login-button">login</button>
|
<button id="login-button">login</button>
|
||||||
</form>
|
</form>
|
||||||
<h2 style="visibility: collapse;" id="login-status">You're logged in.</h2>
|
<h2 style="visibility: collapse;" id="login-status">You're logged in.</h2>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
let common: any
|
|
||||||
|
|
||||||
class SearchLink {
|
class SearchLink {
|
||||||
|
|
||||||
node: Element
|
node: Element
|
||||||
@@ -78,7 +76,7 @@ function check_links(search_links: SearchLink[]) {
|
|||||||
return search_link.target
|
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) {
|
async function backend_message_listener(message: any) {
|
||||||
@@ -97,7 +95,6 @@ async function backend_message_listener(message: any) {
|
|||||||
link.result = message.result
|
link.result = message.result
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,17 +153,12 @@ async function onload_handler() {
|
|||||||
setup_result_observer()
|
setup_result_observer()
|
||||||
}
|
}
|
||||||
|
|
||||||
import("./common.js").then((module) => {
|
// listen for messages from the background script
|
||||||
common = module
|
browser.runtime.onMessage.addListener(backend_message_listener)
|
||||||
// listen for messages from the background script
|
|
||||||
browser.runtime.onMessage.addListener(backend_message_listener)
|
|
||||||
|
|
||||||
// initialize state on document load
|
// initialize state on document load
|
||||||
if (document.readyState === "loading") {
|
if (document.readyState === "loading") {
|
||||||
document.addEventListener("DOMContentLoaded", onload_handler)
|
document.addEventListener("DOMContentLoaded", onload_handler)
|
||||||
} else {
|
} else {
|
||||||
wait_for_results().then(onload_handler)
|
wait_for_results().then(onload_handler)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"baseUrl": "src/",
|
"baseUrl": "src/",
|
||||||
"module": "esnext"
|
"module": "esnext",
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user