33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const toastElement = document.getElementById('statusToast');
|
|
if (toastElement && window.bootstrap) {
|
|
const toast = new bootstrap.Toast(toastElement, { delay: 4200 });
|
|
toast.show();
|
|
}
|
|
|
|
document.querySelectorAll('a[href^="#"]').forEach((link) => {
|
|
link.addEventListener('click', (event) => {
|
|
const targetId = link.getAttribute('href');
|
|
if (!targetId || targetId === '#') {
|
|
return;
|
|
}
|
|
const target = document.querySelector(targetId);
|
|
if (!target) {
|
|
return;
|
|
}
|
|
event.preventDefault();
|
|
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
});
|
|
});
|
|
|
|
document.querySelectorAll('.needs-validation').forEach((form) => {
|
|
form.addEventListener('submit', (event) => {
|
|
if (!form.checkValidity()) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
form.classList.add('was-validated');
|
|
});
|
|
});
|
|
});
|