1jQuery( function($) { 2 3 $('.z_ajax_select').each(function(e) { 4 $(this).after('<div class="z_ajax_result"></div>') 5 }); 6 7 function init_right_fields($this) { 8 $this.parents('form').removeClass(); 9 $this.parents('form').addClass( $this.val() ); 10 $this.parents('.zam-admin form').find('.sub-field').parents('p.form-field').hide(); 11 $this.parents('.zam-admin form.' + $this.val()).find('.' + $this.val()).parents('p.form-field').show(); 12 } 13 14 $( document ).on( 'change', 'select.z_ajax_select, select[name="type"]', function(e) { 15 /* Reset all subfields */ 16 $('input.sub-field').val(''); 17 18 var thisForm = $(this).parents('form'); 19 var thisElem = $(this); 20 21 thisForm.removeClass(); 22 thisForm.addClass(thisElem.val()); 23 24 init_right_fields($(this)); 25 26 $.ajax( 27 { 28 type: 'POST', 29 url: '/wp-admin/admin-ajax.php', 30 data: { 31 action: 'ajax_get_right_select', 32 $value: thisElem.val(), 33 $name: thisElem.attr('name'), 34 $id: thisForm.find('input[name="id"]').val(), 35 }, 36 beforeSend: function(){ 37 38 }, 39 success: function( response ) { 40 thisElem.parents('.form-field').next('.form-field').html(response.content); 41 $('select.z_ajax_select, select.cb-admin-multiselect').select2({ width: '100%' }); 42 } 43 } 44 ) 45 }); 46 47 48 // $( "select.z_ajax_select" ).each(function() { 49 // $(this).parents('form').removeClass(); 50 // $(this).parents('form').addClass( $(this).val() ); 51 // $(this).parents('.zam-admin form').find('.sub-field').parents('p.form-field').hide(); 52 // $(this).parents('.zam-admin form.' + $(this).val()).find('.' + $(this).val()).parents('p.form-field').show(); 53 // }); 54 55 56 $( document ).on( 'click', '#added_popup_discount .add_to_cart_button', function(e) { 57 $('#added_popup_discount').modal('hide'); 58 }); 59 60 $( document ).on( 'click', 'input:checkbox[name=dc-select-all]', function(e) { 61 if ($(this).is(':checked')) { 62 $('input:checkbox[name^=dc-select]').attr('checked', true); 63 } else { 64 $('input:checkbox[name^=dc-select]').attr('checked', false); 65 } 66 67 }); 68 69 70 /* Bundle JS */ 71 72 SetSelectedBundleIDs(); 73 74 $(document).on('change', '.bundle-container .variation_id', function (e) { 75 SetSelectedBundleIDs(); 76 }); 77 78 function SetSelectedBundleIDs() { 79 $('.bundle-container').each(function () { 80 var add_ids = []; 81 var total_new_price = 0; 82 var total_old_price = 0; 83 var discount_percentage = $('#DiscountPercentage').val(); 84 85 $(this).find('.bundle-product').each(function () { 86 if ($(this).hasClass('bundle-product-variation')) { 87 var prod_id = $(this).find('.variation_id option:selected').val(); 88 } else { 89 var prod_id = $(this).find('.bundle-product-id').val(); 90 } 91 92 /* Add to total price */ 93 if (prod_id) { 94 add_ids.push( parseInt(prod_id) ); 95 } 96 }); 97 98 $(this).find('.multiple_add_to_cart').attr('data-product_id', add_ids.join()); 99 100 console.log(add_ids); 101 }) 102 } 103 104 105 $(document).on('click', '.gift-popup-title .pointer', function() { 106 $('.gift-inner-wrap').toggleClass('gift-container-collapsed'); 107 }); 108 $(document).on('change', '.gift-product-item select.variation_id', function() { 109 $(this).parent().find('input[name="add-gift"]').val($(this).val()); 110 }); 111 112})
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.