PageSourceSearch

https://www.uclga.org/wp-content/themes/enfold/js/avia-snippet-lightbox.js?ver=5.2.1

js uclga.org collected 2026-10-02 17:18:50 UTC 7,095 bytes, 256 lines download raw bytes

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

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.