1jQuery( document ).ready( function() { 2 3 var waitForEl = function( selector, callback ) { 4 5 if( jQuery( selector ).length ) 6 { 7 callback(); 8 } 9 else 10 { 11 setTimeout(function() { 12 waitForEl( selector, callback ); 13 }, 100); 14 } 15 }; 16 17 jQuery( ".pp-quick-view-btn > .pp-action-item.fa-eye" ).click( function(e) { 18 19 let product_id = jQuery( this ).parent().attr( "data-product_id" ); 20 21 waitForEl( "table.variations td.value > select" , function() { 22 23 let variation_dropdown_field = jQuery( "table.variations td.value > select" ); 24 25 let init_variation_dropdown_field_value = variation_dropdown_field.val(); 26 27 let attribute_name = jQuery( "table.variations td.value > select" ).attr( "name" ); 28 29 retrieveVariationImage( init_variation_dropdown_field_value, product_id, attribute_name ); 30 31 variation_dropdown_field.change( function() { 32 33 let variation_value = jQuery( this ).val(); 34 35 retrieveVariationImage( variation_value, product_id, attribute_name ); 36 37 }); 38 39 }); 40 41 }); 42 43 var retrieveVariationImage = function( variation_value, product_id, attribute_name ) { 44 45 if( variation_value ) 46 { 47 jQuery.ajax({ 48 type: "post", 49 dataType: "json", 50 url: ajax_object.ajax_url, 51 data: { 52 action : "get_variation_image", 53 product_id : product_id, 54 attribute_name : attribute_name, 55 variation_value : variation_value 56 }, 57 success: function( image_data ){ 58 59 console.log( "image_data", image_data ); 60 61 if( image_data && image_data.image_details !== undefined && image_data.image_details !== null ) 62 { 63 let image_title = image_data.image_details.post_title; 64 65 let product_slider_images = jQuery( '.pp-qv-image-slider ul.pp-qv-slides > li > img' ); 66 67 if( product_slider_images ) 68 { 69 let found_image_key = false; 70 71 jQuery.each( product_slider_images, function( image_key, image ) { 72 73 let product_image_title = jQuery( image ).attr( "title" ); 74 75 if( product_image_title === image_title ) 76 { 77 found_image_key = image_key; 78 return false; 79 } 80 81 }); 82 83 if( found_image_key ) 84 { 85 let nav_text = found_image_key.toString(); 86 87 let nav_anchor = jQuery( "ol.flex-control-nav > li > a:contains(" + nav_text + ")" ); 88 console.log( "nav_anchor", nav_anchor ); 89 90 nav_anchor.trigger("click"); 91 } 92 else 93 { 94 console.error( "Image Key not found" ); 95 } 96 } 97 else 98 { 99 console.error( "No sldier product images are found" ); 100 } 101 } 102 else 103 { 104 console.error( "Image Details is undefined" ); 105 } 106 } 107 }); 108 } 109 }; 110 111});
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.