32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
document.querySelectorAll('.toast').forEach((toastEl) => {
|
|
if (window.bootstrap) {
|
|
const toast = new bootstrap.Toast(toastEl, { delay: 3500 });
|
|
toast.show();
|
|
}
|
|
});
|
|
|
|
document.querySelectorAll('[data-copy-text]').forEach((button) => {
|
|
button.addEventListener('click', async () => {
|
|
const text = button.getAttribute('data-copy-text') || '';
|
|
try {
|
|
await navigator.clipboard.writeText(text);
|
|
button.textContent = 'Copied';
|
|
window.setTimeout(() => {
|
|
button.textContent = 'Copy demo credentials';
|
|
}, 1600);
|
|
} catch (error) {
|
|
console.error('Clipboard copy failed', error);
|
|
}
|
|
});
|
|
});
|
|
|
|
const hash = window.location.hash;
|
|
if (hash && hash.length > 1) {
|
|
const target = document.querySelector(hash);
|
|
if (target) {
|
|
window.setTimeout(() => target.scrollIntoView({ behavior: 'smooth', block: 'start' }), 120);
|
|
}
|
|
}
|
|
});
|