1jQuery(document).ready(function ($) { 2 $(document).on('click', '#stm_em_event_booking_modal_trigger', function() { 3 // Get the modal 4 var modal = $('#stm_em_event_booking_modal'); 5 6 // Get the modal body 7 var body = $('#stm_em_event_booking_modal_body'); 8 9 // Get the booking form 10 var form = $('[name="booking-form"]')[0]; 11 12 // Get form inputs 13 var form_inputs = form.querySelectorAll('input,textarea,select'); 14 const formSubmitBtn = form.querySelector('#stm_em_event_booking_modal input[type="submit"]'); 15 // Set modal body content 16 body.html(''); 17 if (form_inputs && form_inputs.length > 0) { 18 for (var i=0; i<form_inputs.length; i++) { 19 var input = form_inputs[i]; 20 if (input.type != 'hidden' && input.type != 'submit' && input.name != 'data_privacy_consent' && input.name != 'newsletter[]' && input.name != 'billing_address[]' && !input.disabled) { 21 var label, value; 22 if(!input.previousElementSibling) { 23 if(input.value == 0) { 24 continue; 25 } 26 if(!input || !input.parentElement || !input.parentElement.previousElementSibling) { 27 return; 28 } 29 var label_text = input.parentElement.previousElementSibling.previousElementSibling == null ? input.parentElement.previousElementSibling : input.parentElement.previousElementSibling.previousElementSibling; 30 label = "<strong>"+label_text.innerHTML+"</strong>"; 31 } else { 32 const labelStr = input.labels && input.labels.length > 0 ? input.labels[0].innerHTML : input.previousElementSibling.innerHTML || input.closest('.input-group').querySelector('label').innerText; 33 label = "<strong>"+labelStr+"</strong>"; 34 } 35 value = input.value ? input.value : "Keine Eingabe"; 36 value = input.tagName == 'TEXTAREA' ? "<p>"+value+"</p>" : value; 37 var modal_input = document.createElement("p"); 38 modal_input.innerHTML = label + '<br>' + value; 39 body.append(modal_input); 40 } 41 } 42 } 43 // modify form submit button styling 44 formSubmitBtn.setAttribute('data-nostyle', ''); 45 // display modal 46 stmOpenBookingConfirmationModal(modal) 47 }); 48}); 49 50 51// this is pretty much a copy-past from the events manager openModal function 52// we need a custom implementation here because the modal needs to stay within the booking form 53function stmOpenBookingConfirmationModal(modal){ 54 modal = jQuery(modal) 55 setTimeout( function(){ 56 modal.addClass('active').find('.em-modal-popup').addClass('active') 57 jQuery(document).triggerHandler('em_modal_open', [modal]) 58 document.dispatchEvent( new CustomEvent('em_modal_open', { detail: { modal: modal } }) ) 59 }, 100) // timeout allows css transition 60}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.