1jQuery(document).ready(function($) { 2 3 4 var freeproduct = {}; 5 6 7 /* FREE PRODUCT: VARIABLES */ 8 freeproduct.container = $('[data-js_variationPicked-container]'); 9 freeproduct.variation_image = $('[data-js_variationPicked-image]'); 10 freeproduct.variation_pulldown = $('[data-js_variationPicked]'); 11 12 13 /* FREE PRODUCT: FUNCTIONS */ 14 freeproduct.variation_picked = function(event) 15 { 16 freeproduct.update_variation_image(event); 17 freeproduct.update_free_variation_id(event); 18 }; 19 20 21 freeproduct.update_variation_image = function(event) 22 { 23 var freeproduct_container = $(event.target).closest(freeproduct.container), 24 freeproduct_image = freeproduct_container.find(freeproduct.variation_image), 25 freeproduct_image_src = freeproduct_image.attr('src'), 26 freeproduct_variation_pulldown = freeproduct_container.find(freeproduct.variation_pulldown), 27 freeproduct_variation_option = freeproduct_variation_pulldown.find('option:selected'), 28 freeproduct_new_image_src = freeproduct_variation_option.data('image_src'), 29 freeproduct_new_image_srcset = freeproduct_variation_option.data('image_srcset'), 30 freeproduct_new_image_sizes = freeproduct_variation_option.data('image_sizes'); 31 32 33 if(freeproduct_image_src != freeproduct_new_image_src) { 34 35 freeproduct_image.fadeOut( 36 37 function() 38 { 39 freeproduct_image.attr('src', freeproduct_new_image_src); 40 freeproduct_image.attr('srcset', freeproduct_new_image_srcset); 41 freeproduct_image.attr('sizes', freeproduct_new_image_sizes); 42 freeproduct_image.fadeIn(); 43 } 44 ); 45 } 46 }; 47 48 49 freeproduct.update_free_variation_id = function(event) 50 { 51 var free_variation_id = $(event.target).val(), 52 free_variation_hidden_input_name = $(event.target).attr('name'), 53 free_variation_hidden_input = $('[name="' + free_variation_hidden_input_name + '"]'); 54 55 56 free_variation_hidden_input.val(free_variation_id); 57 }; 58 59 60 /* FREE PRODUCT: EVENT HANDLERS */ 61 freeproduct.variation_pulldown.on('change', freeproduct.variation_picked); 62});
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.