Reordered side panel content loading

This commit is contained in:
Ryo Hilmawan 2020-11-23 17:05:18 +07:00 committed by GitHub
parent b453c41132
commit 443da9a330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,19 +151,21 @@ module.exports = {
function loadContent(mod) { function loadContent(mod) {
if (curPanelJs && curPanelJs.onSwitch) curPanelJs.onSwitch(); if (curPanelJs && curPanelJs.onSwitch) curPanelJs.onSwitch();
if (mod.panelJs) {
curPanelJs = require(mod.panelJs)(store(mod.id));
} else curPanelJs = null;
store().last_open = mod.id; store().last_open = mod.id;
panel.querySelector('.enhancer-panel--title').innerText = mod.panel.name || mod.name; panel.querySelector('.enhancer-panel--title').innerText = mod.panel.name || mod.name;
panel.querySelector('.enhancer-panel--icon').innerHTML = mod.panelIcon; panel.querySelector('.enhancer-panel--icon').innerHTML = mod.panelIcon;
document.getElementById('enhancer-panel--content').innerHTML = mod.panelHtml; document.getElementById('enhancer-panel--content').innerHTML = mod.panelHtml;
if (mod.panelJs) {
curPanelJs = require(mod.panelJs)(store(mod.id));
if (curPanelJs && curPanelJs.onLoad) curPanelJs.onLoad();
} else curPanelJs = null;
if (mod.panelFullHeight) { if (mod.panelFullHeight) {
panel.dataset.fullHeight = mod.panelFullHeight; panel.dataset.fullHeight = mod.panelFullHeight;
} else panel.dataset.fullHeight = ''; } else panel.dataset.fullHeight = '';
if (curPanelJs && curPanelJs.onLoad)
curPanelJs.onLoad();
} }
function unlockPanel(animate) { function unlockPanel(animate) {