button fixed
This commit is contained in:
1 parent
b40e5136a1
commit
fb879b1a23
3 files changed
+51
-28
No files matched your search
+1
-1
@@ -7,7 +7,6 @@
|
|||||||
<link href="styles.css" rel="stylesheet"/>
|
<link href="styles.css" rel="stylesheet"/>
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsSHA/2.4.2/sha.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsSHA/2.4.2/sha.js"></script>
|
||||||
<script src="js/admin.js"></script>
|
|
||||||
<script src="js/auth.js"></script>
|
<script src="js/auth.js"></script>
|
||||||
<script src="js/ui.js"></script>
|
<script src="js/ui.js"></script>
|
||||||
<script src="js/themes.js"></script>
|
<script src="js/themes.js"></script>
|
||||||
@@ -454,5 +453,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script src="js/admin.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+43
-18
@@ -1,3 +1,18 @@
|
|||||||
|
// Ensure tab event listeners are attached after everything is defined
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const tabButtons = document.querySelectorAll('#adminTabs button');
|
||||||
|
tabButtons.forEach(button => {
|
||||||
|
button.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const tabId = button.getAttribute('data-tab');
|
||||||
|
if (tabId && typeof window.switchTab === 'function') {
|
||||||
|
window.switchTab(tabId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
// Global variables for admin functionality
|
// Global variables for admin functionality
|
||||||
// --- Weeks input logic ---
|
// --- Weeks input logic ---
|
||||||
// Populate active week dropdown from weeksContainer
|
// Populate active week dropdown from weeksContainer
|
||||||
@@ -104,8 +119,7 @@ window.switchTab = function switchTab(targetId) {
|
|||||||
|
|
||||||
// Highlight the active button
|
// Highlight the active button
|
||||||
document.querySelectorAll('#adminTabs button').forEach(btn => {
|
document.querySelectorAll('#adminTabs button').forEach(btn => {
|
||||||
const onclick = btn.getAttribute('onclick');
|
if (btn.getAttribute('data-tab') === targetId) {
|
||||||
if (onclick && onclick.includes(targetId)) {
|
|
||||||
btn.classList.add('active');
|
btn.classList.add('active');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -146,6 +160,19 @@ window.switchTab = function switchTab(targetId) {
|
|||||||
loadUserDropdowns();
|
loadUserDropdowns();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Attach admin tab event listeners after switchTab is defined
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const tabButtons = document.querySelectorAll('#adminTabs button');
|
||||||
|
tabButtons.forEach(button => {
|
||||||
|
button.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const tabId = button.getAttribute('data-tab');
|
||||||
|
if (tabId) {
|
||||||
|
window.switchTab(tabId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load users from server
|
// Load users from server
|
||||||
@@ -753,22 +780,20 @@ function populatePasswordUserDropdown() {
|
|||||||
|
|
||||||
// Add event listeners for admin tabs as backup to onclick
|
// Add event listeners for admin tabs as backup to onclick
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
setTimeout(() => {
|
const tabButtons = document.querySelectorAll('#adminTabs button');
|
||||||
const tabButtons = document.querySelectorAll('#adminTabs button');
|
tabButtons.forEach(button => {
|
||||||
tabButtons.forEach(button => {
|
button.addEventListener('click', (e) => {
|
||||||
button.addEventListener('click', (e) => {
|
e.preventDefault();
|
||||||
e.preventDefault();
|
const tabId = button.getAttribute('data-tab');
|
||||||
const tabId = button.getAttribute('data-tab');
|
if (tabId) {
|
||||||
if (tabId) {
|
console.log('Tab clicked:', tabId);
|
||||||
console.log('Tab clicked:', tabId);
|
if (typeof window.switchTab === 'function') {
|
||||||
if (typeof window.switchTab === 'function') {
|
window.switchTab(tabId);
|
||||||
window.switchTab(tabId);
|
} else {
|
||||||
} else {
|
console.error('switchTab function not available');
|
||||||
console.error('switchTab function not available');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
console.log('✅ Tab event listeners added to', tabButtons.length, 'buttons');
|
});
|
||||||
}, 500);
|
console.log('✅ Tab event listeners added to', tabButtons.length, 'buttons');
|
||||||
});
|
});
|
||||||
+7
-9
@@ -99,15 +99,13 @@ function showAdmin() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Set default tab to tabWords and enable tab buttons
|
// Set default tab to tabWords and enable tab buttons
|
||||||
setTimeout(() => {
|
document.querySelectorAll('#adminTabs button').forEach(btn => btn.disabled = false);
|
||||||
document.querySelectorAll('#adminTabs button').forEach(btn => btn.disabled = false);
|
if (typeof window.switchTab === 'function') {
|
||||||
if (typeof window.switchTab === 'function') {
|
window.switchTab("tabWords");
|
||||||
window.switchTab("tabWords");
|
console.log("✅ Default tab set to tabWords");
|
||||||
console.log("✅ Default tab set to tabWords");
|
} else {
|
||||||
} else {
|
console.error("switchTab function not available");
|
||||||
console.error("switchTab function not available");
|
}
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
} else {
|
} else {
|
||||||
console.error("Admin panel not found");
|
console.error("Admin panel not found");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user