mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Cheer up prettier
This commit is contained in:
parent
cff50597bf
commit
3fe9575a33
1 changed files with 13 additions and 15 deletions
|
@ -14,9 +14,11 @@ export function getTriVersion() {
|
||||||
|
|
||||||
// version_name only really exists in Chrome
|
// version_name only really exists in Chrome
|
||||||
// but we're using it anyway for our own purposes
|
// but we're using it anyway for our own purposes
|
||||||
return (manifest as browser._manifest.WebExtensionManifest & {
|
return (
|
||||||
version_name: string
|
manifest as browser._manifest.WebExtensionManifest & {
|
||||||
}).version_name
|
version_name: string
|
||||||
|
}
|
||||||
|
).version_name
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPrettyTriVersion() {
|
export function getPrettyTriVersion() {
|
||||||
|
@ -77,10 +79,7 @@ export async function activeWindowId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function removeActiveWindowValue(value) {
|
export async function removeActiveWindowValue(value) {
|
||||||
browserBg.sessions.removeWindowValue(
|
browserBg.sessions.removeWindowValue(await activeWindowId(), value)
|
||||||
await activeWindowId(),
|
|
||||||
value,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function activeTabContainerId() {
|
export async function activeTabContainerId() {
|
||||||
|
@ -285,7 +284,9 @@ export async function queryAndURLwrangler(
|
||||||
const expandRecursively = (name, dict, prevExpansions = []) => {
|
const expandRecursively = (name, dict, prevExpansions = []) => {
|
||||||
if (name in dict) {
|
if (name in dict) {
|
||||||
if (prevExpansions.includes(name)) {
|
if (prevExpansions.includes(name)) {
|
||||||
throw new Error(`Infinite loop detected while expanding ${name}. Stack: ${prevExpansions}.`)
|
throw new Error(
|
||||||
|
`Infinite loop detected while expanding ${name}. Stack: ${prevExpansions}.`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
prevExpansions.push(name)
|
prevExpansions.push(name)
|
||||||
return expandRecursively(dict[name], dict, prevExpansions)
|
return expandRecursively(dict[name], dict, prevExpansions)
|
||||||
|
@ -296,10 +297,7 @@ export async function queryAndURLwrangler(
|
||||||
const searchurls = config.get("searchurls")
|
const searchurls = config.get("searchurls")
|
||||||
const template = expandRecursively(firstWord, searchurls)
|
const template = expandRecursively(firstWord, searchurls)
|
||||||
if (template != firstWord) {
|
if (template != firstWord) {
|
||||||
const url = UrlUtil.interpolateSearchItem(
|
const url = UrlUtil.interpolateSearchItem(new URL(template), rest)
|
||||||
new URL(template),
|
|
||||||
rest,
|
|
||||||
)
|
|
||||||
// firstWord is a searchurl, so let's use that
|
// firstWord is a searchurl, so let's use that
|
||||||
return url.href
|
return url.href
|
||||||
}
|
}
|
||||||
|
@ -380,7 +378,7 @@ export async function openInTab(tab, opts = {}, strarr: string[]) {
|
||||||
* @param tabId tab identifier
|
* @param tabId tab identifier
|
||||||
*/
|
*/
|
||||||
export async function goToTab(tabId: number) {
|
export async function goToTab(tabId: number) {
|
||||||
const tab = await browserBg.tabs.update(tabId, { active: true });
|
const tab = await browserBg.tabs.update(tabId, { active: true })
|
||||||
await browserBg.windows.update(tab.windowId, { focused: true });
|
await browserBg.windows.update(tab.windowId, { focused: true })
|
||||||
return tab;
|
return tab
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue