1(function ($) { 2 "use strict"; 3 4 $(window).load(function () { 5 attendee_checkbox_check(); 6 }); 7 8 $(document).on('click', '[name="mp_form_builder_same_attendee"]', function () { 9 attendee_info_copy($(this)); 10 }); 11 $(document).on('change', '.dada-info input:visible,.dada-info select:visible,.dada-info textarea:visible', function () { 12 let target=$(this).closest('.mep-user-info-sec').find('[name="mp_form_builder_same_attendee"]'); 13 if(target.length>0 && target.is(":checked")){ 14 let parent = $(this).closest('.dada-info'); 15 change_attendee_info($(this),parent); 16 } 17 }); 18 $(document).on('click', '#mage_event_submit .qty_inc', function () { 19 let target=$(this).closest('tr').next().find('[name="mp_form_builder_same_attendee"]'); 20 if(target.length>0){ 21 attendee_info_copy(target); 22 } 23 }); 24 $(document).on('change', '#mage_event_submit [name="option_qty[]"]', function () { 25 let target=$(this).closest('tr').next().find('[name="mp_form_builder_same_attendee"]'); 26 if(target.length>0){ 27 attendee_info_copy(target); 28 }else { 29 $(this).closest('tr').next().find('.dada-info>div:first-child .mep-user-info-sec h5').append('<label class="mep_same_attendee"><input type="checkbox" name="mp_form_builder_same_attendee" /><span>Same Attendee.</span></label>'); 30 } 31 }); 32 33 function attendee_checkbox_check() { 34 $('#mage_event_submit').find('.user-info-sec').each(function () { 35 if ($(this).find('[name="mp_form_builder_same_attendee"]').length < 1) { 36 $(this).find('.dada-info>div:first-child .mep-user-info-sec h5').append('<label><input type="checkbox" name="mp_form_builder_same_attendee" /><span>Same Attendee</span></label>'); 37 } 38 }); 39 } 40 function attendee_info_copy($this){ 41 if ($this.is(":checked")) { 42 $this.closest('tr').find('.dada-info>div:not(:first-child)').slideUp(250); 43 let parent = $this.closest('.dada-info'); 44 let current_parent = $this.closest('.mep-user-info-sec'); 45 current_parent.find('input:visible , select:visible , textarea:visible').each(function () { 46 change_attendee_info($(this),parent); 47 }); 48 } else { 49 $this.closest('.user-info-sec').find('.dada-info>div:not(:first-child)').slideDown(250); 50 } 51 } 52 function change_attendee_info($this,parent){ 53 let input_name = $this.attr('name'); 54 let value = $this.val(); 55 parent.find('[name="' + input_name + '"]').each(function () { 56 if ($(this).is('select')) { 57 $(this).find('option[value='+value+']').attr('selected', true); 58 } else { 59 $(this).val(value); 60 } 61 }); 62 } 63 64}(jQuery));
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.