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