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: $('html').hasClass('av-default-lightbox-no-scroll'), // 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 var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/), 28 id, 29 params; 30 31 if( !m || !m[1] ) 32 { 33 return null; 34 } 35 36 id = m[1]; 37 38 params = url.split('/watch'); 39 params = params[1]; 40 41 return id + params; 42 }, 43 src: '//www.youtube.com/embed/%id%' 44 }, 45 vimeo: { 46 index: 'vimeo.com/', 47 id: function(url) { 48 var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})\/(\w{6,11})[?]?.*/), params, vid; 49 m = m ? m : url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/); 50 51 if( !m || !m[5] ) 52 { 53 return null; 54 } 55 56 vid = m[5]; 57 58 params = url.split('?'); 59 params = params[1] ? "?" + params[1] : ""; 60 61 if(m[6]) 62 { 63 vid = vid + (params ? params + "&h=" : "?h=") + m[6]; 64 } else { 65 vid = vid + params; 66 } 67 68 return vid; 69 }, 70 src: '//player.vimeo.com/video/%id%' 71 } 72 }, 73 }, 74 image: { 75 titleSrc: function( item ) 76 { 77 var title = item.el.attr('title'); 78 if( ! title ) 79 { 80 title = item.el.find('img').attr('title'); 81 } 82 if( ! title ) 83 { 84 title = item.el.parent().next( '.wp-caption-text' ).html(); 85 } 86 if( typeof title != "undefined" ) 87 { 88 return title; 89 } 90 91 if( ! $( 'body' ).hasClass( 'avia-mfp-show-alt-text' ) ) 92 { 93 return ''; 94 } 95 96 // @since 4.7.6.2 check for alt attribute 97 var alt = item.el.attr('alt'); 98 if( typeof alt != "undefined" ) 99 { 100 return alt; 101 } 102 103 alt = item.el.find('img').attr('alt'); 104 if( typeof alt != "undefined" ) 105 { 106 return alt; 107 } 108 109 return ''; 110 } 111 }, 112 113 gallery: { 114 // delegate: options.autolinkElements, 115 tPrev: '', 116 tNext: '', 117 tCounter: '%curr% / %total%', 118 enabled: true, 119 preload: [1,1] // Will preload 1 - before current, and 1 after the current image 120 }, 121 122 callbacks: 123 { 124 beforeOpen: function() 125 { 126 //add custom css class for different styling 127 if( this.st.el && this.st.el.data('fixed-content') ) 128 { 129 this.fixedContentPos = true; 130 } 131 }, 132 133 open: function() 134 { 135 //overwrite default prev + next function. Add timeout for crossfade animation 136 $.magnificPopup.instance.next = function() 137 { 138 var self = this; 139 self.wrap.removeClass('mfp-image-loaded'); 140 setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); 141 }; 142 143 $.magnificPopup.instance.prev = function() 144 { 145 var self = this; 146 self.wrap.removeClass('mfp-image-loaded'); 147 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 148 }; 149 150 //add custom css class for different styling 151 if( this.st.el && this.st.el.data('av-extra-class') ) 152 { 153 this.wrap.addClass( this.currItem.el.data('av-extra-class') ); 154 } 155 156 this.wrap.avia_swipe_trigger( {prev:'.mfp-arrow-left', next:'.mfp-arrow-right'} ); 157 }, 158 159 markupParse: function( template, values, item ) 160 { 161 if( typeof values.img_replaceWith == 'undefined' || typeof values.img_replaceWith.length == 'undefined' || values.img_replaceWith.length == 0 ) 162 { 163 return; 164 } 165 166 var img = $( values.img_replaceWith[0] ); 167 168 if( typeof img.attr( 'alt' ) != 'undefined' ) 169 { 170 return; 171 } 172 173 var alt = item.el.attr( 'alt' ); 174 if( typeof alt == "undefined" ) 175 { 176 alt = item.el.find('img').attr('alt'); 177 } 178 179 if( typeof alt != "undefined" ) 180 { 181 img.attr( 'alt', alt ); 182 } 183 184 return; 185 }, 186 187 imageLoadComplete: function() 188 { 189 var self = this; 190 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 191 }, 192 change: function() 193 { 194 if( this.currItem.el ) 195 { 196 var current = this.currItem.el; 197 198 this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove(); 199 200 if( current.data('av-extra-content') ) 201 { 202 var extra = current.data('av-extra-content'); 203 this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" ); 204 } 205 206 if( current.data('av-extra-markup') ) 207 { 208 var markup = current.data('av-extra-markup'); 209 this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>" ); 210 } 211 } 212 } 213 } 214 }; 215 216 $.fn.avia_activate_lightbox = function(variables) 217 { 218 219 var defaults = { 220 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'], 221 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"]', 222 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"]',
223 exclude : '.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"]' 224 }, 225 226 options = $.extend({}, defaults, variables), 227 228 active = ! $('html').is('.av-custom-lightbox'); 229 230 if( ! active) 231 { 232 return this; 233 } 234 235 return this.each(function() 236 { 237 var container = $(this), 238 videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ 239 ajaxed = ! container.is('body') && ! container.is('.ajax_slide'); 240 for( var i = 0; i < options.groups.length; i++ ) 241 { 242 container.find(options.groups[i]).each(function() 243 { 244 var links = $(options.autolinkElements, this); 245 246 if( ajaxed ) 247 { 248 links.removeClass('lightbox-added'); 249 } 250 251 links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); 252 }); 253 } 254 255 }); 256 }; 257})(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.