mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
using bovine3dom suggestion / adding aliases
This commit is contained in:
parent
2d8def8b81
commit
3c73886b3f
2 changed files with 5 additions and 6 deletions
|
@ -2336,18 +2336,15 @@ export async function tabclose(...indexes: string[]) {
|
|||
*/
|
||||
//#background
|
||||
export async function tabcloseallto(side: string) {
|
||||
if !(["left", "right"].includes(side)) throw("side argument must be left or right")
|
||||
const tabs = await browser.tabs.query({
|
||||
pinned: false,
|
||||
currentWindow: true,
|
||||
})
|
||||
|
||||
const atab = await activeTab()
|
||||
if (side == "right") {
|
||||
const ids = tabs.filter(tab => tab.index > atab.index).map(tab => tab.id)
|
||||
}
|
||||
else if (side == "left"){
|
||||
const ids = tabs.filter(tab => tab.index < atab.index).map(tab => tab.id)
|
||||
}
|
||||
const comp = side == "right" ? tab => tab.index > atab.index : tab => tab.index < atab.index
|
||||
const ids = tabs.filter(comp).map(tab => tab.id)
|
||||
return browser.tabs.remove(ids)
|
||||
}
|
||||
|
||||
|
|
|
@ -573,6 +573,8 @@ export class default_config {
|
|||
extp: "extpreferences",
|
||||
prefset: "setpref",
|
||||
prefremove: "removepref",
|
||||
tabclosealltoright: "tabcloseallto right"
|
||||
tabclosealltoleft: "tabcloseallto left"
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue