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