1(function ($) { 2 'use strict'; 3 4 $(document).ready(function (a) { 5 6 if($("div").hasClass("product")){ 7 if($( "span" ).hasClass( "onsale" )){ 8 if ($('span.onsale').css('position') == 'absolute'){ 9 if($( ".product div i" ).hasClass( "class-sale-price" )){ 10 $(".product div i").css("left","74px"); 11 } 12 } 13 } 14 } 15 16 $('#select-all').click(function (event) { 17 if (this.checked) { 18 $(':checkbox').each(function () { 19 this.checked = true; 20 }); 21 } else { 22 $(':checkbox').each(function () { 23 this.checked = false; 24 }); 25 } 26 }); 27 28 29 /* $('.webtoffee_wishlist_remove').click(function (e) { 30 31 e.preventDefault(); 32 var $this = $(this); 33 var product_id = $(this).data("product_id"); 34 var act = 'remove'; 35 var quantity = 1; 36 $.ajax({ 37 url: webtoffee_wishlist_ajax_add.add_to_wishlist, 38 type: 'POST', 39 data: { 40 action: 'add_to_wishlist', 41 product_id: product_id, 42 act: act, 43 quantity: quantity, 44 wt_nonce: webtoffee_wishlist_ajax_add.wt_nonce, 45 }, 46 success: function (response) { 47 alert(1) 48 $this.siblings('img').removeClass('webtoffee_wishlist_remove'); 49 $this.siblings('img').addClass('webtoffee_wishlist'); 50 $this.addClass('webtoffee_wishlist'); 51 $this.removeClass('webtoffee_wishlist_remove'); 52 if($this[0].tagName.toLowerCase() !='img'){ 53 $this.siblings('img').attr('src', response.img_change_url ); 54 }else{ 55 $this.attr('src', response.img_change_url ); 56 57 } 58 59 //location.reload(); //todo remove pageload and use ajax 60 //$(".wt-wishlist-button").addClass('webtoffee_wishlist'); 61 //$(".wt-wishlist-button").removeClass('webtoffee_wishlist_remove'); 62 63 } 64 }); 65 });*/ 66 67 68 $('.wt-wishlist-button').click(function (e) { 69 70 e.preventDefault(); 71 var elm = $(this); 72 73 if (elm.prev().is('img')) { 74 elm.siblings('img').attr('src', webtoffee_wishlist_ajax_add.wishlist_loader); 75 elm.siblings('img').css({'height': '15px' }); 76 } else if(elm[0].tagName.toLowerCase() == 'img') { 77 elm.attr('src', webtoffee_wishlist_ajax_add.wishlist_loader); 78 elm.css({'height': '15px' }); 79 }else if (elm[0].tagName.toLowerCase() == 'i') { 80 elm.children('img').attr('src', webtoffee_wishlist_ajax_add.wishlist_loader); 81 // elm.children('img').css({'height': '15px' }); 82 } 83 var product_id = $(this).data("product_id"); 84 var variation_id = $("input[name=variation_id]").val(); 85 var action = elm.attr('data-action'); 86 var action_type = elm.attr('type-action'); 87 //var act = $(this).data("act"); 88 var act = action; 89 var quantity = $("input[name=quantity]").val(); 90 if (!quantity) { 91 quantity = 1; 92 } 93 94 $.ajax({ 95 url: webtoffee_wishlist_ajax_add.add_to_wishlist, 96 type: 'POST', 97 data: { 98 action: 'add_to_wishlist', 99 product_id: product_id, 100 variation_id: variation_id, 101 act: act, 102 quantity: quantity, 103 wt_nonce: webtoffee_wishlist_ajax_add.wt_nonce, 104 }, 105 success: function (response) { 106 var new_action = (action == 'remove' ? 'add' : 'remove'); 107 if (action_type == 'btn') { 108 elm.parent('a').siblings('button').show(); 109 elm.siblings('img').attr('src', webtoffee_wishlist_ajax_add.wishlist_favourite); 110 elm.parents('a').hide(); 111 if (response.browse_wishlist == 1) { 112 elm.parents('a').siblings('.browse_wishlist').css("display", "none"); 113 elm.parent('a').parent('.icon_after_add_to_cart').css("line-height", "0px"); 114 elm.parent('a').parent('.icon_after_add_to_cart').css("line-height", "20px"); 115 } 116 } else { 117 if (elm[0].tagName.toLowerCase() == 'i') { 118 if (response.browse_wishlist == 1) { 119 if (new_action == 'add') { 120 elm.parent('a').siblings('.browse_wishlist').css("display", "none"); 121 } else { 122 elm.parent('a').siblings('.browse_wishlist').css("display", "block"); 123 } 124 } 125 elm.attr('data-action', new_action); 126 if (response.icon_position == 1) { 127 elm.children('img').attr('src', response.img_change_url_icon); 128 }else{ 129 elm.children('img').attr('src', response.img_change_url); 130 } 131 } else if (elm[0].tagName.toLowerCase() == 'button') { 132 elm.siblings('a').css("display", "inline-flex"); 133 elm.hide(); 134 if (response.browse_wishlist == 1) { 135 elm.siblings('.browse_wishlist').css("display", "block"); 136 elm.parent('.icon_after_add_to_cart').css("line-height", "20px"); 137 } 138 } else { 139 if (new_action == 'add') { 140 if (response.browse_wishlist == 1) { 141 elm.parent('a').siblings('.browse_wishlist').hide(); 142 } 143 if (elm[0].tagName.toLowerCase() != 'img') { 144 elm.text(response.wt_add_to_wishlist_text); 145 } else { 146 var selm = elm.siblings('span'); 147 selm.text(response.wt_add_to_wishlist_text); 148 } 149 } else { 150 if (response.browse_wishlist == 1) { 151 elm.parent('a').siblings('.browse_wishlist').show(); 152 } 153 if (elm[0].tagName.toLowerCase() != 'img') { 154 elm.text(response.wt_after_adding_product_text); 155 } else { 156 var selm = elm.siblings('span'); 157 selm.text(response.wt_after_adding_product_text); 158 } 159 } 160 elm.attr('data-action', new_action); 161 elm.siblings('img').attr('data-action', new_action); 162 if (elm[0].tagName.toLowerCase() != 'img') { 163 elm.siblings('img').attr('src', response.img_change_url); 164 165 } else { 166 elm.attr('src', response.img_change_url); 167 168 } 169 } 170 } 171 172 }, 173 }); 174 }); 175 176 177 $('.remove_wishlist_single').click(function (e) { 178 179 e.preventDefault(); 180 181 var product_id = $(this).data("product_id"); 182 var act = 'remove'; 183 var quantity = 1; 184 $.ajax({ 185 url: webtoffee_wishlist_ajax_add.add_to_wishlist, 186 type: 'POST', 187 data: { 188 action: 'add_to_wishlist', 189 product_id: product_id, 190 act: act, 191 quantity: quantity, 192 wt_nonce: webtoffee_wishlist_ajax_add.wt_nonce, 193 }, 194 success: function (response) { 195 location.reload(); //todo remove pageload and use ajax 196 //$(".wt-wishlist-button").addClass('webtoffee_wishlist'); 197 //$(".wt-wishlist-button").removeClass('webtoffee_wishlist_remove'); 198 199 } 200 }); 201 }); 202 203 204 $('#bulk-add-to-cart').click(function (e) { 205 206 e.preventDefault(); 207 //var remove_wishlist = $("input[name=remove_wishlist]").val(); 208 var checked = []; 209 $(".remove_wishlist_single").each(function () { 210 if($(this).data("product_type")){ 211 checked.push(parseInt($(this).data("variation_id"))); 212 }else{ 213 checked.push(parseInt($(this).data("product_id"))); 214 } 215 }); 216 $.ajax({ 217 url: webtoffee_wishlist_ajax_myaccount_bulk_add_to_cart.myaccount_bulk_add_to_cart, 218 type: 'POST', 219 data: { 220 action: 'myaccount_bulk_add_to_cart_action', 221 product_id: checked, 222 wt_nonce: webtoffee_wishlist_ajax_myaccount_bulk_add_to_cart.wt_nonce, 223 224 }, 225 success: function (response) { 226 if($('.single-add-to-cart').data("redirect_to_cart")){ 227 location.href = (response.redirect); 228 }else{
229 var settings_div = $('<div class="eh_msg_div" style="background:#1de026; border:solid 1px #2bcc1c;">Products added to your cart</div>'); 230 save_settings(settings_div); 231 } 232 } 233 }); 234 }); 235 236 $('.single-add-to-cart').click(function (e) { 237 e.preventDefault(); 238 239 var product_id = $(this).data("product_id"); 240 $.ajax({ 241 url: webtoffee_wishlist_ajax_single_add_to_cart.single_add_to_cart, 242 type: 'POST', 243 data: { 244 action: 'single_add_to_cart_action', 245 product_id: product_id, 246 wt_nonce: webtoffee_wishlist_ajax_single_add_to_cart.wt_nonce, 247 248 }, 249 success: function (response) { 250 if($('.single-add-to-cart').data("redirect_to_cart")){ 251 location.href = (response.redirect); 252 }else{ 253 var settings_div = $('<div class="eh_msg_div" style="background:#1de026; border:solid 1px #2bcc1c;">Product added to your cart</div>'); 254 save_settings(settings_div); 255 } 256 } 257 }); 258 259 }); 260 261 }); 262 263 var save_settings = function(settings_div) 264 { 265 $('body').append(settings_div); 266 settings_div.stop(true,true).animate({'opacity':1,'top':'50px'},1000); 267 setTimeout(function(){ 268 settings_div.animate({'opacity':0,'top':'100px'},1000,function(){ 269 settings_div.remove(); 270 }); 271 },3000); 272 } 273 274})(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.