Skip to content

Commit

Permalink
Fix empty space when the gallery is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
oobabooga committed Aug 13, 2023
1 parent f6db2c7 commit 3ae2cee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/gallery/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
let gallery_element = document.getElementById('gallery-extension');
let extensions_block = gallery_element.parentElement;
let extensions_block_size = extensions_block.childNodes.length;
let gallery_only = (extensions_block_size == 5);

main_parent.addEventListener('click', function(e) {
let chat_visible = (chat_tab.offsetHeight > 0 && chat_tab.offsetWidth > 0);
Expand All @@ -8,7 +11,13 @@ main_parent.addEventListener('click', function(e) {
// Only show this extension in the Chat tab
if (chat_visible) {
gallery_element.style.display = 'block';
if (gallery_only) {
extensions_block.style.display = '';
}
} else {
gallery_element.style.display = 'none';
if (gallery_only) {
extensions_block.style.display = 'none';
}
}
});

0 comments on commit 3ae2cee

Please sign in to comment.