PageSourceSearch

https://www.cig.gov.pt/wp-content/plugins/responsive-lightbox/js/front.js?ver=20251128001

js cig.gov.pt collected 2026-10-02 03:00:33 UTC 27,928 bytes, 839 lines download raw bytes

1( function( $ ) {
2
3	// parse query string
4	var parseQueryString = function( name, str ) {
5		var regex = new RegExp( '[?&]' + name.replace( /[\[\]]/g, '\\$&' ) + '(=([^&#]*)|&|#|$)' );
6		var results = regex.exec( '&' + str );
7
8		return ( ! results || ! results[2] ? '' : decodeURIComponent( results[2].replace( /\+/g, ' ' ) ) );
9	}
10
11	// observe DOM changes
12	var observeContentChanges = function( el, onlyAdded, callback ) {
13		if ( typeof MutationObserver !== 'undefined' ) {
14			// define a new observer
15			var observer = new MutationObserver( function( mutations, observer ) {
16				if ( onlyAdded ) {
17					if ( mutations[0].addedNodes.length )
18						callback();
19				} else {
20					if ( mutations[0].addedNodes.length || mutations[0].removedNodes.length )
21						callback();
22				}
23			} );
24
25			// have the observer observe for changes in children
26			observer.observe( el, { childList: true, subtree: true } );
27		}
28	};
29
30	// ready event
31	$( function() {
32		initPlugin();
33	} );
34
35	// custom events trigger
36	$( document ).on( rlArgs.customEvents, function() {
37		initPlugin();
38	} );
39
40	function initPlugin() {
41		var containers = [];
42
43		// check for infinite galleries
44		$( '.rl-gallery-container' ).each( function() {
45			var container = $( this );
46
47			// is it ifinite scroll gallery?
48			if ( container.hasClass( 'rl-pagination-infinite' ) )
49				containers.push( container );
50			// remove loading class
51			else
52				container.removeClass( 'rl-loading' );
53		} );
54
55		// any infinite galleries?
56		if ( containers.length > 0 ) {
57			for ( var i = 0; i < containers.length; i++ ) {
58				var container = containers[i];
59				var gallery = container.find( '.rl-gallery' );
60				var galleryId = parseInt( container.data( 'gallery_id' ) );
61				var galleryScrollType = container.find( '.rl-pagination-bottom' ).data( 'button' );
62				var galleryButton = typeof galleryScrollType !== 'undefined' && galleryScrollType === 'manually';
63
64				// initialize infinite scroll
65				gallery.infiniteScroll( {
66					path: '.rl-gallery-container[data-gallery_id="' + galleryId + '"] .rl-pagination-bottom .next',
67					append: '.rl-gallery-container[data-gallery_id="' + galleryId + '"] .rl-gallery-item',
68					status: false,
69					hideNav: '.rl-gallery-container[data-gallery_id="' + galleryId + '"] .rl-pagination-bottom',
70					prefill: ! galleryButton,
71					loadOnScroll: true,
72					scrollThreshold: galleryButton ? false : 400,
73					button: galleryButton ? '.rl-gallery-container[data-gallery_id="' + galleryId + '"] .rl-load-more' : false,
74					debug: true,
75					history: false,
76					responseBody: 'text',
77					onInit: function() {
78						// infinite with button?
79						if ( container.hasClass( 'rl-pagination-infinite' ) && galleryButton ) {
80							// remove loading class
81							container.removeClass( 'rl-loading' );
82						}
83
84						// store gallery ID for append event
85						var _galleryId = galleryId;
86
87						// request event
88						this.on( 'request', function() {
89							// add loading class
90							container.addClass( 'rl-loading' );
91						} );
92
93						// append event
94						this.on( 'append', function( body, path, items, response ) {
95							// remove loading class
96							container.removeClass( 'rl-loading' );
97
98							$.event.trigger( {
99								type: 'doResponsiveLightbox',
100								script: rlArgs.script,
101								selector: rlArgs.selector,
102								args: rlArgs,
103								pagination_type: 'infinite',
104								gallery_id: _galleryId,
105								masonry: gallery.hasClass( 'rl-masonry-gallery' ) || gallery.hasClass( 'rl-basicmasonry-gallery' ),
106								infinite: {
107									gallery: gallery,
108									body: body,
109									items: items,
110									response: response
111								}
112							} );
113						} );
114					}
115				} );
116			}
117		}
118
119		// initialize event
120		$.event.trigger( {
121			type: 'doResponsiveLightbox',
122			script: rlArgs.script,
123			selector: rlArgs.selector,
124			args: rlArgs
125		} );
126	}
127
128	// pagination
129	$( document ).on( 'click', '.rl-pagination a.page-numbers', function( e ) {
130		var link = $( this );
131		var container = link.closest( '.rl-gallery-container' );
132
133		// ajax type pagination?
134		if ( container.hasClass( 'rl-pagination-ajax' ) ) {
135			e.preventDefault();
136			e.stopPropagation();
137
138			var galleryId = container.data( 'gallery_id' );
139			var galleryNo = container.find( '.rl-gallery' ).data( 'gallery_no' );
140
141			// add loading class
142			container.addClass( 'rl-loading' );
143
144			$.post( rlArgs.ajaxurl, {
145				action: 'rl-get-gallery-page-content',
146				gallery_id: galleryId,
147				gallery_no: galleryNo,
148				post_id: rlArgs.postId,
149				page: parseQueryString( 'rl_page', link.prop( 'href' ) ),
150				nonce: rlArgs.nonce,
151				preview: rlArgs.preview,
152				lightbox: rlArgs.script
153			} ).done( function( response ) {
154				// replace container with new content
155				container.replaceWith( $( response ).removeClass( 'rl-loading' ) );
156
157				// trigger main event
158				$.event.trigger( {
159					type: 'doResponsiveLightbox',
160					script: rlArgs.script,
161					selector: rlArgs.selector,
162					args: rlArgs,
163					pagination_type: 'ajax',
164					gallery_id: galleryId,
165					gallery_no: galleryNo
166				} );
167			} ).always( function() {
168				container.removeClass( 'rl-loading' );
169			} );
170
171			return false;
172		}
173	} );
174
175	// this is similar to the WP function add_action();
176	$( document ).on( 'doResponsiveLightbox', function( event ) {
177		if ( typeof event.masonry !== 'undefined' && event.masonry === true )
178			return false;
179
180		var script = event.script;
181		var selector = event.selector;
182		var args = event.args;
183
184		if ( typeof script === 'undefined' || typeof selector === 'undefined' )
185			return false;
186
187		rl_view_image = function( script, url ) {
188			$.event.trigger( {
189				type: 'doLightboxViewImage',
190				script: script,
191				url: url
192			} );
193		}
194
195		rl_hide_image = function( script, url ) {
196			$.event.trigger( {
197				type: 'doLightboxHideImage',
198				script: script,
199				url: url
200			} );
201		}
202
203		// WooCommerce 3.0+ compatibility
204		setTimeout( function() {
205			var flex = $( '.flex-viewport' );
206
207			if ( args.woocommerce_gallery === '1' ) {
208				var gallery = $( '.woocommerce-product-gallery' );
209
210				if ( gallery.find( '.woocommerce-product-gallery__trigger' ).length === 0 ) {
211					gallery.prepend( '<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>' );
212
213					gallery.on( 'click', '.woocommerce-product-gallery__trigger', function( e ) {
214						e.preventDefault();
215						e.stopPropagation();
216
217						if ( script === 'lightgallery' ) {
218							if ( flex.length ) {
219								var image = flex.find( '.flex-active-slide a[data-rel] img' );
220								var linkId = flex.find( '.flex-active-slide a[data-rel]' ).data( 'lg-id' );
221
222								image.trigger( 'click.lgcustom-item-' + linkId );
223							} else {
224								var link = gallery.find( 'a[data-rel]' ).first();
225								var image = link.find( 'img' );
226
227								image.trigger( 'click.lgcustom-item-' + link.data( 'lg-id' ) );
228							}
229						} else if ( script === 'fancybox_pro' ) {
230							if ( flex.length ) {
231								var index = flex.find( '.flex-active-slide' ).index();
232								var imageId = flex.find( '.flex-active-slide a[data-rel]' ).data( 'fancybox' );
233
234								Fancybox.fromOpener( '[data-fancybox="' + imageId + '"]', {
235									startIndex: index
236								} );
237							} else {
238								var link = gallery.find( 'a[data-rel]' ).first();
239
240								Fancybox.fromOpener( '[data-fancybox="' + link.data( 'fancybox' ) + '"]', {
241									startIndex: 0
242								} );
243							}
244						} else {
245							if ( flex.length )
246								flex.find( '.flex-active-slide a[data-rel]' ).trigger( 'click' );
247							else
248								gallery.find( 'a[data-rel]' ).first().trigger( 'click' );
249						}
250					} );
251				}
252			}
253		}, 10 );
254
255		// initialize lightbox
256		switch ( script ) {
257			case 'swipebox':
258				var slide = $( '#swipebox-overlay' ).find( '.slide.current' );
259				var imageSource = '';
260				var allowHide = false;
261				var closeExecuted = false;
262
263				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).swipebox( {
264					useCSS: ( args.animation === '1' ? true : false ),
265					useSVG: ( args.useSVG === '1' ? true : false ),
266					hideCloseButtonOnMobile: ( args.hideCloseButtonOnMobile === '1' ? true : false ),
267					removeBarsOnMobile: ( args.removeBarsOnMobile === '1' ? true : false ),
268					hideBarsDelay: ( args.hideBars === '1' ? parseInt( args.hideBarsDelay ) : 0 ),
269					videoMaxWidth: parseInt( args.videoMaxWidth ),
270					loopAtEnd: ( args.loopAtEnd === '1' ? true : false ),
271					afterOpen: function() {
272						closeExecuted = false;
273
274						// update current slide container
275						slide = $( '#swipebox-overlay' ).find( '.slide.current' );
276
277						// get image source
278						var image = slide.find( 'img' ).attr( 'src' );
279
280						// valid image source?
281						if ( typeof image !== 'undefined' ) {
282							imageSource = image;
283
284							// trigger image view
285							rl_view_image( script, imageSource );
286						} else
287							imageSource = '';
288
289						// add current slide observer
290						observeContentChanges( document.getElementById( 'swipebox-slider' ), false, function() {
291							if ( imageSource === '' ) {
292								// get image source
293								var image = slide.find( 'img' ).attr( 'src' );
294
295								// valid image source?
296								if ( typeof image !== 'undefined' ) {
297									imageSource = image;
298
299									// trigger image view
300									rl_view_image( script, imageSource );
301								} else
302									imageSource = '';
303							}
304						} );
305					},
306					nextSlide: function() {
307						// update current slide container
308						slide = $( '#swipebox-overlay' ).find( '.slide.current' );
309
310						// get image source
311						var image = slide.find( 'img' ).attr( 'src' );
312
313						// valid image source?
314						if ( typeof image !== 'undefined' ) {
315							imageSource = image;
316
317							// trigger image view
318							rl_view_image( script, imageSource );
319						} else
320							imageSource = '';
321					},
322					prevSlide: function() {
323						// update current slide container
324						slide = $( '#swipebox-overlay' ).find( '.slide.current' );
325
326						// get image source
327						var image = slide.find( 'img' ).attr( 'src' );
328
329						// valid image source?
330						if ( typeof image !== 'undefined' ) {
331							imageSource = image;
332
333							// trigger image view
334							rl_view_image( script, imageSource );
335						} else
336							imageSource = '';
337					},
338					afterClose: function() {
339						// afterClose event executed
340						closeExecuted = true;
341
342						// allow to hide image?
343						if ( allowHide ) {
344							// trigger image hide
345							rl_hide_image( script, imageSource );
346
347							allowHide = false;
348						}
349					}
350				} );
351
352				// additional event to prevent rl_hide_image to execure while opening modal
353				$( window ).on( 'resize', function() {
354					if ( ! closeExecuted ) {
355						allowHide = true;
356					}
357				} );
358				break;
359
360			case 'prettyphoto':
361				var viewDisabled = false;
362				var lastImage = '';
363
364				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).each( function() {
365					var el = $( this );
366					var title = el.data( 'rl_title' );
367					var caption = el.data( 'rl_caption' );
368
369					if ( ! title )
370						title = '';
371
372					if ( ! caption )
373						caption = '';
374
375					// set description
376					el.attr( 'title', caption );
377
378					// set title
379					el.find( 'img' ).attr( 'alt', title );
380				} );
381
382				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).prettyPhoto( {
383					hook: 'data-rel',
384					animation_speed: args.animationSpeed,
385					slideshow: ( args.slideshow === '1' ? parseInt( args.slideshowDelay ) : false ),
386					autoplay_slideshow: ( args.slideshowAutoplay === '1' ? true : false ),
387					opacity: args.opacity,
388					show_title: ( args.showTitle === '1' ? true : false ),
389					allow_resize: ( args.allowResize === '1' ? true : false ),
390					allow_expand: ( args.allowExpand === '1' ? true : false ),
391					default_width: parseInt( args.width ),
392					default_height: parseInt( args.height ),
393					counter_separator_label: args.separator,
394					theme: args.theme,
395					horizontal_padding: parseInt( args.horizontalPadding ),
396					hideflash: ( args.hideFlash === '1' ? true : false ),
397					wmode: args.wmode,
398					autoplay: ( args.videoAutoplay === '1' ? true : false ),
399					modal: ( args.modal === '1' ? true : false ),
400					deeplinking: ( args.deeplinking === '1' ? true : false ),
401					overlay_gallery: ( args.overlayGallery === '1' ? true : false ),
402					keyboard_shortcuts: ( args.keyboardShortcuts === '1' ? true : false ),
403					social_tools: ( args.social === '1' ? '<div class="pp_social"><div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href=' + location.href + '&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div></div>' : '' ),
404					ie6_fallback: true,
405					changepicturecallback: function() {
406						// is view disabled?
407						if ( viewDisabled ) {
408							// enable view
409							viewDisabled = false;
410
411							return;
412						}
413
414						lastImage = $( '#pp_full_res' ).find( 'img' ).attr( 'src' );
415
416						// trigger image view
417						rl_view_image( script, lastImage );
418
419						// is expanding allowed?
420						if ( args.allowExpand === '1' ) {
421							// disable changepicturecallback event after expanding
422							$( 'a.pp_expand' ).on( 'click', function() {
423								viewDisabled = true;
424							} );
425						}
426					},
427					callback: function() {
428						// trigger image hide
429						rl_hide_image( script, lastImage );
430					}
431				} );
432				break;
433
434			case 'fancybox':
435				var lastImage = '';
436
437				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).fancybox( {
438					modal: ( args.modal === '1' ? true : false ),
439					overlayShow: ( args.showOverlay === '1' ? true : false ),
440					showCloseButton: ( args.showCloseButton === '1' ? true : false ),
441					enableEscapeButton: ( args.enableEscapeButton === '1' ? true : false ),
442					hideOnOverlayClick: ( args.hideOnOverlayClick === '1' ? true : false ),
443					hideOnContentClick: ( args.hideOnContentClick === '1' ? true : false ),
444					cyclic: ( args.cyclic === '1' ? true : false ),
445					showNavArrows: ( args.showNavArrows === '1' ? true : false ),
446					autoScale: ( args.autoScale === '1' ? true : false ),
447					scrolling: args.scrolling,
448					centerOnScroll: ( args.centerOnScroll === '1' ? true : false ),
449					opacity: ( args.opacity === '1' ? true : false ),
450					overlayOpacity: parseFloat( args.overlayOpacity / 100 ),
451					overlayColor: args.overlayColor,
452					titleShow: ( args.titleShow === '1' ? true : false ),
453					titlePosition: args.titlePosition,
454					transitionIn: args.transitions,
455					transitionOut: args.transitions,
456					easingIn: args.easings,
457					easingOut: args.easings,
458					speedIn: parseInt( args.speeds ),
459					speedOut: parseInt( args.speeds ),
460					changeSpeed: parseInt( args.changeSpeed ),
461					changeFade: parseInt( args.changeFade ),
462					padding: parseInt( args.padding ),
463					margin: parseInt( args.margin ),
464					width: parseInt( args.videoWidth ),
465					height: parseInt( args.videoHeight ),
466					onComplete: function() {
467						lastImage = $( '#fancybox-content' ).find( 'img' ).attr( 'src' );
468
469						// trigger image view
470						rl_view_image( script, lastImage );
471					},
472					onClosed: function() {
473						// trigger image hide
474						rl_hide_image( script, lastImage );
475					}
476				} );
477				break;
478
479			case 'nivo':
480				$.each( $( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ), function() {
481					var attr = $( this ).attr( 'data-rel' );
482
483					// check data-rel attribute first
484					if ( typeof attr === 'undefined' || attr == false ) {
485						// if not found then try to check rel attribute for backward compatibility
486						attr = $( this ).attr( 'rel' );
487					}
488
489					// for some browsers, `attr` is undefined; for others, `attr` is false. Check for both.
490					if ( typeof attr !== 'undefined' && attr !== false ) {
491						var match = attr.match( new RegExp( selector + '\\-(gallery\\-(?:[\\da-z]{1,4}))', 'ig' ) );
492
493						if ( match !== null )
494							$( this ).attr( 'data-lightbox-gallery', match[0] );
495					}
496				} );
497
498				var observerInitialized = false;
499				var changeAllowed = true;
500				var lastImage = '';
501
502				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).nivoLightbox( {
503					effect: args.effect,
504					clickOverlayToClose: ( args.clickOverlayToClose === '1' ? true : false ),
505					keyboardNav: ( args.keyboardNav === '1' ? true : false ),
506					errorMessage: args.errorMessage,
507					afterShowLightbox: function( lightbox ) {
508						var content = $( lightbox )[0].find( '.nivo-lightbox-content' );
509
510						// is observer initialized?
511						if ( ! observerInitialized ) {
512							// turn it off
513							observerInitialized = true;
514
515							// add content observer
516							observeContentChanges( document.getElementsByClassName( 'nivo-lightbox-content' )[0], true, function() {
517								if ( changeAllowed ) {
518									lastImage = content.find( '.nivo-lightbox-image img' ).attr( 'src' );
519
520									// trigger image view
521									rl_view_image( script, lastImage );
522
523									// disallow observer changes
524									changeAllowed = false;
525								}
526							} );
527						}
528					},
529					afterHideLightbox: function() {
530						// allow observer changes
531						changeAllowed = true;
532
533						// trigger image hide
534						rl_hide_image( script, lastImage );
535					},
536					onPrev: function( element ) {
537						// disallow observer changes
538						changeAllowed = false;
539
540						lastImage = element[0].attr( 'href' );
541
542						// trigger image view
543						rl_view_image( script, lastImage );
544					},
545					onNext: function( element ) {
546						// disallow observer changes
547						changeAllowed = false;
548
549						lastImage = element[0].attr( 'href' );
550
551						// trigger image view
552						rl_view_image( script, lastImage );
553					}
554				} );
555				break;
556
557			case 'imagelightbox':
558				var selectors = [];
559				var lastImage = '';
560
561				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).each( function( i, item ) {
562					var attr = $( item ).attr( 'data-rel' );
563
564					// check data-rel attribute first
565					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
566						selectors.push( attr );
567					// if not found then try to check rel attribute for backward compatibility
568					else {
569						attr = $( item ).attr( 'rel' );
570
571						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
572							selectors.push( attr );
573					}
574				} );
575
576				if ( selectors.length > 0 ) {
577					// make unique
578					selectors = _.uniq( selectors );
579
580					$( selectors ).each( function( i, item ) {
581						if ( typeof event.pagination_type !== 'undefined' ) {
582							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).each( function() {
583								$( this ).off( 'click.imageLightbox' );
584							} );
585						}
586
587						$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).imageLightbox( {
588							animationSpeed: parseInt( args.animationSpeed ),
589							preloadNext: ( args.preloadNext === '1' ? true : false ),
590							enableKeyboard: ( args.enableKeyboard === '1' ? true : false ),
591							quitOnEnd: ( args.quitOnEnd === '1' ? true : false ),
592							quitOnImgClick: ( args.quitOnImageClick === '1' ? true : false ),
593							quitOnDocClick: ( args.quitOnDocumentClick === '1' ? true : false ),
594							onLoadEnd: function() {
595								lastImage = $( '#imagelightbox' ).attr( 'src' );
596
597								// trigger image view
598								rl_view_image( script, lastImage );
599							},
600							onEnd: function() {
601								// trigger image hide
602								rl_hide_image( script, lastImage );
603							}
604						} );
605					} );
606				}
607				break;
608
609			case 'tosrus':
610				var selectors = [];
611				var lastImage = '';
612
613				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).each( function( i, item ) {
614					var attr = $( item ).attr( 'data-rel' );
615
616					// check data-rel attribute first
617					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
618						selectors.push( attr );
619					// if not found then try to check rel attribute for backward compatibility
620					else {
621						attr = $( item ).attr( 'rel' );
622
623						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
624							selectors.push( attr );
625					}
626				} );
627
628				if ( selectors.length > 0 ) {
629					// make unique
630					selectors = _.uniq( selectors );
631
632					$( selectors ).each( function( i, item ) {
633						if ( typeof event.pagination_type !== 'undefined' ) {
634							$( 'body' ).find( '.tosrus-' + item ).remove();
635
636							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).each( function() {
637								$( this ).off( 'click.tos' );
638							} );
639						}
640
641						var tos = $( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).tosrus( {
642							infinite: ( args.infinite === '1' ? true : false ),
643							autoplay: {
644								play: ( args.autoplay === '1' ? true : false ),
645								pauseOnHover: ( args.pauseOnHover === '1' ? true : false ),
646								timeout: args.timeout
647							},
648							effect: args.effect,
649							keys: {
650								prev: ( args.keys === '1' ? true : false ),
651								next: ( args.keys === '1' ? true : false ),
652								close: ( args.keys === '1' ? true : false )
653							},
654							pagination: {
655								add: ( args.pagination === '1' ? true : false ),
656								type: args.paginationType
657							},
658							// forced
659							show: false,
660							buttons: true,
661							caption: {
662								add: true,
663								attributes: [ "title" ]
664							},
665							wrapper: {
666								classes: 'tosrus-' + item,
667								onClick: args.closeOnClick === '1' ? 'close' : 'toggleUI'
668							}
669						} );
670
671						tos.on( 'sliding.tos', function( event, number ) {
672							lastImage = $( $( event.target ).find( '.tos-slider .tos-slide' )[number] ).find( 'img' ).attr( 'src' );
673
674							// trigger image view
675							rl_view_image( script, lastImage );
676						} );
677
678						tos.on( 'closing.tos', function() {
679							// trigger image hide
680							rl_hide_image( script, lastImage );
681						} );
682					} );
683				}
684				break;
685
686			case 'featherlight':
687				var selectors = [];
688				var lastImage = '';
689
690				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).each( function( i, item ) {
691					var attr = $( item ).attr( 'data-rel' );
692
693					// check data-rel attribute first
694					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
695						selectors.push( attr );
696					// if not found then try to check rel attribute for backward compatibility
697					else {
698						attr = $( item ).attr( 'rel' );
699
700						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
701							selectors.push( attr );
702					}
703				} );
704
705				if ( selectors.length > 0 ) {
706					// make unique
707					selectors = _.uniq( selectors );
708
709					// set defaults
710					$.extend( $.featherlight.defaults, {
711						openSpeed: parseInt( args.openSpeed ),
712						closeSpeed: parseInt( args.closeSpeed ),
713						closeOnClick: args.closeOnClick,
714						closeOnEsc: ( args.closeOnEsc === '1' ? true : false ),
715						afterOpen: function( event ) {
716							lastImage = event.currentTarget.href;
717
718							// trigger image view
719							rl_view_image( script, lastImage );
720						},
721						afterClose: function() {
722							// trigger image hide
723							rl_hide_image( script, lastImage );
724						}
725					} );
726
727					$( selectors ).each( function( i, item ) {
728						if ( typeof event.pagination_type !== 'undefined' ) {
729							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).each( function() {
730								$( this ).off( 'click.featherlight' );
731							} );
732						}
733
734						// gallery?
735						if ( /-gallery-/.test( item ) ) {
736							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).featherlightGallery( {
737								galleryFadeIn: parseInt( args.galleryFadeIn ),
738								galleryFadeOut: parseInt( args.galleryFadeOut ),
739								previousIcon: '&#10094;',
740								nextIcon: '&#10095;'
741							} );
742						// video?
743						} else if ( /-video-/.test( item ) ) {
744							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).featherlight();
745						// single image?
746						} else {
747							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).featherlight();
748						}
749					} );
750				}
751				break;
752
753			case 'magnific':
754				var selectors = [];
755				var lastImage = '';
756
757				$( 'a[rel*="' + selector + '"], a[data-rel*="' + selector + '"]' ).each( function( i, item ) {
758					var attr = $( item ).attr( 'data-rel' );
759
760					// check data-rel attribute first
761					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
762						selectors.push( attr );
763					// if not found then try to check rel attribute for backward compatibility
764					else {
765						attr = $( item ).attr( 'rel' );
766
767						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
768							selectors.push( attr );
769					}
770				} );
771
772				if ( selectors.length > 0 ) {
773					// make unique
774					selectors = _.uniq( selectors );
775
776					$( selectors ).each( function( i, item ) {
777						var subselector = $( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' );
778						var element = $( subselector[0] );
779						var media_type = element.data( 'magnific_type' );
780						var content_type = element.data( 'rl_content' );
781
782						// check content type first
783						if ( typeof content_type !== 'undefined' )
784							media_type = content_type;
785
786						// then media type if needed
787						if ( typeof media_type === 'undefined' )
788							media_type = 'image';
789
790						subselector.magnificPopup( {
791							type: media_type === 'gallery' ? 'image' : ( media_type === 'video' ? 'iframe' : media_type ),
792							disableOn: args.disableOn,
793							midClick: args.midClick === '1',
794							preloader: args.preloader === '1',
795							closeOnContentClick: args.closeOnContentClick === '1',
796							closeOnBgClick: args.closeOnBgClick === '1',
797							closeBtnInside: args.closeBtnInside === '1',
798							showCloseBtn: args.showCloseBtn === '1',
799							enableEscapeKey: args.enableEscapeKey === '1',
800							alignTop: args.alignTop === '1',
801							autoFocusLast: args.autoFocusLast === '1',
802							fixedContentPos: args.fixedContentPos === 'auto' ? 'auto' : ( args.fixedContentPos === '1' ),
803							fixedBgPos: args.fixedBgPos === 'auto' ? 'auto' : ( args.fixedBgPos === '1' ),
804							image: {
805								titleSrc: function( item ) {
806									var title = item.el.data( 'rl_title' );
807									var caption = item.el.data( 'rl_caption' );
808
809									if ( ! title )
810										title = '';
811
812									if ( ! caption )
813										caption = '';
814
815									return title + '<small>' + caption + '</small>';
816								}
817							},
818							gallery: {
819								enabled: subselector.length > 1 && media_type === 'gallery',
820								navigateByImgClick: true,
821								preload: [0,1]
822							},
823							callbacks: {
824								close: function() {
825									rl_hide_image( script, this.currItem.src );
826								},
827								imageLoadComplete: function() {
828									// trigger image view
829									rl_view_image( script, this.currItem.src );
830								}
831							}
832						} );
833					} );
834	
834			}
835				break;
836		}
837	} );
838
839} )( 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.