Eyecandy on admin page and fix of functionality on that page
Build LinkLog Development Image / development-image (push) Successful in 11s
Build LinkLog Development Image / development-image (push) Successful in 11s
This commit is contained in:
@@ -310,6 +310,48 @@ passwordForm.addEventListener('submit', async (event) => {
|
||||
if (response.ok) passwordForm.reset();
|
||||
});
|
||||
|
||||
function initPanelToggles() {
|
||||
const panels = document.querySelectorAll('.settings-panel');
|
||||
panels.forEach((panel) => {
|
||||
panel.classList.add('minimized');
|
||||
const h2 = panel.querySelector('h2');
|
||||
if (!h2) return;
|
||||
let btn = h2.querySelector('.panel-toggle-btn');
|
||||
if (!btn) {
|
||||
const titleText = h2.textContent.trim();
|
||||
h2.replaceChildren();
|
||||
btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'panel-toggle-btn';
|
||||
btn.setAttribute('aria-expanded', 'false');
|
||||
const textSpan = document.createElement('span');
|
||||
textSpan.textContent = titleText;
|
||||
const iconSpan = document.createElement('span');
|
||||
iconSpan.className = 'panel-toggle-icon';
|
||||
iconSpan.setAttribute('aria-hidden', 'true');
|
||||
iconSpan.textContent = '▼';
|
||||
btn.append(textSpan, iconSpan);
|
||||
h2.appendChild(btn);
|
||||
} else {
|
||||
btn.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
if (h2.dataset.initialized) return;
|
||||
h2.dataset.initialized = 'true';
|
||||
|
||||
h2.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const isMinimized = panel.classList.toggle('minimized');
|
||||
if (btn) {
|
||||
btn.setAttribute('aria-expanded', String(!isMinimized));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initPanelToggles);
|
||||
initPanelToggles();
|
||||
|
||||
Promise.all([loadProfile(), loadMastodonConfig(), loadOtp(), loadEmailAddresses()]).catch((error) => {
|
||||
setStatus('#profile-status', accessToken ? error.message : 'Please sign in first.', true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user