PageSourceSearch

https://goodfoodandwineshow.co.za/wp-content/plugins/wp-user-frontend/assets/js/conditional-logic.js?ver=4.7.5

js goodfoodandwineshow.co.za collected 2026-10-02 13:29:05 UTC 4,652 bytes, 139 lines download raw bytes

1(function($) {
2
3    var conditional_logic = {
4
5        init: function() {
6
7            var _this = this;
8            _this.change();
9
10            // events
11            $(document).on( 'change', '.wpuf-fields input, .wpuf-fields textarea, .wpuf-fields select', function(){
12                _this.change();
13            });
14        },
15
16        change: function() {
17
18            var cond_field_val = [],
19                all = [],
20                prefix = 'wpuf_';
21
22            if ( typeof wpuf_conditional_items === 'undefined' ) {
23                return;
24            }
25
26            $.each( wpuf_conditional_items, function( k, item ) {
27
28                $.each( item.cond_field, function( key, value ) {
29
30                    var form_id     = '_'+item.form_id,
31                        selector    = '.'+prefix+value+form_id,
32                        value       = item.cond_option[key],
33                        operator    = ( item.cond_operator[key] == '=' ) ? true : false,
34                        select      = $('select'+selector),
35                        checkbox    = $('input[type=checkbox][value="'+value+'"]'+selector ),
36                        radio       = $('input[type=radio][value="'+value+'"]'+selector),
37                        select      = $('select'+selector+'>option[value="'+value+'"]');
38
39
40                    if ( select.length ) {
41
42                        var select_selectd_status = select.is(':selected') ? true : false;
43
44                        if ( operator && select_selectd_status  ) {
45                            all[key] = true;
46
47                        } else if ( operator === false && select_selectd_status === false ) {
48                            all[key] = true;
49
50                        } else {
51                            all[key] = false;
52                        }
53                    }
54
55                    if ( radio.length ) {
56
57                        var radio_checked_status = radio.is(':checked') ? true : false;
58
59                        if ( operator && radio_checked_status  ) {
60
61                            all[key] = true;
62
63                        } else if ( operator === false && radio_checked_status === false ) {
64
65                            all[key] = true;
66
67                        } else {
68                            all[key] = false;
69                        }
70                    }
71
72                    if ( checkbox.length ) {
73
74                        var checkbox_checked_status = checkbox.is(':checked') ? true : false;
75
76                        if( operator && checkbox_checked_status  ) {
77                            all[key] = true;
78
79                        } else if ( operator === false && checkbox_checked_status === false ) {
80                            all[key] = true;
81
82                        } else {
83                            all[key] = false;
84                        }
85                    }
86                });
87
88                if ( item.cond_logic == 'any') {
89
90                    var check = all.indexOf( true );
91
92                    if ( check != '-1') {
93
94                        if ( item.type == 'address' ) {
95                            $( 'li.wpuf-el.' + item.name ).show();
96                        } else {
97                            $( '.' + prefix + item.name + '_' + item.form_id).closest('li').show();
98                        }
99
100                    } else {
101
102                        if ( item.type == 'address' ) {
103                            $( 'li.wpuf-el.' + item.name ).hide();
104                        } else {
105                            $( '.' + prefix + item.name + '_' + item.form_id).closest('li').hide();
106                        }
107
108                    }
109
110                } else {
111
112                    var check = all.indexOf( false );
113
114                    if ( check == '-1') {
115
116                        if ( item.type == 'address' ) {
117                            $( 'li.wpuf-el.' + item.name ).show();
118                        } else {
119                            $( '.' + prefix + item.name + '_' + item.form_id).closest('li').show();
120                        }
121
122                    } else {
123
124                        if ( item.type == 'address' ) {
125                            $( 'li.wpuf-el.' + item.name ).hide();
126                        } else {
127                            $( '.' + prefix+item.name + '_' + item.form_id).closest('li').hide();
128                        }
129                    }
130
131                }
132
133                all.length = 0;
134            });
135        }
136    }
137
138    conditional_logic.init();
139})(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.