22 lines
898 B
JavaScript
22 lines
898 B
JavaScript
const confirmationForm = document.querySelector('[data-magic-confirmation]');
|
|
if (confirmationForm) {
|
|
confirmationForm.addEventListener('submit', (event) => {
|
|
const button = confirmationForm.querySelector('button[type="submit"]');
|
|
if (button.disabled) {
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
button.disabled = true;
|
|
button.setAttribute('aria-busy', 'true');
|
|
button.textContent = 'در حال باز کردن تیکت…';
|
|
confirmationForm.querySelector('[role="status"]').textContent = button.textContent;
|
|
});
|
|
window.addEventListener('pageshow', () => {
|
|
const button = confirmationForm.querySelector('button[type="submit"]');
|
|
button.disabled = false;
|
|
button.removeAttribute('aria-busy');
|
|
button.textContent = 'خروج از حساب و مشاهده تیکت';
|
|
confirmationForm.querySelector('[role="status"]').textContent = '';
|
|
});
|
|
}
|