i finally committed i guess
Signed-off-by: boris <boris@borishub.co.uk>
This commit is contained in:
92
Views/template/footer.phtml
Normal file → Executable file
92
Views/template/footer.phtml
Normal file → Executable file
@@ -1,8 +1,6 @@
|
||||
</div>
|
||||
<div class="site-footer fixed-bottom mt-auto">
|
||||
<div class="col-auto">
|
||||
<?php require_once('pagination.phtml'); ?>
|
||||
</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>
|
||||
@@ -10,10 +8,92 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<!-- script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script -->
|
||||
<script src="/js/bootstrap.min.js"></script>
|
||||
<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>
|
Reference in New Issue
Block a user