1(function($) 2{ 3 'use strict'; 4 5 // ------------------------------------------------------------------------------------------- 6 // Gallery shortcode javascript 7 // ------------------------------------------------------------------------------------------- 8 9 $.fn.avia_sc_gallery = function(options) 10 { 11 return this.each(function() 12 { 13 var gallery = $(this), 14 images = gallery.find('img'), 15 big_prev = gallery.find('.avia-gallery-big'); 16 17 18 //trigger displaying of thumbnails 19 gallery.on( 'avia_start_animation', function() 20 { 21 images.each(function(i) 22 { 23 var image = $(this); 24 setTimeout( function(){ image.addClass('avia_start_animation') }, (i * 110) ); 25 }); 26 }); 27 28 if( gallery.hasClass('deactivate_avia_lazyload') ) 29 { 30 gallery.trigger('avia_start_animation'); 31 } 32 33 //trigger thumbnail hover and big prev image change 34 if( big_prev.length ) 35 { 36 gallery.on( 'mouseenter','.avia-gallery-thumb a', function() 37 { 38 var _self = $(this), 39 newImgSrc = _self.attr('data-prev-img'), 40 oldImg = big_prev.find('img'), 41 oldImgSrc = oldImg.attr('src'); 42 43 if( newImgSrc == oldImgSrc ) 44 { 45 return; 46 } 47 48 big_prev.height( big_prev.height() ); 49 50 big_prev.attr('data-onclick', _self.attr('data-onclick')); 51 big_prev.attr('href', _self.attr('href')); 52 big_prev.attr('title', _self.attr('title')); 53 54 // copy lightbox attributes 55 if( 'undefined' == typeof _self.data('srcset') ) 56 { 57 big_prev.removeAttr('data-srcset'); 58 big_prev.removeData('srcset'); 59 } 60 else 61 { 62 big_prev.data('srcset', _self.data('srcset')); 63 big_prev.attr('data-srcset', _self.data('srcset')); 64 } 65 66 if( 'undefined' == typeof _self.data('sizes') ) 67 { 68 big_prev.removeAttr('data-sizes'); 69 big_prev.removeData('sizes'); 70 } 71 else 72 { 73 big_prev.data('sizes', _self.data('sizes')); 74 big_prev.attr('data-sizes', _self.data('sizes')); 75 } 76 77 // since 4.8.8.2 we have a hidden img to support scrset and sizes - fallback to old version if missing 78 var newPrev = _self.find( '.big-prev-fake img' ).clone( true ); 79 if( newPrev.length == 0 ) 80 { 81 var next_img = new Image(); 82 next_img.src = newImgSrc; 83 newPrev = $(next_img); 84 } 85 86 if( big_prev.hasClass( 'avia-gallery-big-no-crop-thumb' ) ) 87 { 88 newPrev.css( {'height':big_prev.height(),'width':'auto'} ); 89 } 90 91 big_prev.stop().animate( {opacity:0}, function() 92 { 93 newPrev.insertAfter( oldImg ); 94 oldImg.remove(); 95 big_prev.animate( {opacity:1} ); 96 }); 97 98 }); 99 100 big_prev.on( 'click', function() 101 { 102 var imagelink = gallery.find('.avia-gallery-thumb a').eq( this.getAttribute('data-onclick') - 1 ); 103 104 if( imagelink && ! imagelink.hasClass('aviaopeninbrowser') ) 105 { 106 imagelink.trigger('click'); 107 } 108 else if( imagelink ) 109 { 110 var imgurl = imagelink.attr('href'); 111 var secure = imagelink.hasClass( 'custom_link' ) ? 'noopener,noreferrer' : ''; 112 113 if( imagelink.hasClass('aviablank') && imgurl != '' ) 114 { 115 window.open( imgurl, '_blank', secure ); 116 } 117 else if( imgurl != '' ) 118 { 119 window.open( imgurl, '_self', secure ); 120 } 121 } 122 return false; 123 }); 124 125 126 $(window).on( 'debouncedresize', function() 127 { 128 big_prev.height('auto'); 129 }); 130 } 131 }); 132 }; 133 134}(jQuery));
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.