1(function($) 2{ 3 "use strict"; 4 5 // ------------------------------------------------------------------------------------------- 6 // Ligthbox activation 7 // ------------------------------------------------------------------------------------------- 8 9 $.avia_utilities = $.avia_utilities || {}; 10 11 $.avia_utilities.av_popup = { 12 type: 'image', 13 mainClass: 'avia-popup mfp-zoom-in', 14 tLoading: '', 15 tClose: '', 16 removalDelay: 300, //delay removal by X to allow out-animation 17 closeBtnInside: true, 18 closeOnContentClick:false, 19 midClick: true, 20 autoFocusLast: false, // false, prevents issues with accordion slider 21 fixedContentPos: false, // allows scrolling when lightbox is open but also removes any jumping because of scrollbar removal 22 iframe: { 23 patterns: { 24 youtube: { 25 index: 'youtube.com/watch', 26 id: function(url) { 27 28 //fetch the id 29 var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/), id, params; 30 if ( !m || !m[1] ) return null; 31 32 id = m[1]; 33 34 //fetch params 35 params = url.split('/watch'); 36 params = params[1]; 37 38 return id + params; 39 }, 40 src: '//www.youtube.com/embed/%id%' 41 }, 42 vimeo: { 43 index: 'vimeo.com/', 44 id: function(url) { 45 46 //fetch the id 47 var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/), id, params; 48 if ( !m || !m[5] ) return null; 49 50 id = m[5]; 51 52 //fetch params 53 params = url.split('?'); 54 params = params[1]; 55 56 return id + '?' + params; 57 }, 58 src: '//player.vimeo.com/video/%id%' 59 } 60 } 61 }, 62 image: { 63 titleSrc: function( item ) 64 { 65 var title = item.el.attr('title'); 66 if( ! title ) 67 { 68 title = item.el.find('img').attr('title'); 69 } 70 if( ! title ) 71 { 72 title = item.el.parent().next( '.wp-caption-text' ).html(); 73 } 74 if( typeof title != "undefined" ) 75 { 76 return title; 77 } 78 79 if( ! $( 'body' ).hasClass( 'avia-mfp-show-alt-text' ) ) 80 { 81 return ''; 82 } 83 84 // @since 4.7.6.2 check for alt attribute 85 var alt = item.el.attr('alt'); 86 if( typeof alt != "undefined" ) 87 { 88 return alt; 89 } 90 91 alt = item.el.find('img').attr('alt'); 92 if( typeof alt != "undefined" ) 93 { 94 return alt; 95 } 96 97 return ''; 98 } 99 }, 100 101 gallery: { 102 // delegate: options.autolinkElements, 103 tPrev: '', 104 tNext: '', 105 tCounter: '%curr% / %total%', 106 enabled: true, 107 preload: [1,1] // Will preload 1 - before current, and 1 after the current image 108 }, 109 110 callbacks: 111 { 112 beforeOpen: function() 113 { 114 //add custom css class for different styling 115 if( this.st.el && this.st.el.data('fixed-content') ) 116 { 117 this.fixedContentPos = true; 118 } 119 }, 120 121 122 open: function() 123 { 124 //overwrite default prev + next function. Add timeout for crossfade animation 125 $.magnificPopup.instance.next = function() { 126 var self = this; 127 self.wrap.removeClass('mfp-image-loaded'); 128 setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); 129 }; 130 131 $.magnificPopup.instance.prev = function() { 132 var self = this; 133 self.wrap.removeClass('mfp-image-loaded'); 134 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 135 }; 136 137 //add custom css class for different styling 138 if( this.st.el && this.st.el.data('av-extra-class') ) 139 { 140 this.wrap.addClass( this.currItem.el.data('av-extra-class') ); 141 } 142 143 144 }, 145 146 markupParse: function( template, values, item ) 147 { 148 if( typeof values.img_replaceWith == 'undefined' || typeof values.img_replaceWith.length == 'undefined' || values.img_replaceWith.length == 0 ) 149 { 150 return; 151 } 152 153 var img = $( values.img_replaceWith[0] ); 154 155 if( typeof img.attr( 'alt' ) != 'undefined' ) 156 { 157 return; 158 } 159 160 var alt = item.el.attr( 'alt' ); 161 if( typeof alt == "undefined" ) 162 { 163 alt = item.el.find('img').attr('alt'); 164 } 165 166 if( typeof alt != "undefined" ) 167 { 168 img.attr( 'alt', alt ); 169 } 170 171 return; 172 }, 173 174 imageLoadComplete: function() 175 { 176 var self = this; 177 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 178 }, 179 change: function() { 180 181 if( this.currItem.el ) 182 { 183 var current = this.currItem.el; 184 185 this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove(); 186 187 if( current.data('av-extra-content') ) 188 { 189 var extra = current.data('av-extra-content'); 190 this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" ); 191 } 192 193 if( current.data('av-extra-markup') ) 194 { 195 var markup = current.data('av-extra-markup'); 196 this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>" ); 197 } 198 } 199 } 200 } 201 }, 202 203 204 $.fn.avia_activate_lightbox = function(variables) 205 { 206 207 var defaults = { 208 groups : ['.avia-slideshow', '.avia-gallery', '.av-horizontal-gallery', '.av-instagram-pics', '.portfolio-preview-image', '.portfolio-preview-content', '.isotope', '.post-entry', '.sidebar', '#main', '.main_menu', '.woocommerce-product-gallery'], 209 autolinkElements: 'a.lightbox, a[rel^="prettyPhoto"], a[rel^="lightbox"], a[href$=jpg], a[href$=webp], a[href$=png], a[href$=gif], a[href$=jpeg], a[href*=".jpg?"], a[href*=".png?"], a[href*=".gif?"], a[href*=".jpeg?"], a[href$=".mov"] , a[href$=".swf"] , a:regex(href, .vimeo\.com/[0-9]) , a[href*="youtube.com/watch"] , a[href*="screenr.com"], a[href*="iframe=true"]', 210 videoElements : 'a[href$=".mov"] , a[href$=".swf"] , a:regex(href, .vimeo\.com/[0-9]) , a[href*="youtube.com/watch"] , a[href*="screenr.com"], a[href*="iframe=true"]',
211 exclude : '.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"]' 212 }, 213 214 options = $.extend({}, defaults, variables), 215 216 active = !$('html').is('.av-custom-lightbox'); 217 218 if(!active) return this; 219 220 return this.each(function() 221 { 222 var container = $(this), 223 videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ 224 ajaxed = !container.is('body') && !container.is('.ajax_slide'); 225 for (var i = 0; i < options.groups.length; i++) 226 { 227 container.find(options.groups[i]).each(function() 228 { 229 var links = $(options.autolinkElements, this); 230 if(ajaxed) links.removeClass('lightbox-added'); 231 links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); 232 }); 233 } 234 235 }); 236 }; 237})(jQuery); 238 239
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.