more typing

This commit is contained in:
Jack Case
2025-10-27 20:18:03 +00:00
parent dbec1398e0
commit 7b06d78cd4
2 changed files with 9 additions and 9 deletions

View File

@@ -78,7 +78,7 @@ async function message_listener(message) {
if(message.type === "check_result") { if(message.type === "check_result") {
if (message.domain) { if (message.domain) {
const paths = page_links.getDomain(message.domain) const paths = page_links.getDomain(message.domain)
paths.forEach((search_link) => { paths.forEach((search_link: SearchLink) => {
search_link.node.setAttribute("style", "color: red;") search_link.node.setAttribute("style", "color: red;")
search_link.result = message.result search_link.result = message.result
}) })
@@ -108,7 +108,7 @@ function update_links() {
links.forEach((node) => { links.forEach((node) => {
page_links.setNode(node) page_links.setNode(node)
}) })
const link_iter = page_links.getSearchLinks().filter((search_link) => { const link_iter = page_links.getSearchLinks().filter((search_link: SearchLink) => {
return !(search_link.checked) return !(search_link.checked)
}) })
@@ -123,10 +123,10 @@ function setup_result_observer() {
} }
async function wait_for_results() { async function wait_for_results() {
let results = new Promise(async (resolve) => { let results: Promise<Element> = new Promise(async (resolve) => {
let node = document.querySelector(ddg_result_list_selector) let node = document.querySelector(ddg_result_list_selector)
while (!node) { while (!node) {
await new Promise((resolve) => {setTimeout(()=>{resolve()}, 100)}) await new Promise<void>((resolve) => {setTimeout(()=>{resolve()}, 100)})
node = document.querySelector(ddg_result_list_selector) node = document.querySelector(ddg_result_list_selector)
} }
resolve(node) resolve(node)

View File

@@ -112,7 +112,7 @@ async function insert_slop(domain: string, path: string) {
async function check_local_slop(url: string) { async function check_local_slop(url: string) {
const slop_url = new URL(url) const slop_url = new URL(url)
const slop_store = await get_slop_store(false) const slop_store = await get_slop_store(false)
const known_slop = new Promise((resolve, reject) => { const known_slop: Promise<any> = new Promise((resolve, reject) => {
const request = slop_store.get(slop_url.hostname) const request = slop_store.get(slop_url.hostname)
request.onsuccess = (event) => { request.onsuccess = (event) => {
resolve(request.result) resolve(request.result)
@@ -145,7 +145,7 @@ async function check_remote_slop(urls: string[]) {
return domain_objects return domain_objects
} }
async function on_button_clicked_handler(tab: Tab) { async function on_button_clicked_handler(tab: any) {
// insert the current tab's page into slop storage // insert the current tab's page into slop storage
const tab_url = new URL(tab.url) const tab_url = new URL(tab.url)
@@ -156,7 +156,7 @@ async function on_button_clicked_handler(tab: Tab) {
update_page_action_icon({frameId: 0, tabId: tab.id, url: tab.url}) update_page_action_icon({frameId: 0, tabId: tab.id, url: tab.url})
} }
async function update_page_action_icon(details) { async function update_page_action_icon(details: browser.webNavigation._OnCommittedDetails) {
if(details.frameId != 0) { if(details.frameId != 0) {
return return
} }
@@ -182,7 +182,7 @@ async function update_page_action_icon(details) {
console.log(is_slop) console.log(is_slop)
} }
async function message_listener(message, sender) { async function message_listener(message: any, sender: any) {
const tabid = sender.tab.id const tabid = sender.tab.id
if (message.type === "check") { if (message.type === "check") {
let check_promises = new Array() let check_promises = new Array()
@@ -202,7 +202,7 @@ async function message_listener(message, sender) {
await Promise.all(check_promises) await Promise.all(check_promises)
let remote_slop = await check_remote_slop(not_found_local) let remote_slop = await check_remote_slop(not_found_local)
remote_slop.forEach((result) => { remote_slop.forEach((result: any) => {
browser.tabs.sendMessage(tabid, { type: "check_result", domain: result.domain_name, result: result }) browser.tabs.sendMessage(tabid, { type: "check_result", domain: result.domain_name, result: result })
}) })
} }