Skip to content

Instantly share code, notes, and snippets.

@GitMurf
Created October 6, 2021 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GitMurf/f4af61282369becda448b2681a4f6b67 to your computer and use it in GitHub Desktop.
Save GitMurf/f4af61282369becda448b2681a4f6b67 to your computer and use it in GitHub Desktop.
<%*
const curPane = document.querySelector(`.mod-active.workspace-leaf`);
let isMax = false;
if(curPane) {
if(curPane.style.minWidth) {
if(curPane.style.minWidth === `100%`){isMax = true}
}
}
const rootPanesCont = document.querySelector(`.workspace-split.mod-root`);
let allMainPanes;
if(rootPanesCont){allMainPanes = rootPanesCont.querySelectorAll(`.workspace-leaf`)}
if(allMainPanes) {
allMainPanes.forEach(eachLeaf => {
let isActivePane = eachLeaf.classList.contains(`mod-active`);
if(isMax) {
eachLeaf.style.maxWidth = null;
eachLeaf.style.padding = null;
eachLeaf.style.minWidth = null;
eachLeaf.style.minHeight = null;
eachLeaf.parentElement.style.maxWidth = null;
eachLeaf.parentElement.style.padding = null;
eachLeaf.parentElement.style.minWidth = null;
eachLeaf.parentElement.style.minHeight = null;
eachLeaf.parentElement.querySelector(`.workspace-leaf-resize-handle`).style.maxWidth = null;
} else {
if(!isActivePane){
eachLeaf.style.maxWidth = `0`;
eachLeaf.style.padding = `0`;
if(!eachLeaf.parentElement.classList.contains(`mod-root`)) {
if(!eachLeaf.parentElement.querySelector(`.mod-active`)) {
eachLeaf.parentElement.style.maxWidth = `0`;
eachLeaf.parentElement.style.padding = `0`;
} else {
eachLeaf.parentElement.style.minWidth = `100%`;
eachLeaf.parentElement.style.minHeight = `100%`;
}
}
} else {
eachLeaf.style.minWidth = `100%`;
eachLeaf.style.minHeight = `100%`;
eachLeaf.parentElement.querySelector(`.workspace-leaf-resize-handle`).style.maxWidth = `0`;
}
}
})
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment