PageSourceSearch

https://peckheatingandair.com/wp-content/themes/enfold/js/avia-snippet-lightbox.js?ver=6.0.4

js peckheatingandair.com collected 2026-10-08 01:07:42 UTC 7,808 bytes, 267 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			                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					if( this.st.el && this.st.el.data('custom_class') )
133					{
134						const elementCustomClass = this.st.el.data('custom_class').trim();
135
136						if( elementCustomClass )
137						{
138							this.st.mainClass = this.st.mainClass + ' ' + elementCustomClass;
139						}
140					}
141				},
142
143				open: function()
144				{
145					//overwrite default prev + next function. Add timeout for  crossfade animation
146					$.magnificPopup.instance.next = function()
147					{
148						var self = this;
149						self.wrap.removeClass('mfp-image-loaded');
150						setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120);
151					};
152
153					$.magnificPopup.instance.prev = function()
154					{
155						var self = this;
156						self.wrap.removeClass('mfp-image-loaded');
157						setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120);
158					};
159
160					//add custom css class for different styling
161					if( this.st.el && this.st.el.data('av-extra-class') )
162					{
163						this.wrap.addClass( this.currItem.el.data('av-extra-class') );
164					}
165
166					this.wrap.avia_swipe_trigger( {prev:'.mfp-arrow-left', next:'.mfp-arrow-right'} );
167				},
168
169				markupParse: function( template, values, item )
170				{
171					if( typeof values.img_replaceWith == 'undefined' || typeof values.img_replaceWith.length == 'undefined' || values.img_replaceWith.length == 0 )
172					{
173						return;
174					}
175
176					var img = $( values.img_replaceWith[0] );
177
178					if( typeof img.attr( 'alt' ) != 'undefined' )
179					{
180						return;
181					}
182
183					var alt = item.el.attr( 'alt' );
184					if( typeof alt == "undefined" )
185					{
186						alt = item.el.find('img').attr('alt');
187					}
188
189					if( typeof alt != "undefined" )
190					{
191						img.attr( 'alt', alt );
192					}
193
194					return;
195				},
196
197				imageLoadComplete: function()
198				{
199					var self = this;
200					setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16);
201				},
202				change: function()
203				{
204				    if( this.currItem.el )
205				    {
206					    var current = this.currItem.el;
207
208					    this.content.find( '.av-extra-modal-content, .av-extra-modal-markup' ).remove();
209
210					    if( current.data('av-extra-content') )
211					    {
212						    var extra = current.data('av-extra-content');
213						    this.content.append( "<div class='av-extra-modal-content'>" + extra + "</div>" );
214					    }
215
216					    if( current.data('av-extra-markup') )
217					    {
218						    var markup = current.data('av-extra-markup');
219						    this.wrap.append( "<div class='av-extra-modal-markup'>" + markup + "</div>"  );
220					    }
221				    }
222				}
223			}
224		};
225
226	$.fn.avia_activate_lightbox = function(variables)
227	{
228
229		var defaults = {
230			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'],
231			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"]',
232			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"]',
233			exclude			:	'.noLightbox, .noLightbox a, .fakeLightbox, .lightbox-added, a[href*="dropbox.com"], .pagination a'
234		},
235
236		options = $.extend({}, defaults, variables),
237
238		active = ! $('html').is('.av-custom-lightbox');
239
240		if( ! active)
241		{
242			return this;
243		}
244
245		return this.each(function()
246		{
247			var container	= $(this),
248				videos		= $(options.videoElements, this).not(options.exclude).addClass('mfp-iframe'), /*necessary class for the correct lightbox markup*/
249				ajaxed		= ! container.is('body') && ! container.is('.ajax_slide');
250				for( var i = 0; i < options.groups.length; i++ )
251				{
252					container.find(options.groups[i]).each(function()
253					{
254						var links = $(options.autolinkElements, this);
255
256						if( ajaxed )
257						{
258							links.removeClass('lightbox-added');
259						}
260
261						links.not(options.exclude).addClass('lightbox-added').magnificPopup($.avia_utilities.av_popup);
262					});
263				}
264
265		});
266	};
267})(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.