Update app.js
This commit is contained in:
1 parent
0142bc5c2a
commit
53ee6fb63a
1 file changed
+5
-11
@@ -88,7 +88,6 @@ function switchPage(page, param) {
|
|||||||
el.classList.remove('active', 'slide-out');
|
el.classList.remove('active', 'slide-out');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 隐藏自定义页面容器
|
|
||||||
const customContainer = document.getElementById('customPageContainer');
|
const customContainer = document.getElementById('customPageContainer');
|
||||||
if (customContainer) {
|
if (customContainer) {
|
||||||
customContainer.classList.remove('active');
|
customContainer.classList.remove('active');
|
||||||
@@ -370,21 +369,16 @@ async function loadCustomPagesNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderCustomPagesNav() {
|
function renderCustomPagesNav() {
|
||||||
const userDropdown = document.getElementById('userDropdown');
|
const container = document.getElementById('customNavLinks');
|
||||||
const existingLinks = userDropdown.querySelectorAll('.custom-page-nav-link');
|
if (!container) return;
|
||||||
existingLinks.forEach(el => el.remove());
|
container.innerHTML = '';
|
||||||
|
|
||||||
const messageBtn = document.getElementById('messageBtn');
|
|
||||||
if (!messageBtn) return;
|
|
||||||
|
|
||||||
customPagesNav.forEach(page => {
|
customPagesNav.forEach(page => {
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.className = 'custom-page-nav-link';
|
|
||||||
link.href = '#';
|
link.href = '#';
|
||||||
link.dataset.page = 'custom';
|
|
||||||
link.dataset.custom = page.name;
|
link.dataset.custom = page.name;
|
||||||
link.textContent = page.title;
|
link.textContent = page.title;
|
||||||
link.style.cssText = 'padding:6px 10px;border-radius:4px;color:var(--text-secondary);text-decoration:none;font-size:13px;transition:color 0.15s;margin-right:4px;';
|
link.style.cssText = 'color:var(--text-secondary);text-decoration:none;font-size:14px;padding:4px 10px;border-radius:4px;transition:color 0.15s;';
|
||||||
link.addEventListener('mouseenter', function() {
|
link.addEventListener('mouseenter', function() {
|
||||||
this.style.color = 'var(--text)';
|
this.style.color = 'var(--text)';
|
||||||
});
|
});
|
||||||
@@ -395,7 +389,7 @@ function renderCustomPagesNav() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
switchPage('custom', page.name);
|
switchPage('custom', page.name);
|
||||||
});
|
});
|
||||||
userDropdown.insertBefore(link, messageBtn.nextSibling);
|
container.appendChild(link);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user