2020-03-29 19:54:28 +08:00
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
2020-09-05 22:41:10 +08:00
|
|
|
console.log(`${CONFIG.themeInfo.name} v${CONFIG.themeInfo.version}`);
|
|
|
|
|
|
|
|
pageAsideOpenToggle();
|
|
|
|
|
2020-07-22 17:08:07 +08:00
|
|
|
});
|
2020-09-05 22:41:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
const pageAsideOpenToggle = () => {
|
|
|
|
|
|
|
|
const toggleDom = document.querySelector('.page-aside-toggle');
|
|
|
|
const pageTopDom = document.querySelector('.page-main-content-top');
|
|
|
|
const containerDom = document.querySelector('.page-container');
|
|
|
|
const leftAsideDom = document.querySelector('.page-aside');
|
|
|
|
|
|
|
|
const headerContentDom = document.querySelector('.header-wrapper .header-content');
|
|
|
|
const mainContentDom = document.querySelector('.page-main-content-middle .main-content');
|
|
|
|
|
|
|
|
let isOpen = false;
|
|
|
|
const openToggle = (isOpen) => {
|
|
|
|
|
2020-10-19 23:02:39 +08:00
|
|
|
const pageAsideWidth = '258px';
|
2020-09-05 22:41:10 +08:00
|
|
|
containerDom.style.paddingLeft = isOpen ? pageAsideWidth : '0';
|
|
|
|
pageTopDom.style.paddingLeft = isOpen ? pageAsideWidth : '0';
|
|
|
|
pageTopDom.style.paddingLeft = isOpen ? pageAsideWidth : '0';
|
|
|
|
leftAsideDom.style.left = isOpen ? '0' : `-${pageAsideWidth}`;
|
|
|
|
|
|
|
|
headerContentDom.style.width = isOpen ? '76%' : '62%';
|
|
|
|
mainContentDom.style.width = isOpen ? '76%' : '62%';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
toggleDom.addEventListener('click', () => {
|
|
|
|
isOpen = !isOpen;
|
|
|
|
openToggle(isOpen);
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
window.utils = {
|
|
|
|
openToggle: () => {
|
|
|
|
isOpen = true;
|
|
|
|
openToggle(isOpen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|