1(function($) 2{ 3 "use strict"; 4 5 // ------------------------------------------------------------------------------------------- 6 // Ligthbox activation 7 // ------------------------------------------------------------------------------------------- 8 9 $.avia_utilities = $.avia_utilities || {}; 10 11 /** 12 * "Use Privacy-Enhanced Video URLs" theme option - avoids third party cookies being set before 13 * a visitor interacts with an embedded video. Guarded with typeof in case this script happens to 14 * run before avia_framework_globals is printed - falls back to the standard domain/params then. 15 * 16 * @since 8.2 17 */ 18 var avia_privacy_enhanced_video = ( typeof avia_framework_globals !== 'undefined' && avia_framework_globals.privacyEnhancedVideo === true ); 19 20 $.avia_utilities.av_popup = { 21 type: 'image', 22 mainClass: 'avia-popup mfp-zoom-in', 23 tLoading: '', 24 tClose: '', 25 removalDelay: 300, //delay removal by X to allow out-animation 26 closeBtnInside: true, 27 closeOnContentClick: false, 28 midClick: true, 29 autoFocusLast: false, // false, prevents issues with accordion slider 30 fixedContentPos: $('html').hasClass('av-default-lightbox-no-scroll'), // allows scrolling when lightbox is open but also removes any jumping because of scrollbar removal 31 iframe: { 32 patterns: { 33 youtube: { 34 index: 'youtube.com/watch', 35 id: function(url) { 36 let m = url.match(/[\\?\\&]v=([^\\?\\&]+)/), 37 id, 38 params; 39 40 if( ! m || ! m[1] ) 41 { 42 return null; 43 } 44 45 id = m[1]; 46 47 params = url.split('/watch'); 48 params = params[1]; 49 50 return id + params; 51 }, 52 src: avia_privacy_enhanced_video ? '//www.youtube-nocookie.com/embed/%id%' : '//www.youtube.com/embed/%id%' 53 }, 54 youtube_shorts: { 55 index: 'youtube.com/shorts', 56 id: function(url) { 57 let m = url.match(/(?:youtube\.com\/shorts\/)([a-zA-Z0-9_-]*)/), 58 id, 59 params; 60 61 if( ! m || ! m[1] ) 62 { 63 return null; 64 } 65 66 id = m[1]; 67 68 params = url.split('/shorts'); 69 params = params[1]; 70 71 return id + params; 72 }, 73 src: avia_privacy_enhanced_video ? '//www.youtube-nocookie.com/embed/%id%' : '//www.youtube.com/embed/%id%' 74 }, 75 vimeo: { 76 index: 'vimeo.com/', 77 id: function(url) { 78 let m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})\/(\w{6,11})[?]?.*/), 79 params, 80 vid; 81 82 m = m ? m : url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/); 83 84 if( ! m || ! m[5] ) 85 { 86 return null; 87 } 88 89 vid = m[5]; 90 91 params = url.split('?'); 92 params = params[1] ? "?" + params[1] : ""; 93 94 if(m[6]) 95 { 96 vid = vid + (params ? params + "&h=" : "?h=") + m[6]; 97 } else { 98 vid = vid + params; 99 } 100 101 if( avia_privacy_enhanced_video && vid.indexOf('dnt=') === -1 ) 102 { 103 vid = vid + ( vid.indexOf('?') > -1 ? '&dnt=1' : '?dnt=1' ); 104 } 105 106 return vid; 107 }, 108 src: '//player.vimeo.com/video/%id%' 109 } 110 } 111 }, 112 image: { 113 titleSrc: function( item ) 114 { 115 var title = item.el.attr('title'); 116 if( ! title ) 117 { 118 title = item.el.find('img').attr('title'); 119 } 120 if( ! title ) 121 { 122 title = item.el.parent().next( '.wp-caption-text' ).html(); 123 } 124 if( typeof title != "undefined" ) 125 { 126 return title; 127 } 128 129 if( ! $( 'body' ).hasClass( 'avia-mfp-show-alt-text' ) ) 130 { 131 return ''; 132 } 133 134 // @since 4.7.6.2 check for alt attribute 135 var alt = item.el.attr('alt'); 136 if( typeof alt != "undefined" ) 137 { 138 return alt; 139 } 140 141 alt = item.el.find('img').attr('alt'); 142 if( typeof alt != "undefined" ) 143 { 144 return alt; 145 } 146 147 return ''; 148 } 149 }, 150 151 gallery: { 152 // delegate: options.autolinkElements, 153 tPrev: '', 154 tNext: '', 155 tCounter: '%curr% / %total%', 156 enabled: true, 157 preload: [1,1] // Will preload 1 - before current, and 1 after the current image 158 }, 159 160 callbacks: 161 { 162 beforeOpen: function() 163 { 164 //add custom css class for different styling 165 if( this.st.el && this.st.el.data('fixed-content') ) 166 { 167 this.fixedContentPos = true; 168 } 169 170 let elementCustomClass = ''; 171 172 if( this.st.el && this.st.el.data('custom_class') ) 173 { 174 elementCustomClass = this.st.el.data('custom_class').trim(); 175 } 176 else if( this.st.el ) 177 { 178 let element = $( this.st.el ), 179 href = element.attr( 'href' ); 180 181 if( ( href.indexOf( 'youtube.com' ) >= 0 ) && ( href.indexOf( '/shorts/' ) >= 0 ) ) 182 { 183 elementCustomClass = 'avia-mfp-is-video avia-mfp-video-9-16'; 184 } 185 } 186 187 if( elementCustomClass ) 188 { 189 this.st.mainClass += ' ' + elementCustomClass; 190 } 191 }, 192 193 open: function() 194 { 195 //overwrite default prev + next function. Add timeout for crossfade animation 196 $.magnificPopup.instance.next = function() 197 { 198 var self = this; 199 self.wrap.removeClass('mfp-image-loaded'); 200 setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); 201 }; 202 203 $.magnificPopup.instance.prev = function() 204 { 205 var self = this; 206 self.wrap.removeClass('mfp-image-loaded'); 207 setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); 208 }; 209 210 //add custom css class for different styling 211 if( this.st.el && this.st.el.data('av-extra-class') ) 212 { 213 this.wrap.addClass( this.currItem.el.data('av-extra-class') ); 214 } 215 216 this.wrap.avia_swipe_trigger( {prev:'.mfp-arrow-left', next:'.mfp-arrow-right'} ); 217 }, 218 219 markupParse: function( template, values, item ) 220 { 221 if( typeof values.img_replaceWith == 'undefined' || typeof values.img_replaceWith.length == 'undefined' || values.img_replaceWith.length == 0 ) 222 { 223 return; 224 } 225 226 var img = $( values.img_replaceWith[0] ); 227 228 if( typeof img.attr( 'alt' ) != 'undefined' ) 229 { 230 return; 231 } 232 233 var alt = item.el.attr( 'alt' ); 234 if( typeof alt == "undefined" ) 235 { 236 alt = item.el.find('img').attr('alt'); 237 } 238 239 if( typeof alt != "undefined" ) 240 { 241 img.attr( 'alt', alt ); 242 } 243 244 return; 245 }, 246 247 imageLoadComplete: function() 248 { 249 var self = this; 250 setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16); 251 }, 252 253 change: function() 254 { 255 if( this.currItem.el ) 256 { 257 var current = this.currItem.el; 258 259 this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove(); 260 261 if( current.data('av-extra-content') ) 262 { 263 var extra = current.data('av-extra-content'); 264 this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" ); 265 } 266 267 if( current.data('av-extra-markup') ) 268 { 269 var markup = current.data('av-extra-markup'); 270 this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>" ); 271 } 272 } 273 } 274 } 275 }; 276 277 $.fn.avia_activate_lightbox = function(variables) 278 { 279 280 var defaults = { 281 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'], 282 autolinkElements: 'a.lightbox, a[rel^="prettyPhoto"], a[rel^="lightbox"], a[href$=jpg], a[href$=webp], a[href$=avif], a[href$=png], a[href$=gif], a[href$=jpeg], a[href*=".jpg?"], a[href*=".png?"], a[href*=".gif?"], a[href*=".jpeg?"], a[href*=".avif?"], a[href$=".mov"] , a[href$=".swf"] , a:regex(href, .vimeo\.com/[0-9]) , a[href*="youtube.com/watch"] , a[href*="youtube.com/shorts"] , a[href*="screenr.com"], a[href*="iframe=true"]', 283 videoElements : 'a[href$=".mov"] , a[href$=".swf"] , a:regex(href, .vimeo\.com/[0-9]) , a[href*="youtube.com/watch"] , a[href*="youtube.com/shorts"] , a[href*="screenr.com"], a[href*="iframe=true"]',
284 exclude : '.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"], .pagination a' 285 }, 286 287 options = $.extend({}, defaults, variables), 288 289 active = ! $('html').is('.av-custom-lightbox'); 290 291 if( ! active) 292 { 293 return this; 294 } 295 296 return this.each(function() 297 { 298 var container = $(this), 299 videos = $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/ 300 ajaxed = ! container.is('body') && ! container.is('.ajax_slide'); 301 for( var i = 0; i < options.groups.length; i++ ) 302 { 303 container.find(options.groups[i]).each(function() 304 { 305 var links = $(options.autolinkElements, this); 306 307 if( ajaxed ) 308 { 309 links.removeClass('lightbox-added'); 310 } 311 312 links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup); 313 }); 314 } 315 316 }); 317 }; 318})(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.