PageSourceSearch

https://helenarkell.org.uk/wp-content/plugins/woocommerce-event-ma…/js/same_attendee_script.js?ver=1790268084

js helenarkell.org.uk collected 2026-09-24 17:57:10 UTC 3,727 bytes, 77 lines download raw bytes

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