Show/hide the extensions block using javascript

This commit is contained in:
oobabooga 2023-03-15 16:34:31 -03:00
parent 348596f634
commit c1959c26ee
5 changed files with 19 additions and 3 deletions

View file

@ -1 +1,2 @@
document.getElementById("main").childNodes[0].style = "max-width: 800px; margin-left: auto; margin-right: auto";
document.getElementById("extensions").style = "max-width: 800px; margin-left: auto; margin-right: auto";

View file

@ -33,7 +33,7 @@ svg {
ol li p, ul li p {
display: inline-block;
}
#main, #settings, #extensions, #chat-settings {
#main, #settings, #chat-settings {
border: 0;
}

View file

@ -1,3 +1,18 @@
document.getElementById("main").parentNode.childNodes[0].style = "border: none; background-color: #8080802b; margin-bottom: 40px";
document.getElementById("main").parentNode.style = "padding: 0; margin: 0";
document.getElementById("main").parentNode.parentNode.parentNode.style = "padding: 0";
// Get references to the elements
let main = document.getElementById('main');
let main_parent = main.parentNode;
let extensions = document.getElementById('extensions');
// Add an event listener to the main element
main_parent.addEventListener('click', function(e) {
// Check if the main element is visible
if (main.offsetHeight > 0 && main.offsetWidth > 0) {
extensions.style.visibility = 'visible';
} else {
extensions.style.visibility = 'hidden';
}
});