PageSourceSearch

https://stmaryslawjournal.org/wp-content/plugins/copygen-addons/in…/Extended/quick-view/js/quick.js?ver=1.0.0

js stmaryslawjournal.org collected 2026-10-02 10:25:48 UTC 5,054 bytes, 125 lines download raw bytes

1jQuery(document).ready(function($) {
2    "use strict";
3
4    function handleVariationImage() {
5        var $quickView = $('.quick_view');
6        var $variationForm = $quickView.find('.variations_form');
7
8        // Initialize variation form
9        $variationForm.wc_variation_form();
10
11        // Trigger variation form events
12        $variationForm.trigger('check_variations');
13        $variationForm.trigger('reset_image');
14
15        $variationForm.on('found_variation', function(event, variation) {
16            var $mainImage = $quickView.find('.woocommerce-product-gallery__image img');
17            var variationImageSrc = variation.image.src;
18            var variationImageSrcset = variation.image.srcset;
19            var variationImageSizes = variation.image.sizes;
20
21            if (variationImageSrc) {
22                $mainImage.attr('src', variationImageSrc);
23            }
24
25            if (variationImageSrcset) {
26                $mainImage.attr('srcset', variationImageSrcset);
27            }
28
29            if (variationImageSizes) {
30                $mainImage.attr('sizes', variationImageSizes);
31            }
32        });
33    }
34
35    $(".copygen_quick_view_btn").click(function(event) {
36        event.preventDefault();
37        var $quickViewBtn = $(this);
38        var data = {
39            action: 'quick_view',
40            id: $quickViewBtn.attr('href'),
41            nonce: copygenAjax.nonce  ,
42            beforeSend: function() {
43                $('.quick_view_loading').addClass('loading');
44            }
45        };
46        $.post(copygenAjax.ajaxurl, data, function(response) {
47            $.magnificPopup.open({
48                type: 'inline',
49                preloader: true,
50                removalDelay: 160,
51                zoom: {
52                    enabled: true,
53                    duration: 50
54                },
55                mainClass: 'mfp-fade',
56                items: {
57                    src: response
58                },
59                callbacks: {
60                    open: function() {
61                        handleVariationImage();
62                    }
63                }
64            });
65            $('.quick_view_loading').removeClass('loading');
66            $('body').addClass('quickview_enable');
67
68            // Select the elements with the class "your-class"
69            var elements_r = $('.quick_view .woocommerce-product-gallery');
70
71            // Remove the inline style from each selected element
72            elements_r.removeAttr('style');
73            var element = $('.quick_view .woocommerce-product-gallery .woocommerce-product-gallery__wrapper');
74            // Add the class "galler_box" to the selected element
75            element.addClass('owl-carousel');
76            var owl = $('.quick_view .woocommerce-product-gallery__wrapper');
77            owl.owlCarousel({
78                autoplay: true,
79                autoplayTimeout: 4000,
80                loop: false,
81                dots: false,
82                items: 1,
83                center: false,
84                nav: true,
85            });
86
87            $('.quick_view .mfp-close').on('click', function() {
88                $('.quick_view, .mfp-wrap').css('opacity', 0);
89            });
90 
91            $('.product:not(.product-type-external) form.cart').on('submit', function (e) {
92                e.preventDefault();
93                var form = $(this);
94                var formData = new FormData(form[0]);
95                formData.append('add-to-cart', form.find('[name=add-to-cart]').val());
96                $.ajax({
97                    url: wc_add_to_cart_params.wc_ajax_url.toString().replace('%%endpoint%%', 'ace_add_to_cart'),
98                    data: formData,
99                    type: 'POST',
100                    processData: !1,
101                    contentType: !1,
102                    complete: function (response) {
103                        response = response.responseJSON;
104                        if (!response) {
105                            return
106                        }
107                        if (response.error && response.product_url) {
108                            window.location = response.product_url;
109                            return
110                        }
111                        if (wc_add_to_cart_params.cart_redirect_after_add === 'yes') {
112                            window.location = wc_add_to_cart_params.cart_url;
113                            return
114                        }
115                        var $thisbutton = form.find('.single_add_to_cart_button');
116                        $(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, $thisbutton]);
117                        $('.woocommerce-error, .woocommerce-message, .woocommerce-info').remove();
118                        $(response.fragments.notices_html).appendTo('.cart_notice').delay(3000).fadeOut(300)
119                    }
120                });
121            });
122            
123        });
124    });
125});

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.