PageSourceSearch

https://techmkt.pro/wp-content/plugins/get-a-quote-button-for-woocommerce/assets/js/frontend.js?ver=1.6.7

js techmkt.pro collected 2026-10-07 18:12:50 UTC 7,465 bytes, 203 lines download raw bytes

1+(function ($) {
2    "use strict";
3
4    /**
5     * Executes all inline <script> tags inside a container
6     * and reinitializes WPForms
7     */
8    function reinitWPForms(containerSelector = ".swal2-popup") {
9        const $container = $(containerSelector);
10
11        $container.find("script").each(function () {
12            try {
13                eval(this.textContent);
14            } catch (e) {
15                console.warn("WPB Inline Script Execution Error:", e);
16            }
17        });
18
19        // Reinitialize WPForms
20        if (window.wpforms && typeof window.wpforms.init === "function") {
21            window.wpforms.init();
22        }
23    }
24
25    /**
26     * Fire The Popup
27     */
28    $(document).on("click", ".wpb-get-a-quote-button-form-fire", function (e) {
29        e.preventDefault();
30
31        var button = $(this),
32            id = button.attr("data-id"),
33            post_id = button.attr("data-post_id"),
34            form_style = button.attr("data-form_style") ? !0 : !1,
35            allow_outside_click = button.attr("data-allow_outside_click")
36                ? !0
37                : !1,
38            width = button.attr("data-width");
39
40          // УБИРАЕМ блок beforeSend, который добавляет класс с анимацией
41    wp.ajax.send({
42        ajax_option: "fire_wpb_gqb_contact_form",
43        data: {
44            action: "fire_contact_form",
45            contact_form_id: id,
46            wpb_post_id: post_id,
47        },
48        // УДАЛЕНО: beforeSend: function (xhr) {
49        //     button.addClass("wpb-gqf-btn-loading");
50        // },
51        success: function (res) {
52            // УБИРАЕМ удаление класса (хотя он теперь и не добавляется)
53            // button.removeClass("wpb-gqf-btn-loading");
54                Swal.fire({
55                    html: res,
56                    showConfirmButton: false,
57                    customClass: {
58                        container:
59                            "wpb-gqf-popup wpb-gqf-form-style-" + form_style,
60                    },
61                    padding: "30px",
62                    width: width,
63                    showCloseButton: true,
64                    backdrop: true,
65                    allowOutsideClick: allow_outside_click,
66                });
67
68                // reInit WPForms
69                setTimeout(function () {
70                    reinitWPForms();
71                }, 50);
72
73                // For CF7 5.3.1 and before
74                if (
75                    typeof wpcf7 !== "undefined" &&
76                    typeof wpcf7.initForm === "function"
77                ) {
78                    wpcf7.initForm($(".wpcf7-form"));
79                }
80
81                // For CF7 5.4 and after
82                if (
83                    typeof wpcf7 !== "undefined" &&
84                    typeof wpcf7.init === "function"
85                ) {
86                    document
87                        .querySelectorAll(".wpcf7 > form")
88                        .forEach(function (e) {
89                            return wpcf7.init(e);
90                        });
91                }
92
93                // Reinitialize reCAPTCHA v3
94                if (
95                    typeof grecaptcha !== "undefined" &&
96                    typeof wpcf7_recaptcha !== "undefined"
97                ) {
98                    grecaptcha.ready(function () {
99                        grecaptcha
100                            .execute(wpcf7_recaptcha.sitekey, {
101                                action: wpcf7_recaptcha.actions.contactform,
102                            })
103                            .then(function (token) {
104                                const event = new CustomEvent(
105                                    "wpcf7grecaptchaexecuted",
106                                    {
107                                        detail: {
108                                            action: wpcf7_recaptcha.actions
109                                                .contactform,
110                                            token: token,
111                                        },
112                                    }
113                                );
114                                document.dispatchEvent(event);
115
116                                // Update the hidden input in the dynamically loaded form
117                                $(".wpcf7-form")
118                                    .find(
119                                        'input[name="_wpcf7_recaptcha_response"]'
120                                    )
121                                    .val(token);
122                            });
123                    });
124                }
125
126                // Add support for - Simple Cloudflare Turnstile – CAPTCHA Alternative
127                if (typeof turnstile !== "undefined") {
128                    var cf_turnstile_id = $($.parseHTML(res))
129                        .find(".cf-turnstile")
130                        .attr("id");
131                    if (document.getElementById(cf_turnstile_id)) {
132                        setTimeout(function () {
133                            turnstile.render("#" + cf_turnstile_id);
134                        }, 10);
135                    }
136                }
137
138                // Add support for - Drag and Drop Multiple File Upload – Contact Form 7
139                if (typeof initDragDrop === "function") {
140                    window.initDragDrop();
141                }
142
143                // ReCaptcha v2 for Contact Form 7 - By IQComputing
144                if (typeof recaptchaCallback === "function") {
145                    recaptchaCallback();
146                }
147
148                // Add support for - Conditional Fields for Contact Form 7
149                if (typeof wpcf7cf !== "undefined") {
150                    wpcf7cf.initForm($(".wpcf7-form"));
151                }
152
153                // Add post ID to the popup form
154                $("[name='_wpcf7_container_post']").val(post_id);
155
156                // WP Armour – Honeypot Anti Spam By Dnesscarkey.
157                if (typeof wpa_add_honeypot_field == "function") {
158                    wpa_add_honeypot_field();
159                }
160
161                // WP Armour PRO – Honeypot Anti Spam By Dnesscarkey.
162                if (typeof wpae_add_honeypot_field == "function") {
163                    // IF EXTENDED version exists.
164                    wpae_add_honeypot_field();
165                }
166
167                // Adding any custom JS code on form init
168                if (typeof wpb_gqf_on_cf7_form_init === "function") {
169                    wpb_gqf_on_cf7_form_init();
170                }
171            },
172            error: function (error) {
173                alert(error);
174            },
175        });
176    });
177
178    /**
179     * Hide if variation has no stock
180     */
181
182    $(document).on(
183        "found_variation",
184        "form.variations_form",
185        function (event, variation) {
186            if (!variation.is_in_stock) {
187                $(".wpb-gqb-product-type-variable").addClass(
188                    "wpb-gqb-product-type-variable-show"
189                );
190            } else {
191                $(".wpb-gqb-product-type-variable").removeClass(
192                    "wpb-gqb-product-type-variable-show"
193                );
194            }
195        }
196    );
197
198    $(document).on("click", ".reset_variations", function (event) {
199        $(".wpb-gqb-product-type-variable").removeClass(
200            "wpb-gqb-product-type-variable-show"
201        );
202    });
203})(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.