Files
Ecobuddy/Views/template/footer.phtml
2025-03-15 01:59:16 +00:00

99 lines
3.9 KiB
PHTML
Executable File

</div>
<div class="site-footer mt-auto">
<!-- Footer Content -->
<div class="row">
<div id="footer" class="col-xs-12">
<p class="m-0">George Wilkinson @2024</p>
<p class="m-0">Powered by Bootstrap</p>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Application JavaScript -->
<!-- Note: simpleAuth.js is already included in the header -->
<!-- Note: facilityData.js is already included in the header -->
<script src="/public/js/comments.js"></script>
<!-- Initialize components -->
<script>
// Only run initialization if not already done
if (!window.initializationComplete) {
document.addEventListener('DOMContentLoaded', function() {
// Initialize auth service
const loginButton = document.querySelector('[data-bs-toggle="modal"]');
const loginModal = document.getElementById('loginModal');
// Initialize all modals
try {
const modalElements = document.querySelectorAll('.modal');
modalElements.forEach(modalElement => {
if (modalElement) {
const modalInstance = new bootstrap.Modal(modalElement, {
backdrop: true,
keyboard: true,
focus: true
});
// Add click handler for modal triggers
const triggers = document.querySelectorAll(`[data-bs-target="#${modalElement.id}"]`);
triggers.forEach(trigger => {
trigger.addEventListener('click', (e) => {
e.preventDefault();
modalInstance.show();
});
});
}
});
} catch (error) {
console.error('Error initializing modals:', error);
}
// Initialize auth form handlers
const loginForm = document.querySelector('#loginModal form');
const loginError = document.querySelector('#loginError');
const captchaContainer = document.querySelector('.captcha-container');
if (loginForm) {
// Show CAPTCHA if needed
if (simpleAuth.needsCaptcha() && captchaContainer) {
captchaContainer.style.display = 'flex';
}
}
// Handle logout button
const logoutButton = document.querySelector('button[name="logoutButton"]');
if (logoutButton) {
logoutButton.addEventListener('click', async (e) => {
e.preventDefault();
await simpleAuth.logout();
});
}
// Validate token if authenticated
if (simpleAuth.isAuthenticated()) {
simpleAuth.validateToken().then(valid => {
if (!valid) {
if (!localStorage.getItem('validationAttempted')) {
localStorage.setItem('validationAttempted', 'true');
window.location.reload();
} else {
localStorage.removeItem('validationAttempted');
}
} else {
localStorage.removeItem('validationAttempted');
}
});
}
// Mark initialization as complete
window.initializationComplete = true;
});
}
</script>
</body>
</html>