Use messageTab directly in scrolltab and change the function comment

This commit is contained in:
Mariusz Kaczmarczyk 2021-03-26 22:46:28 +01:00 committed by Oliver Blanthorn
parent 480ec7a72e
commit e5c2a8d9cd
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -1158,18 +1158,19 @@ export async function markjumpbefore() {
}
const currentTabId = await activeTabId()
state.beforeJumpMark = { url: window.location.href.split("#")[0], scrollX: window.scrollX, scrollY: window.scrollY, tabId: currentTabId }
goToTab(tabId).then(() => scrolltab(tabId, scrollX, scrollY, "# Jumped to the last location before a mark jump"))
goToTab(tabId).then(() => scrolltab(tabId, scrollX, scrollY, "# Jumped back"))
} catch (e) {
// the mark's tab is no longer valid
}
}
/**
* Scrolls to a given position in a given tab and prints a message in it.
* Scrolls to a given position in a tab identified by tabId and prints a message in it.
*/
//#content
export async function scrolltab(tabId: number, scrollX: number, scrollY: number, message: string) {
acceptExCmd(tabId, [`composite scrollto ${scrollX} ${scrollY}; fillcmdline_tmp 3000 ${message}`])
await Messaging.messageTab(tabId, "controller_content", "acceptExCmd", [`composite scrollto ${scrollX} ${scrollY}`])
Messaging.messageTab(tabId, "controller_content", "acceptExCmd", [`fillcmdline_tmp 3000 ${message}`])
}
/**
@ -4928,17 +4929,6 @@ export function jumble() {
}
}
/**
* Run a command in a tab with an internal firefox identifier specified by destination or in background if destination is "background".
*/
//#content
export function acceptExCmd(destination: number | "background", ex_string: string[]) {
if (destination === "background") {
return run_exstr(...ex_string)
}
return Messaging.messageTab(destination, "controller_content", "acceptExCmd", ex_string)
}
/**
* Hacky ex string parser.
*