1 2jQuery( document ).ready( function() { 3 jQuery(document).on('change', 'input[name="quantity"]', function () { 4 if(woo_discount_rules.show_product_strikeout == undefined){ 5 return false; 6 } 7 if(woo_discount_rules.show_product_strikeout !== 'show_on_qty_update'){ 8 return false; 9 } 10 var form = jQuery(this).closest('form'); 11 if(form.length){ 12 var btn = form.find("button[name='add-to-cart']"); 13 var product_id = null; 14 var current_object = jQuery(this); 15 var quantity = jQuery(this).val(); 16 var target_class = '.summary'; 17 if(woo_discount_rules.product_price_container_class !== undefined && woo_discount_rules.product_price_container_class !== ''){ 18 target_class = woo_discount_rules.product_price_container_class; 19 } 20 var target = jQuery(this).closest(target_class).find('.price'); 21 if(btn.length && parseInt(btn.val()) > 0){ 22 product_id = btn.val(); 23 if(!target.length){ 24 target = null; 25 } 26 } else { 27 var input_product_id = input_variation_id = null; 28 if(jQuery('input[name="product_id"]').length){ 29 var input_product_id = form.find('input[name="product_id"]'); 30 } 31 if(jQuery('input[name="variation_id"]').length){ 32 var input_variation_id = form.find('input[name="variation_id"]'); 33 } 34 35 if(input_product_id !== null){ 36 product_id = input_product_id.val(); 37 } 38 if(input_variation_id !== null){ 39 product_id = input_variation_id.val(); 40 target = form.find(".woocommerce-variation-price"); 41 } 42 } 43 if(parseInt(product_id) > 0){ 44 jQuery.ajax({ 45 url: woo_discount_rules.ajax_url, 46 dataType: "json", 47 type: "POST", 48 data: {action: "loadWooDiscountStrikeoutPriceOfProduct", id: product_id, qty: quantity, price_html: ''}, 49 beforeSend: function() { 50 }, 51 complete: function() { 52 }, 53 success: function (response) { 54 if(response.status == 1){ 55 if(target !== null){ 56 target.html(response.price_html); 57 if(response.product_type == 'variation'){ 58 if(response.has_single_price != undefined && response.parent_id != undefined){ 59 if(response.has_single_price == 1){ 60 var variation_price_target = jQuery('#product-'+response.parent_id+' .summary > p.price'); 61 variation_price_target.html(response.price_html); 62 } 63 } 64 } 65 } 66 } 67 current_object.trigger("woo_discount_rules_after_display_strikeout_price_on_quantity_update", [ product_id, response ]); 68 } 69 }); 70 } 71 } 72 }); 73 jQuery( ".single_variation_wrap" ).on( "show_variation, woo_discount_rules_after_variant_strikeout", function ( event, variation ) { 74 jQuery(this).closest('form').find('input[name="quantity"]').trigger('change'); 75 }); 76 jQuery(document).on('mouseenter', '.wdr_table_container', function () { 77 jQuery('.wdr_table_container .wdr_table_off_settings_link_con').show(); 78 jQuery('.wdr_table_container_for_admin').addClass('wdr_table_cbr'); 79 }); 80 jQuery(document).on('mouseleave', '.wdr_table_container', function () { 81 jQuery('.wdr_table_container .wdr_table_off_settings_link_con').hide(); 82 jQuery('.wdr_table_container_for_admin').removeClass('wdr_table_cbr'); 83 }); 84});
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.