PageSourceSearch

https://jkkalju.ee/wp-content/cache/wpfc-minified/7j2x5yv5/rnsc.js

js jkkalju.ee collected 2026-10-02 11:45:17 UTC 27,818 bytes, 883 lines download raw bytes

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