1function Plugin_Pic_Switcher() { 2 jQuery(document).ready(function($){ 3 $('.js-pic-switcher').each(function(){ 4 var el = $(this); 5 if (el.hasClass('v3')) { 6 if (el.find('figure.wp-caption').length) { 7 var has_caption = true; 8 } else { 9 var has_caption = false; 10 } 11 if (has_caption) { 12 var image_1 = el.find('figure.active > img'); 13 var image_2 = el.find('figure:not(.active) > img'); 14 var caption = el.find('figure.active figcaption'); 15 var img_total_height = image_1.height() + (image_1.offset().top - image_2.offset().top) + caption.height(); 16 } else { 17 var image_1 = el.find('.image > img.active'); 18 var image_2 = el.find('.image > img:not(.active)'); 19 var img_total_height = image_1.height() + (image_1.offset().top - image_2.offset().top); 20 } 21 22 if ($(this).parents('.full-section').length) { 23 var section = el.parents('.full-section'); 24 var section_size = section.outerHeight(); 25 var section_padding = section_size - el.height(); 26 if (img_total_height > section_size) { 27 var add_size = img_total_height - section_size; 28 el.css('min-height', el.height() + add_size + section_padding); 29 } 30 } else { 31 var section_size = el.height(); 32 var col = image_1.parents('.col'); 33 if (img_total_height > section_size) { 34 var add_size = img_total_height - section_size; 35 if (has_caption) { 36 col.css('min-height', el.height() + add_size - caption.height()); 37 } else { 38 col.css('min-height', el.height() + add_size); 39 } 40 } 41 } 42 } 43 }); 44 45 $('.js-pic-switcher li').on('click', function(){ 46 var parent = $(this).parents('.js-pic-switcher'); 47 if (parent.hasClass('v2')) { 48 var src = $(this).attr('data-src'); 49 50 parent.find('.image img').each(function(){ 51 $(this).removeClass('active'); 52 if ($(this).attr('src').indexOf(src) !== -1) { 53 $(this).addClass('active'); 54 } 55 }); 56 } else if (parent.hasClass('v3') || parent.hasClass('v4')) { 57 var src = $(this).attr('data-src'); 58 59 parent.find('.image img').each(function(){ 60 if (parent.find('.image figure').length) { 61 $(this).parent('figure').removeClass('active'); 62 if ($(this).attr('src').indexOf(src) !== -1) { 63 $(this).parent('figure').addClass('active'); 64 } 65 } else { 66 $(this).removeClass('active'); 67 if ($(this).attr('src').indexOf(src) !== -1) { 68 $(this).addClass('active'); 69 } 70 } 71 72 }); 73 } else { 74 var src = $(this).attr('data-src'); 75 var target = parent.find('.image img'); 76 target.css('opacity', 0); 77 toggleLoadingNew(parent, 1); 78 79 var image = new Image(); 80 image.src = src; 81 image.className = target.attr('class'); 82 image.onload = function(){ 83 target.replaceWith(image); 84 toggleLoadingNew(parent, 0); 85 } 86 } 87 88 $(this).addClass('active').siblings('li').removeClass('active'); 89 }); 90 91 }); 92} 93new Plugin_Pic_Switcher();
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.