This repository has been archived on 2024-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
Nexus-Polestar/public/scripts/toggle.js
2023-07-23 20:45:17 -04:00

37 lines
No EOL
2.4 KiB
JavaScript
Executable file

function ToggleSidebar() {
document.querySelector('.sidebar').style.width = '0px'
document.querySelector('.sidebar').style.padding = '0px'
document.querySelector('.sidebar').style.fontSize = '0px'
document.querySelector('.sidebar-top').style.display = 'none'
document.querySelector('.sidebar-bottom').style.display = 'none'
document.querySelector("body > div > div.sidebar > div.sidebar-header > div.sidebar-header-left").style.display = 'none'
document.querySelector("body > div > div.sidebar > div.sidebar-header > div.sidebar-header-right").style.position ='fixed'
document.querySelector("body > div > div.sidebar > div.sidebar-header > div.sidebar-header-right").style.left = '94px'
document.querySelector("body > div > div.sidebar > div.drag-area").style.width = '90px'
document.querySelector("body > div > div.pages").style.width = '100%'
document.querySelector("body > div > div.pages").style.maxWidth = '100%'
document.querySelector("body > div > div.pages").style.left = '0px'
document.querySelector("#sidebar-toggle").setAttribute('onclick', 'ToggleSidebarRe()')
}
function ToggleSidebarRe() {
document.querySelector('.sidebar').style.width = '240px'
document.querySelector('.sidebar').style.padding = '0px 20px'
document.querySelector('.sidebar').style.fontSize = 'inherit'
document.querySelector('.sidebar-top').style.display = 'block'
document.querySelector('.sidebar-bottom').style.display = 'block'
document.querySelector("body > div > div.sidebar > div.sidebar-header > div.sidebar-header-left").style.display = 'flex'
document.querySelector("body > div > div.sidebar > div.sidebar-header > div.sidebar-header-right").style.position ='inherit'
document.querySelector("body > div > div.sidebar > div.sidebar-header > div.sidebar-header-right").style.left = 'inherit'
document.querySelector("body > div > div.sidebar > div.drag-area").style.width = '200px'
document.querySelector("body > div > div.pages").style.width = 'calc(100% - 280px)'
document.querySelector("body > div > div.pages").style.maxWidth = 'calc(100% - 280px)'
document.querySelector("body > div > div.pages").style.left = '280px'
document.querySelector("#sidebar-toggle").setAttribute('onclick', 'ToggleSidebar()')
}
setTimeout(() => {if (document.querySelector('.sidebar').getAttribute('id') === 'true') {ToggleSidebar()}else {}}, 0o500)