Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/_locales/dict.setup-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1988,6 +1988,17 @@ You can also set prefixes for each command type for faster navigation. Starting
zh_TW: '折疊全部',
ja: 'すべて折りたたむ',
},
'settings.nav_bar_btn_expand': {
en: 'Expand all',
de: 'Alle ausklappen',
fr: 'Tout déplier',
hu: 'Ágak megnyitása',
pl: 'Rozwiń wszystko',
ru: 'Развернуть все',
zh_CN: '展开全部',
zh_TW: '展開全部',
ja: 'すべて展開する',
},
'settings.nav_bar_btn_remute_audio_tabs': {
en: 'Mute/Unmute audible tabs',
de: 'Stumm-/Lautschalten hörbarer Tabs',
Expand Down
11 changes: 11 additions & 0 deletions src/_locales/dict.sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,17 @@ export const sidebarTranslations: Translations = {
zh_TW: '全部折疊',
ja: 'すべて折りたたむ',
},
'nav.btn_expand': {
en: 'Expand all',
de: 'Alle ausklappen',
fr: 'Déplier tout',
hu: 'Minden ág megnyitása',
pl: 'Rozwiń wszystko',
ru: 'Развернуть все',
zh_CN: '全部展开',
zh_TW: '全部展開',
ja: 'すべて展開する',
},
'nav.tabs_panel_tooltip_mid_rm_all': {
en: 'Middle click: Close tabs',
de: 'Mittelklick: Schließe Tabs',
Expand Down
1 change: 1 addition & 0 deletions src/assets/expand-all.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const BTN_ICONS: Record<string, string> = {
add_tp: 'icon_add_tabs_panel',
search: 'icon_search',
collapse: 'icon_collapse_all',
expand: 'icon_expand_all',
create_snapshot: 'icon_snapshot',
remute_audio_tabs: 'icon_mute',
}
Expand Down
1 change: 0 additions & 1 deletion src/defaults/mocks.tabs.fg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class MTab implements Tab {
branchColor: null,
customColor: null,
isGroup: false,
preview: false,
}
sessionData?: TabSessionData | undefined
titleEl?: HTMLElement | undefined
Expand Down
1 change: 1 addition & 0 deletions src/defaults/panels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,5 @@ export const NAV_BTNS_IDS: ID[] = [
'create_snapshot',
'remute_audio_tabs',
'collapse',
'expand',
]
1 change: 1 addition & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const enum ButtonType {
create_snapshot = 105,
remute_audio_tabs = 106,
collapse = 107,
expand = 108,
}

export const enum SpaceType {
Expand Down
2 changes: 1 addition & 1 deletion src/page.setup/components/settings.navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const availableBtns = computed<Btn[]>(() => {
// prettier-ignore
const ids = [
'tabs_panel', 'bookmarks_panel', 'history', 'sync', 'sp', 'sd', 'hdn', 'search',
'add_tp', 'create_snapshot', 'collapse', 'remute_audio_tabs', 'settings',
'add_tp', 'create_snapshot', 'collapse', 'expand', 'remute_audio_tabs', 'settings',
]

for (const id of ids) {
Expand Down
1 change: 1 addition & 0 deletions src/page.setup/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<inject>svg://src/assets/close.svg#icon_close</inject>
<inject>svg://src/assets/mute.svg#icon_mute</inject>
<inject>svg://src/assets/collapse-all.svg#icon_collapse_all</inject>
<inject>svg://src/assets/expand-all.svg#icon_expand_all</inject>
<inject>svg://src/assets/ctr-include.svg#icon_ctr_include</inject>
<inject>svg://src/assets/ctr-exclude.svg#icon_ctr_exclude</inject>
<inject>svg://src/assets/download-in-progress.svg#icon_download_in_progress</inject>
Expand Down
12 changes: 12 additions & 0 deletions src/services/bookmarks.fg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,18 @@ export function collapseAllBookmarks(panelId: ID): void {
saveBookmarksTree()
}

/**
* Expand all bookmarks folders
*/
export function expandAllBookmarks(panelId: ID): void {
const expanded: Record<ID, boolean> = {}
for (const [id, node] of Bookmarks.byId) {
if (node.children) expanded[id] = true
}
Bookmarks.reactive.expanded[panelId] = expanded
saveBookmarksTree()
}

/**
* Sort bookmarks
*/
Expand Down
1 change: 1 addition & 0 deletions src/services/sidebar.fg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ export function recalcPanels(): void {
if (id === 'create_snapshot') continue
if (id === 'remute_audio_tabs') continue
if (id === 'collapse') continue
if (id === 'expand') continue
if (id === 'hdn') continue

const panel = panelsById[id]
Expand Down
8 changes: 8 additions & 0 deletions src/services/tabs.fg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,14 @@ export function foldAllInactiveBranches(tabs: T.Tab[] = []): void {
}
}

export function expAllBranches(tabs: T.Tab[] = []): void {
for (const tab of tabs) {
if (tab.isParent && tab.folded) {
expTabsBranch(tab.id, true, true)
}
}
}

export function activateParent(tabId?: ID): void {
if (!Settings.state.tabsTree) return
if (tabId === undefined) tabId = Tabs.activeId
Expand Down
20 changes: 20 additions & 0 deletions src/sidebar/components/bar.navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const ButtonTypes: Record<string, E.ButtonType> = {
add_tp: E.ButtonType.add_tp,
hidden: E.ButtonType.hidden,
collapse: E.ButtonType.collapse,
expand: E.ButtonType.expand,
create_snapshot: E.ButtonType.create_snapshot,
remute_audio_tabs: E.ButtonType.remute_audio_tabs,
}
Expand Down Expand Up @@ -246,6 +247,7 @@ const nav = computed<Nav | undefined>(() => {
id === 'search' ||
id === 'add_tp' ||
id === 'collapse' ||
id === 'expand' ||
id === 'create_snapshot' ||
id === 'remute_audio_tabs'
) {
Expand Down Expand Up @@ -578,6 +580,7 @@ async function onNavMouseDown(e: MouseEvent, item: T.NavItem) {
}

if (item.type === E.ButtonType.collapse) collapseAll()
if (item.type === E.ButtonType.expand) expandAll()

if (item.type === E.ButtonType.add_tp) addTabsPanel(true)
}
Expand Down Expand Up @@ -618,6 +621,7 @@ function onNavMouseUp(e: MouseEvent, item: T.NavItem, inHiddenBar?: boolean) {
if (isCreateSnapshot) return Snapshots.createSnapshot()
if (isRemuteAudioTabs) return Tabs.remuteAudibleTabs()
if (item.type === E.ButtonType.collapse) collapseAll()
if (item.type === E.ButtonType.expand) expandAll()

if (isSwitchingPanel) {
if (Sidebar.reactive.hiddenPanelsPopup) Sidebar.reactive.hiddenPanelsPopup = false
Expand Down Expand Up @@ -790,4 +794,20 @@ function collapseAll(): void {
Bookmarks.collapseAllBookmarks(activePanel.id)
}
}

function expandAll(): void {
const activePanel = Sidebar.panelsById[Sidebar.activePanelId]
if (!activePanel) return

if (Utils.isTabsPanel(activePanel)) {
const tabs: T.Tab[] = []
for (const rTab of activePanel.tabs) {
const tab = Tabs.byId[rTab.id]
if (tab && tab.lvl === 0) tabs.push(tab)
}
Tabs.expAllBranches(tabs)
} else if (Utils.isBookmarksPanel(activePanel)) {
Bookmarks.expandAllBookmarks(activePanel.id)
}
}
</script>
1 change: 1 addition & 0 deletions src/sidebar/components/nav-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const NavItemTypeNames = {
[E.ButtonType.create_snapshot]: 'create_snapshot',
[E.ButtonType.remute_audio_tabs]: 'remute_audio_tabs',
[E.ButtonType.collapse]: 'collapse',
[E.ButtonType.expand]: 'expand',
[E.SpaceType.dynamic]: 'dynamic',
[E.SpaceType.static]: 'static',
}
Expand Down
1 change: 1 addition & 0 deletions src/sidebar/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
<inject>svg://src/assets/proxy.svg#icon_proxy</inject>
<inject>svg://src/assets/github.svg#icon_github</inject>
<inject>svg://src/assets/collapse-all.svg#icon_collapse_all</inject>
<inject>svg://src/assets/expand-all.svg#icon_expand_all</inject>
<inject>svg://src/assets/panel-config.svg#icon_panel_config</inject>
<inject>svg://src/assets/dedup-tabs.svg#icon_dedup_tabs</inject>
<inject>svg://src/assets/books.svg#icon_books</inject>
Expand Down