PageSourceSearch

https://mastheadsailinggear.com/wp-content/plugins/woocommerce-wis…/js/woocommerce-wishlists.js?ver=2.3.9

js mastheadsailinggear.com collected 2026-10-08 00:51:12 UTC 8,664 bytes, 269 lines download raw bytes

1;
2(function ($, window, document, undefined) {
3
4    $.fn.wc_wishlists_form = function () {
5        var $form = this;
6
7        if ($form.hasClass('variations_form')) {
8            $form.find('.wl-add-to').addClass('disabled');
9        }
10
11        $form
12            .on('hide_variation', function () {
13                $form.find('.wl-add-to').addClass('disabled');
14            })
15            .on('show_variation', function () {
16                $form.find('.wl-add-to').removeClass('disabled');
17            });
18
19
20        setTimeout(function () {
21            $form.trigger('check_variations');
22        }, 50);
23
24    };
25
26    $(document).on('wc_variation_form', function (e) {
27        var $form = $(e.target);
28        $form.wc_wishlists_form();
29    });
30
31})(jQuery, window, document);
32
33
34(function ($) {
35
36    var WCWL = {
37        current_product_form: 0
38    };
39
40
41    jQuery(document).ready(function ($) {
42        //it seems composite products has changed their class name.
43
44        var composite_class = $('.composite_wrap').length ? '.composite_wrap' : false;
45        if (!composite_class) {
46            composite_class = $('.bundle_wrap').length === 1 ? '.bundle_wrap' : ($('.composite_wrap').length ? '.composite_wrap' : false);
47        }
48
49
50        var bundles = $(composite_class);
51        if (bundles.length) {
52            $('.wl-button-wrap').first().appendTo($(composite_class)).removeClass('hide');
53        } else {
54            var variations = $('.variations_button');
55            if (variations.length) {
56                $('.wl-button-wrap').removeClass('hide');
57            }
58        }
59
60
61        //When page loads...
62        $(".wl-panel").hide(); //Hide all content
63        $("ul.wl-tabs li:first").addClass("active").show(); //Activate first tab
64        $(".wl-panel:first").show(); //Show first tab content
65
66        //On Click Event
67        $("ul.wl-tabs li").click(function () {
68            $("ul.wl-tabs li").removeClass("active"); //Remove any "active" class
69            $(this).addClass("active"); //Add "active" class to selected tab
70            $(".wl-panel").hide(); //Hide all tab content
71            var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
72            $(activeTab).fadeIn(); //Fade in the active ID content
73            return false;
74        });
75
76        /////////////////////////////////
77        // add to wishlist button effects
78        /////////////////////////////////
79
80        // basic wishlist popup stuff
81        $('#wl-list-pop-wrap').hide(); // hide background click-off on load
82        $('.wl-list-pop').hide(); // hide modal on load
83        $('#wl-list-pop-wrap').click(function () {
84
85            WCWL.current_product_form = null;
86            WCWL.current_product_id = 0;
87
88            $('.wl-list-pop').hide(); // hide modal when click in background
89            $('#wl-list-pop-wrap').hide(); // hide background click-off
90            $(window).unbind('scroll', adjust_scroll);
91        });
92
93        _productlink = null;
94        // position popup at button click
95
96        $('body').on('click', '.wl-add-to', function (e) {
97            if ($(this).hasClass('disabled')) {
98                e.preventDefault();
99                return false;
100            }
101
102            WCWL.current_product_form = $(this).closest('form.cart').eq(0);
103            if (!WCWL.current_product_form || WCWL.current_product_form.length === 0) {
104                if ($(this).closest('form.composite_form').length) {
105                    console.log('composite_form');
106                    WCWL.current_product_form = $(this).closest('form.composite_form').eq(0);
107                } else if ($(this).closest('form.bundle_form').length) {
108                    console.log('bundle_form');
109                    WCWL.current_product_form = $(this).closest('form.bundle_form').eq(0);
110                }
111            }
112
113            WCWL.current_product_id = $(this).data('productid');
114
115            _productlink = $(this);
116
117            if ($(this).hasClass('wl-add-to-single')) {
118                return;
119            }
120
121            $('#wl-list-pop-wrap').show(); // show background click-off on click
122            $('.wl-list-pop').show(); // show modal on click
123
124            var wlx = $(this).offset().left;
125            var wly = $(this).offset().top;
126            // need to add some code to adjust in case the user is logged in. WHen user is logged in with admin bar, it messes up the CSS since the body/html tags have the margin top on it
127            // need a way to check if admin bar is present, and if so, adjustt the coords below to subtract 28
128            if ($('#wpadminbar ').length) { // if admin bar exists, adjust numbers to compensate for bar
129                $(".wl-list-pop").css({
130                    top: wly - 28,
131                    left: wlx
132                }).show();
133            } else { // if not logged in, just display in regular position
134                $(".wl-list-pop").css({
135                    top: wly,
136                    left: wlx
137                }).show();
138            }
139
140            $(window).bind('scroll', adjust_scroll);
141
142            return false;
143        });
144
145        function adjust_scroll() {
146            var buttontop = _productlink.offset().top;
147            if ($('#wpadminbar ').length) {
148                buttontop = buttontop - 28;
149            }
150
151            $(".wl-list-pop").css({
152                top: buttontop
153            });
154        }
155
156        // close wishlist on esc key press
157        $(document).keyup(function (e) {
158            if (e.keyCode == 27) {
159                $('.wl-list-pop-wrap').hide();
160            }
161        });
162
163        $('body').on('click', '.wl-add-to-single', function (event) {
164            event.preventDefault();
165            var wlid = $(this).data('listid');
166
167            var $form = WCWL.current_product_form;
168            $form.find("input#wlid").val(wlid);
169
170
171            var sep = wishlist_params.current_url.indexOf('?') >= 0 ? '&' : '?';
172            const form_action = wishlist_params.current_url + sep + 'add-to-wishlist-itemid=' + WCWL.current_product_id;
173            $form.attr('action', form_action);
174
175            //console.log($form.find("input#wlid").eq(0).val());
176            //console.log($form.attr('action'));
177            $form.attr('method', 'post');
178            $form.submit();
179
180            return false;
181        });
182
183
184        $('.wl-shop-add-to-single').click(function (event) {
185            event.preventDefault();
186            window.location.href = _productlink.attr('href') + "&wlid=" + $(this).data('listid');
187            return false;
188        });
189
190
191        $('.wlconfirm').click(function () {
192            var message = $(this).data('message');
193
194            var answer = confirm(message ? message : wishlist_params.are_you_sure);
195            return answer;
196        });
197
198        $('input[type=checkbox]', '.wl-table thead tr th').click(function () {
199            $(this).closest('table').find(':checkbox').attr('checked', this.checked);
200        });
201
202
203        $('.share-via-email-button').click(function (event) {
204            var form_id = $(this).data('form');
205            $('#' + form_id).trigger('submit', []);
206            return true;
207        });
208
209
210        $('.move-list-sel').change(function (event) {
211
212            $('.move-list-sel').val($(this).val());
213
214        });
215
216        $('.btn-apply').click(function (event) {
217            event.preventDefault();
218
219            $("#wlupdateaction").val('bulk');
220            $('#wl-items-form').submit();
221
222            return false;
223        });
224
225        $('#wleditaction1').change(function () {
226            $('#wleditaction2').val($(this).val());
227        });
228
229        $('#wleditaction2').change(function () {
230            $('#wleditaction1').val($(this).val());
231        });
232
233
234        $('.wishlist-add-to-cart-button').click(function (e) {
235            e.preventDefault();
236            const href = ($(this).attr('href'));
237            const qty = $(this).closest('tr').find('input.qty');
238            const qty_val = (qty && qty.length) ? qty.val() : 1;
239            window.location = href + '&quantity=' + qty_val;
240            return false;
241        });
242
243        $('.wishlist-add-to-cart-button-view').click(function (e) {
244            e.preventDefault();
245
246            var href = ($(this).attr('href'));
247            var qty = prompt(wishlist_params.quantity_prompt, $(this).data('qty'));
248
249            if (qty == null || qty == "") {
250                return false;
251            } else {
252                var url = href + '&quantity=' + qty;
253                window.location = url;
254                return false;
255            }
256
257        });
258
259
260    });
261
262})(jQuery);
263
264
265(function($){
266
267
268
269})(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.