PageSourceSearch

https://bmwra.org/wp-content/plugins/eventon-tickets/assets/tx_wc_variable.js?ver=2.5.8

js bmwra.org collected 2026-09-26 02:19:24 UTC 12,274 bytes, 293 lines download raw bytes

1/**
2 *  Tickets Variable Product Javascript
3 * @version: 2.4.4
4 * @license EventON JavaScript Assets 
5 * Copyright (C) 2014-2025 Ashan Jay, AshanJay Designs LLC.
6 * 
7 * PROPRIETARY LICENSE - All Rights Reserved
8 * 
9 * Permission granted solely for personal use with valid EventON license.
10 * YOU MAY NOT: redistribute, resell, sublicense, or publish these Assets.
11 * 
12 * Trademark: "EventON" is a trademark of AshanJay Designs LLC.
13 * Contact: [email protected]
14 * 
15 * PROVIDED "AS IS" WITHOUT WARRANTY. VIOLATION MAY RESULT IN LEGAL ACTION.
16 */
17jQuery(document).ready(function($){
18
19
20
21//if( $('body').find('.evotx_show_variations').length  == 0) return;
22
23//* Variations Plugin
24(function (e, t, n, r) {
25
26
27    e.fn._wc_variation_form = function () {
28        e.fn._wc_variation_form.find_matching_variations = function (t, n) {
29            var r = [];
30            for (var i = 0; i < t.length; i++) {
31                var s = t[i],
32                o = s.variation_id;
33                e.fn._wc_variation_form.variations_match(s.attributes, n) && r.push(s)
34            }
35            return r
36        };
37        e.fn._wc_variation_form.variations_match = function (e, t) {
38            var n = !0;
39            for (attr_name in e) {
40                var i = e[attr_name],
41                s = t[attr_name];
42                i !== r && s !== r && i.length != 0 && s.length != 0 && i != s && (n = !1)
43            }
44            return n
45        };
46
47        this.unbind("check_variations update_variation_values found_variation");
48        this.find(".reset_variations").unbind("click");
49        this.find(".variations select").unbind("change focusin");
50        return this.on("click", ".reset_variations", function (t) {
51        e(this).closest("form.variations_form").find(".variations select").val("").change();
52        var n = e(this).closest(".product").find(".sku"),
53        r = e(this).closest(".product").find(".product_weight"),
54        i = e(this).closest(".product").find(".product_dimensions");
55        n.attr("data-o_sku") && n.text(n.attr("data-o_sku"));
56        r.attr("data-o_weight") && r.text(r.attr("data-o_weight"));
57        i.attr("data-o_dimensions") && i.text(i.attr("data-o_dimensions"));
58        return !1
59        }).on("change", ".variations select", function (t) {
60
61            //console.log('rr');
62            
63            var SECTION = $(this).closest('.evotx_ticket_purchase_section');
64            $('body').trigger('evotx_calculate_total', [ SECTION ]); 
65
66            $variation_form = e(this).closest("form.variations_form");
67            $variation_form.find("input[name=variation_id]").val("").change();
68            $variation_form.find(".evotx_wc_var_addcart_trig").data("variation_id", '');
69            $variation_form.trigger("woocommerce_variation_select_change").trigger("check_variations", ["", !1]);
70            e(this).blur();
71            e().uniform && e.isFunction(e.uniform.update) && e.uniform.update()
72        }).on("focusin", ".variations select", function (t) {
73            $variation_form = e(this).closest("form.variations_form");
74            $variation_form.trigger("woocommerce_variation_select_focusin").trigger("check_variations", [e(this).attr("name"), !0])
75        }).on("check_variations", function (n, r, i) {
76            var s = !0,
77            o = !1,
78            u = !1,
79            a = {},
80            f = e(this),
81            l = f.find(".reset_variations");
82            f.find(".variations select").each(function () {
83            e(this).val().length == 0 ? s = !1 : o = !0;
84            if (r && e(this).attr("name") == r) {
85            s = !1;
86            a[e(this).attr("name")] = ""
87            } else {
88            value = e(this).val();
89            a[e(this).attr("name")] = value
90            }
91            });
92            var c = parseInt(f.data("product_id")),
93            h = f.data("product_variations");
94            h || (h = t.product_variations[c]);
95            h || (h = t.product_variations);
96            h || (h = t["product_variations_" + c]);
97            var p = e.fn._wc_variation_form.find_matching_variations(h, a);
98            if (s) {
99                var d = p.pop();
100                if (d) {
101                    f.find("input[name=variation_id]").val(d.variation_id).change();
102                    f.find(".evotx_wc_var_addcart_trig").data("variation_id", d.variation_id );
103                    f.trigger("found_variation", [d])
104                } else {
105                    f.find(".variations select").val("");
106                    i || f.trigger("reset_image");
107                    alert(woocommerce_params.i18n_no_matching_variations_text)
108                }
109            } else {
110                f.trigger("update_variation_values", [p]);
111                i || f.trigger("reset_image");
112                r || f.find(".single_variation_wrap").hide()
113            }
114        o ? l.css("visibility") == "hidden" && l.css("visibility", "visible").hide().fadeIn() : l.css("visibility", "hidden")
115        }).on("reset_image", function (t) {
116            var n = e(this).closest(".product"),
117            r = n.find("div.images img:eq(0)"),
118            i = n.find("div.images a.zoom:eq(0)"),
119            s = r.attr("data-o_src"),
120            o = r.attr("data-o_title"),
121            u = i.attr("data-o_href");
122            s && r.attr("src", s);
123            u && i.attr("href", u);
124            if (o) {
125                r.attr("alt", o).attr("title", o);
126                i.attr("title", o)
127            }
128        }).on("update_variation_values", function (t, n) {
129            $variation_form = e(this).closest("form.variations_form");
130            $variation_form.find(".variations select").each(function (t, r) {
131                current_attr_select = e(r);
132                current_attr_select.data("attribute_options") || current_attr_select.data("attribute_options", current_attr_select.find("option:gt(0)").get());
133                current_attr_select.find("option:gt(0)").remove();
134                current_attr_select.append(current_attr_select.data("attribute_options"));
135                current_attr_select.find("option:gt(0)").removeClass("active");
136                var i = current_attr_select.attr("name");
137                 
138                for (num in n)
139                if (typeof n[num] != "undefined") {
140                    var s = n[num].attributes;
141                    for (attr_name in s) {
142                        var o = s[attr_name];
143                        if (attr_name == i) if (o) {
144                            o = e("<div/>").html(o).text();
145                            o = o.replace(/'/g, "\\'");
146                            o = o.replace(/"/g, '\\"');
147                            current_attr_select.find('option[value="' + o + '"]').addClass("active")
148                        } else current_attr_select.find("option:gt(0)").addClass("active")
149                    }
150                }
151                current_attr_select.find("option:gt(0):not(.active)").remove()
152            });
153            $variation_form.trigger("woocommerce_update_variation_values")
154        }).on("found_variation", function (t, n) {
155
156            var r = e(this),
157            i = e(this).closest(".product"),
158            s = i.find("div.images img:eq(0)"),
159            o = i.find("div.images a.zoom:eq(0)"),
160            u = s.attr("data-o_src"),
161            a = s.attr("data-o_title"),
162            f = o.attr("data-o_href"),
163            l = n.image_src,
164            c = n.image_link,
165            h = n.image_title;
166            r.find(".variations_button").show();
167            r.find(".single_variation").html(n.price_html + n.availability_html).show();
168            if (!u) {
169                u = s.attr("src") ? s.attr("src") : "";
170                s.attr("data-o_src", u)
171            }
172            if (!f) {
173                f = o.attr("href") ? o.attr("href") : "";
174                o.attr("data-o_href", f)
175            }
176            if (!a) {
177                a = s.attr("title") ? s.attr("title") : "";
178                s.attr("data-o_title", a)
179            }
180            if (l && l.length > 1) {
181                s.attr("src", l).attr("alt", h).attr("title", h);
182                o.attr("href", c).attr("title", h)
183            } else {
184                s.attr("src", u).attr("alt", a).attr("title", a);
185                o.attr("href", f).attr("title", a)
186            }
187            var p = r.find(".single_variation_wrap"),
188            d = i.find(".product_meta").find(".sku"),
189            v = i.find(".product_weight"),
190            m = i.find(".product_dimensions");
191            d.attr("data-o_sku") || d.attr("data-o_sku", d.text());
192            v.attr("data-o_weight") || v.attr("data-o_weight", v.text());
193            m.attr("data-o_dimensions") || m.attr("data-o_dimensions", m.text());
194            n.sku ? d.text(n.sku) : d.text(d.attr("data-o_sku"));
195             
196            n.weight ? v.text(n.weight) : v.text(v.attr("data-o_weight"));
197            n.dimensions ? m.text(n.dimensions) : m.text(m.attr("data-o_dimensions"));
198            p.find(".quantity").show();
199            !n.is_in_stock && !n.backorders_allowed && r.find(".variations_button").hide();
200
201            n.min_qty ? 
202                p.find("input[name=quantity]").attr("min", n.min_qty).val(n.min_qty) : 
203                p.find("input[name=quantity]").removeAttr("min");
204            n.max_qty ? 
205                p.find("input[name=quantity]").attr("max", n.max_qty) : 
206                p.find("input[name=quantity]").removeAttr("max");
207
208            if (n.is_sold_individually == "yes") {
209                p.find("input[name=quantity]").val("1");
210                p.find(".quantity").hide()
211            }
212            p.show().trigger("show_variation", [n])
213        });
214         
215        /**
216        * Initial states and loading
217        */
218        jQuery('form.variations_form .variations select').change();
219         
220        /**
221        * Helper functions for variations
222        */
223         
224        // Search for matching variations for given set of attributes     
225        function find_matching_variations(product_variations, settings) {
226            var matching = [];
227             
228            for (var i = 0; i < product_variations.length; i++) {
229                var variation = product_variations[i];
230                var variation_id = variation.variation_id;
231                 
232                if (variations_match(variation.attributes, settings)) {
233                    matching.push(variation);
234                }
235            }
236            return matching;
237        }
238         
239        // Check if two arrays of attributes match 
240        function variations_match(attrs1, attrs2) {
241            var match = true;
242            for (attr_name in attrs1) {
243                var val1 = attrs1[attr_name];
244                    var val2 = attrs2[attr_name];
245                if (val1 !== undefined && val2 !== undefined && val1.length != 0 && val2.length != 0 && val1 != val2) {
246                    match = false;
247                }
248            }
249            return match;
250        }
251     
252    };
253   
254
255})(jQuery, window, document); // JavaScript Document
256
257
258
259// when clicked on  order now button run custom variations function
260    $('body').on('click', '.evotx_show_variations',function(e){
261        e.preventDefault();
262
263        var O = jQuery(this);
264
265        O.parent().hide();
266        var _this_form = O.parent().siblings('.variations_form');
267
268        _this_form.show();
269
270        _this_form._wc_variation_form();
271
272        setTimeout(function(){
273            vars = O.data('defv');
274
275            _this_form.find('.variations select').each(function(){
276                sO = jQuery(this);
277                sF = sO.attr('id');
278                if( sF in vars){
279                    sO.find('option[value="'+ vars[sF] +'"]').prop('select',true);                    
280                }else{
281                    sO.find('option:eq(2)').prop('select',true);      
282                }
283
284                
285                sO.change();
286            });
287        },200);   
288    });
289
290//} // end if
291
292
293});

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.