first commit
This commit is contained in:
25
resources/js/app.js
Normal file
25
resources/js/app.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import $ from 'jquery';
|
||||
window.$ = window.jQuery = $;
|
||||
|
||||
import * as bootstrap from 'bootstrap';
|
||||
window.bootstrap = bootstrap;
|
||||
|
||||
// Aktifkan tooltip & auto-dismiss alert
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach((el) => new bootstrap.Tooltip(el));
|
||||
|
||||
setTimeout(() => {
|
||||
document.querySelectorAll('.alert-auto-dismiss').forEach((el) => {
|
||||
bootstrap.Alert.getOrCreateInstance(el).close();
|
||||
});
|
||||
}, 5000);
|
||||
|
||||
// Pengesahan ringkas sebelum hantar borang berbahaya
|
||||
document.querySelectorAll('form[data-confirm]').forEach((form) => {
|
||||
form.addEventListener('submit', (e) => {
|
||||
if (!window.confirm(form.getAttribute('data-confirm'))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user