- Complete mail-in payment gateway for Event Tickets Commerce - Support for check payments with collapsible checkout interface - Admin interface for managing check payments and order status - Professional asset organization with proper WordPress enqueuing - Order management with status tracking (pending, received, bounced) - Template system with responsive design and accessibility features - Integration with Event Tickets Commerce order system - Settings page for configuring payment instructions and addresses
46 lines
No EOL
1.4 KiB
JavaScript
46 lines
No EOL
1.4 KiB
JavaScript
/**
|
|
* Mail-In Payment Gateway Checkout JavaScript
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const toggleButton = document.getElementById('mail-in-toggle-button');
|
|
const content = document.getElementById('mail-in-content');
|
|
const toggleIcon = toggleButton ? toggleButton.querySelector('.toggle-icon') : null;
|
|
|
|
// Only initialize if elements exist
|
|
if (!toggleButton || !content || !toggleIcon) {
|
|
return;
|
|
}
|
|
|
|
// Initialize accessibility attributes
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
toggleButton.setAttribute('aria-controls', 'mail-in-content');
|
|
content.setAttribute('aria-hidden', 'true');
|
|
|
|
toggleButton.addEventListener('click', function() {
|
|
const isExpanded = content.style.display !== 'none';
|
|
|
|
if (isExpanded) {
|
|
// Hide content
|
|
content.style.display = 'none';
|
|
toggleIcon.textContent = '▶';
|
|
toggleButton.setAttribute('aria-expanded', 'false');
|
|
content.setAttribute('aria-hidden', 'true');
|
|
} else {
|
|
// Show content
|
|
content.style.display = 'block';
|
|
toggleIcon.textContent = '▼';
|
|
toggleButton.setAttribute('aria-expanded', 'true');
|
|
content.setAttribute('aria-hidden', 'false');
|
|
}
|
|
});
|
|
|
|
// Handle keyboard navigation
|
|
toggleButton.addEventListener('keydown', function(e) {
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
e.preventDefault();
|
|
toggleButton.click();
|
|
}
|
|
});
|
|
}); |