PageSourceSearch

https://babacli.com/wp-content/plugins/wp-jquery-lightbox/lightboxes/wp-jquery-lightbox/jquery.lightbox.js

js babacli.com collected 2026-09-30 20:26:02 UTC 26,581 bytes, 593 lines download raw bytes

1/**
2 * WP jQuery Lightbox
3 * Version 1.4.8.2 - 2021-01-23
4 * 
5 * @author Ulf Benjaminsson (http://www.ulfbenjaminsson.com) 
6 *
7 * This is a modified version of Warren Krevenkis Lightbox-port (see notice below) for use in the WP jQuery Lightbox-
8 * plugin (http://wordpress.org/extend/plugins/wp-jquery-lightbox/)
9 *  Modifications include:
10 *	. migrated to modern jQuery (Thanks: [Joseph Rézeau aka papijo](https://www.rezeau.org/)!) 
11 *	. improved support of Gutenberg editor's image captions (Thanks: [Joseph Rézeau aka papijo](https://www.rezeau.org/)!) 
12 *	. added slideshow
13 *	. added swipe-support
14 *	. added "support" for WordPress admin bar.
15 *	. improved the resizing code to respect aspect ratio
16 *	. improved scaling routines to maximize images while taking captions into account
17 *  . added support for browser resizing and orientation changes
18 *	. grabs image caption from WordPress [gallery] or media library output
19 *	. using WordPress API to localize script (with safe fallbacks)
20 *	. grabs image title if the link lacks one
21 *	. using rel attribute instead of class
22 *	. auto-lightboxing all links after page load
23 *	. replaced explicit IMG-urls with divs, styled through the CSS.
24 *	. honors empty captions / titles
25 *	. use only title if captions is identical
26 *  . added support for disabling all animations
27 *	. using no-conflict mode (for good measure)
28 **/
29/**
30 * jQuery Lightbox
31 * Version 0.5 - 11/29/2007
32 * @author Warren Krewenki
33 *
34 * This package is distributed under the BSD license.
35 * For full license information, see LICENSE.TXT
36 *
37 * Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
38 * Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
39 **/
40(function($){
41	//http://stackoverflow.com/a/16187766/347764	
42	function versionCompare(a, b){ 	
43		var i, l, d;
44		a = a.split('.');
45		b = b.split('.');
46		l = Math.min(a.length, b.length);
47		for (i=0; i<l; i++) {
48			d = parseInt(a[i], 10) - parseInt(b[i], 10);
49			if (d !== 0) {
50				return d;
51			}
52		}
53		return a.length - b.length;
54	}
55    $.fn.lightbox = function(options) {			
56        var opts = $.extend({}, $.fn.lightbox.defaults, options);
57		if($("#overlay").is(':visible')){//to resize the overlay whenever doLightbox is invoked
58			$(window).trigger('resize'); //we need this to deal with InfiniteScroll and similar.
59		}
60		function onClick() {
61            initialize();
62            start(this);
63            return false;
64        }	
65		if(versionCompare($.fn.jquery, '1.7') > 0){
66			return $(this).on("click", onClick);
67        }else{
68			return $(this).live("click", onClick); //deprecated since 1.7
69		}				
70		function initialize() {
71            $(window).on('orientationchange', resizeListener);
72            $(window).on('resize', resizeListener);
73            $('#overlay').remove();
74            $('#lightbox').remove();         
75            opts.inprogress = false;
76			opts.auto = -1;
77			var txt = opts.strings;
78			var arrowLeft = '<svg id="prevArrow" width="60px" height="60px" viewBox="-5.5 0 26 26" xmlns="http://www.w3.org/2000/svg"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-423.000000, -1196.000000)" fill="currentColor"><path d="M428.115,1209 L437.371,1200.6 C438.202,1199.77 438.202,1198.43 437.371,1197.6 C436.541,1196.76 435.194,1196.76 434.363,1197.6 L423.596,1207.36 C423.146,1207.81 422.948,1208.41 422.985,1209 C422.948,1209.59 423.146,1210.19 423.596,1210.64 L434.363,1220.4 C435.194,1221.24 436.541,1221.24 437.371,1220.4 C438.202,1219.57 438.202,1218.23 437.371,1217.4 L428.115,1209" id="chevron-left"></path></g></g></svg>';
79			var arrowRight = '<svg id="nextArrow" width="60px" height="60px" viewBox="-5.5 0 26 26" xmlns="http://www.w3.org/2000/svg"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-474.000000, -1196.000000)" fill="currentColor"><path d="M488.404,1207.36 L477.637,1197.6 C476.806,1196.76 475.459,1196.76 474.629,1197.6 C473.798,1198.43 473.798,1199.77 474.629,1200.6 L483.885,1209 L474.629,1217.4 C473.798,1218.23 473.798,1219.57 474.629,1220.4 C475.459,1221.24 476.806,1221.24 477.637,1220.4 L488.404,1210.64 C488.854,1210.19 489.052,1209.59 489.015,1209 C489.052,1208.41 488.854,1207.81 488.404,1207.36"></path></g></g></svg>';
80
81			var navigation = opts.newNavStyle
82				? '<div id="newHoverNav">' + arrowLeft + arrowRight + '</div>'
83				: '<div id="hoverNav"><a href="javascript://" title="' + txt.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + txt.nextLinkTitle + '"></a></div>';
84
85			var swipeNavigation = opts.newNavStyle
86				? arrowLeft + arrowRight
87				: '<a href="javascript://" title="' + txt.prevLinkTitle + '" id="prevLink" class="touch-device"></a><a href="javascript://" id="nextLink" class="touch-device" title="' + txt.nextLinkTitle + '"></a>';
88
89            var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage">' + navigation + '<div id="jqlb_loading"><a href="javascript://" id="loadingLink"><div id="jqlb_spinner"></div></a></div></div></div>';
90			if ( jqlbIsTouchDevice() ) {
91				outerImage = '<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage">' + swipeNavigation + '<div id="jqlb_loading"><a href="javascript://" id="loadingLink"><div id="jqlb_spinner"></div></a></div></div></div>';
92			}
93            var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="titleAndCaption"></span><div id="controls">
93<span id="numberDisplay"></span> <a id="playPause" href="#"></a> <span id="downloadLink"></span></div></div><div id="bottomNav">';
94            imageData += '<a href="javascript://" id="bottomNavClose" title="' + txt.closeTitle + '"><div id="jqlb_closelabel"></div></a></div></div></div>';
95            var string;
96            if ( opts.navbarOnTop ) {
97                string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
98                $("body").append(string);
99                $("#imageDataContainer").addClass('ontop');
100			} else {
101                string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
102                $("body").append(string);
103            }
104            $("#overlay").on("click", function () { end(); }).hide();
105            $("#lightbox").on("click", function () { end(); }).hide();
106            $("#loadingLink").on("click", function () { end(); return false; });
107            $("#bottomNavClose").on("click", function () { end(); return false; });
108            $('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
109            $('#imageDataContainer').width(opts.widthCurrent);
110            if (!opts.imageClickClose) {
111                $("#lightboxImage").on("click", function () { return false; });
112                $("#hoverNav").on("click", function () { return false; });
113            }
114
115			// Apply color options
116			$("#outerImageContainer").css({ "background-color": opts.borderColor });
117			$("#overlay").css({
118				"background-color": opts.overlayColor ?? '#000',
119				"opacity": opts.overlayOpacity ?? '.6',
120				"font-style": "italic"
121			});
122
123			// Hide/show infobar
124			if ( ! opts.showInfoBar ) {
125				$('#imageDataContainer').addClass('hide');
126			}
127
128			// Fixed nav postion infobar
129			if ( opts.fixedNav ) {
130				$('#prevArrow').addClass('fixed');
131				$('#nextArrow').addClass('fixed');
132			}
133        };	
134        //allow image to reposition & scale if orientation change or resize occurs.
135        function resizeListener(e) {
136            if (opts.resizeTimeout) {
137                clearTimeout(opts.resizeTimeout);
138                opts.resizeTimeout = false;
139            }
140            opts.resizeTimeout = setTimeout(function () { doScale(); }, 50); //a delay to avoid duplicate event calls.		
141        }
142        function getPageSize(){           						
143			return { 
144				pageWidth:$(document).width(), //returns width of HTML document
145				pageHeight:$(document).height(), 
146				viewportWidth:$(window).width(),  //width of browser viewport, minus scrollbars
147				viewportHeight:$(window).height()-opts.adminBarHeight,				
148			};			
149        };       
150        function getPageScroll() {
151            var yScroll = $(document).scrollTop();            
152			if(opts.adminBarHeight && parseInt($('#wpadminbar').css('top'), 10) === 0){				
153				yScroll += opts.adminBarHeight;
154			}
155			return {x:$(document).scrollLeft(), y:yScroll};            
156        };
157		function start(imageLink) {
158			var pageSize = getPageSize();            
159			var newTop = 0;
160			$("#overlay").hide().css({width: pageSize.pageWidth + 'px', height: pageSize.pageHeight + 'px', opacity: opts.overlayOpacity*100 + '%'}).fadeIn(400);
161			var imageNum = 0;  			
162			var images = [];
163			opts.downloads = {}; //to keep track of any custom download links		
164			$("a").each(function(){
165				if(!this.href || (this.rel != imageLink.rel)) {
166					return;
167				}
168				var jqThis = $(this);
169				var title = opts.showTitle ? getTitle(jqThis) : '';
170				var caption = {html:'',text:''};
171				if (opts.showCaption) {
172					// Case if Gutenberg blocks : the caption now resides inside the <figcaption> tag.
173					var figureCaption = jqThis.parent().children('figcaption')[0];
174							if (figureCaption !== undefined) { // Case Gutenberg blocks
175						caption.html = figureCaption.innerHTML;
176					}	else { // Case Classic blocks
177						var caption = getCaption(jqThis);
178					}
179				}
180							
181				if (opts.showTitle && title.toLowerCase() == caption.text.toLowerCase()) {
182					title = caption.html; //to keep linked captions
183					caption.html = ''; //but not duplicate the text								
184				}	
185        			
186				var s = (title != '') ? '<span id="titleText">' + title + '</span>' : '';					
187				s += (title != '' && caption.html)? '<br />' : '';
188				s += (caption.html != '') ? '<span id="captionText">' + caption.html +'</span>' : '';	
189				if(opts.showDownload || jqThis.attr("data-download")){							
190					opts.downloads[images.length] = jqThis.attr("data-download"); //use length as an index. convenient since it will always be unique							
191				}						
192				images.push(new Array(this.href, s, images.length));
193			});			            
194			if (images.length > 1) {
195				for (i = 0; i < images.length; i++) {
196					for (j = images.length - 1; j > i; j--) {
197						if (images[i][0] == images[j][0]) {
198							images.splice(j, 1);
199						}
200					}
201				}
202				while (images[imageNum][0] != imageLink.href) { imageNum++; }
203			}
204      		opts.imageArray = images;
205      		var scroll = getPageScroll();			
206      		setLightBoxPos(scroll.y, scroll.x).show();// calculate top and left offset for the lightbox
207      		changeImage(imageNum);
208
209			// Set panzoom on initial image
210			if ( jqlbIsZoomEnabled() ) {
211				var lightboxImage = document.getElementById( 'lightboxImage' );
212				panzoom = Panzoom( lightboxImage, { maxScale: 5, minScale: 1, panOnlyWhenZoomed: true } );
213			}
214
215			setNav();
216    	};
217		function getTitle(jqLink){
218			var title = jqLink.attr("title") || '';
219			var jqImg = jqLink.children('img:first-child');
220			if ( opts.useAltForTitle && ( jqLink.attr('alt') || jqImg.attr('alt') ) ) {
221				title = jqLink.attr('alt') ? jqLink.attr('alt') : jqImg.attr('alt');
222			}
223			if(!title){
224				var jqImg = jqLink.children('img:first-child');
225				if (jqImg.attr('title')) {
226					title = jqImg.attr('title'); //grab the title from the image if the link lacks one
227				} else if(jqImg.attr('alt')){
228					title = jqImg.attr('alt'); //if neither link nor image have a title attribute
229				}
230			}
231			return DOMPurify.sanitize(title);
232		}
233		function getCaption(jqLink){
234			var caption = {html:'',text:''};
235			if (jqLink.parent().next('.gallery-caption').html()) {
236				var jq = jqLink.parent().next('.gallery-caption');
237				caption.html = jq.html(); //holds html, links etc
238				caption.text = jq.text(); //plain-text
239			} else if (jqLink.next('.wp-caption-text').html()) {
240				caption.html = jqLink.next('.wp-caption-text').html();
241				caption.text = jqLink.next('.wp-caption-text').text();
242			}
243			caption.text = caption.text.trim().replace('&#8217;', '&#039;').replace('’', '\'').replace('…', '...');//http://nickjohnson.com/b/wordpress-apostrophe-vs-right-single-quote
244			return caption;			
245		}
246		function setLightBoxPos(newTop, newLeft) {        
247            if (opts.resizeSpeed > 0) {
248                return $('#lightbox').animate({ top: newTop+ 'px', left: newLeft+ 'px' }, opts.resizeSpeed, 'linear');                
249            }
250            return $('#lightbox').css({ top: newTop + 'px', left: newLeft + 'px' });
251        };
252        function changeImage(imageNum) {
253            if (opts.inprogress != false) {
254				return;
255			}
256			opts.inprogress = true;
257			opts.activeImage = imageNum;
258			// hide elements during transition
259			$('#jqlb_loading').show();
260			$('#lightboxImage').hide();
261			$('#hoverNav').hide();
262			$('#prevLink').hide();
263			$('#nextLink').hide();
264			$('#prevArrow').hide();
265			$('#nextArrow').hide();
266			doChangeImage();            
267        };
268        function doChangeImage() {
269            opts.imgPreloader = new Image();
270            opts.imgPreloader.onload = function () {
271                $('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0]);
272                updateDetails(); 
273				doScale();  // once image is preloaded, resize image container
274                preloadNeighborImages();				
275            };
276            opts.imgPreloader.src = opts.imageArray[opts.activeImage][0];
277        };
278        function doScale() {
279            if (!opts.imgPreloader) {
280                return;
281            }
282            var newWidth = opts.imgPreloader.width;
283            var newHeight = opts.imgPreloader.height;
284            var pageSize = getPageSize();  
285			var noScrollWidth = (pageSize.viewportWidth < pageSize.pageWidth) ? pageSize.pageWidth : pageSize.viewportWidth; //if viewport is smaller than page, use page width.
286			$("#overlay").css({ width: noScrollWidth + 'px', height: pageSize.pageHeight + 'px' });  
287            var maxHeight = (pageSize.viewportHeight) - ($("#imageDataContainer").outerHeight(true) + (2 * opts.borderSize));
288            var maxWidth = (pageSize.viewportWidth) - (2*opts.borderSize);			
289			if(opts.fitToScreen){
290				var displayHeight = maxHeight-opts.marginSize;	
291				var displayWidth = maxWidth-opts.marginSize;									
292				var ratio = 1;
293                if (newHeight > displayHeight) {
294                    ratio = displayHeight / newHeight; //ex. 600/1024 = 0.58					
295                }
296                newWidth = newWidth * ratio;
297                newHeight = newHeight * ratio;
298                ratio = 1;
299                if (newWidth > displayWidth) {
300                    ratio = displayWidth / newWidth; //ex. 800/1280 == 0.62					
301                }
302                newWidth = Math.round(newWidth * ratio);
303                newHeight = Math.round(newHeight * ratio);
304            }        
305			var scroll = getPageScroll();
306			var centerY = scroll.y + (maxHeight * 0.5);
307			var newTop = centerY - (newHeight * 0.5);
308			var newLeft = scroll.x;
309			$('#lightboxImage').width(newWidth).height(newHeight);
310			resizeImageContainer(newWidth, newHeight, newTop, newLeft);           
311        }
312        function resizeImageContainer(imgWidth, imgHeight, lightboxTop, lightboxLeft) {
313            opts.widthCurrent = $("#outerImageContainer").outerWidth();
314            opts.heightCurrent = $("#outerImageContainer").outerHeight();
315            var widthNew = Math.max(300, imgWidth + (opts.borderSize * 2)); //300 = iphone. http://wordpress.org/support/topic/image-not-resized-correctly-with-wptouch?replies=6#post-4205735
316            var heightNew = (imgHeight + (opts.borderSize * 2));                      
317			setLightBoxPos(lightboxTop, lightboxLeft);                    
318			$('#imageDataContainer').animate({width:widthNew}, opts.resizeSpeed, 'linear');
319			$('#outerImageContainer').animate({width:widthNew,height:heightNew}, opts.resizeSpeed, 'linear', function () {				
320					showImage();				
321			});
322			if (opts.imageArray.length > 1) {
323                $('#hoverNav').show();      
324				$('#prevLink').show();
325				$('#nextLink').show();
326				$('#prevArrow').show();
327				$('#nextArrow').show();
328            }
329            $('#prevLink,#nextLink').height(imgHeight);            
330        };
331        function showImage(){                
332            $('#jqlb_loading').hide();
333            showDetails();
334			if(opts.resizeSpeed > 0){
335                $('#lightboxImage').fadeIn("fast", function(){
336					onImageVisible();
337				});
338            }else{
339				$('#lightboxImage').show();
340				onImageVisible();
341            }
342            opts.inprogress = false;
343        };
344		function showDetails(){			
345			$('#titleAndCaption').css("opacity", '100%');			
346			if(opts.showDownload){
347				$('#downloadLink').css('opacity', '100%');
348			}					
349            if(opts.showNumbers){
350				$('#numberDisplay').css('opacity', '100%');
351			}
352			if(opts.slidehowSpeed){
353				$('#playPause').css('opacity', '100%');
354			}
355			if(opts.resizeSpeed > 0){
356				$("#imageDetails").animate({opacity: '100%'}, 'fast');
357			}else{
358				$("#imageDetails").css('opacity', '100%');
359			}
360		}
361		function onImageVisible(){
362			if(opts.auto != -1){				
363				clearTimeout(opts.auto); //in case we came here after mouse/keyboard interaction
364				opts.auto = setTimeout(function(){changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1);}, opts.slidehowSpeed);
365			}			
366			enableKeyboardNav();
367
368			// Re-attach panzoom to current image
369			if ( jqlbIsZoomEnabled() ) {
370				panzoom?.destroy();
371				var lightboxImage = document.getElementById( 'lightboxImage' );
372				panzoom = Panzoom( lightboxImage, { maxScale: 5, minScale: 1, panOnlyWhenZoomed: true } );
373			}
374		}		
375		function preloadNeighborImages() {
376            if (opts.imageArray.length > 1) {
377                preloadNextImage = new Image();
378                preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
379                preloadPrevImage = new Image();
380                preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
381            } else {
382                if ((opts.imageArray.length - 1) > opts.activeImage) {
383                    preloadNextImage = new Image();
384                    preloadNextImage.src = opts.imageArray[opts.activeImage + 1][0];
385                }
386                if (opts.activeImage > 0) {
387                    preloadPrevImage = new Image();
388                    preloadPrevImage.src = opts.imageArray[opts.activeImage - 1][0];
389                }
390            }
391        };
392        function updateDetails(){ //update caption, title and control, and makes them invisible while we animate into position.                        
393			var images = opts.imageArray;
394			var txt = opts.strings;
395			var i = opts.activeImage;
396			var downloadIndex = images[i][2];            		
397            var pos = (opts.showNumbers && images.length > 1) ? txt.image + (i + 1) + txt.of + images.length : '';            
398			$("#imageDetails").css("opacity", '100%');					
399			if(images[i][1] != ''){
400                $('#titleAndCaption').css('opacity', '100%').html(images[i][1]);
401            }else{	
402				$('#titleAndCaption').empty();
403			}
404			if(opts.showNumbers){
405                $('#numberDisplay').css('opacity', '100%').html(pos);
406            }else{
407				$('#numberDisplay').empty();
408			}
409			if(opts.slidehowSpeed && images.length > 1){	
410				var pp = (opts.auto === -1) ? txt.play : txt.pause;
411				$('#playPause').css('opacity', '100%').attr('href', '#').text(pp);				
412			}else{
413				$('#playPause').empty();
414			}				
415			if(opts.showDownload || opts.downloads[downloadIndex]){
416				var url = opts.downloads[downloadIndex] ? opts.downloads[downloadIndex] : images[i][0];
417				url = DOMPurify.sanitize(url);
418				if (url.startsWith('http://') || url.startsWith('https://')){
419					$('#downloadLink').css('opacity', '100%').html($('<a>').attr('href', url).attr('target', '_blank').attr('download', '').text(txt.download));
420				}
421			}else{
422				$('#downloadLink').empty();
423			}
424			var position = $('#downloadLink').position();			
425        };	
426        function setNav() {
427            if (opts.imageArray.length > 1) {                
428				$('#prevLink').on("click", function () {
429					changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1);
430					return false;
431				});
432				$('#nextLink').on("click", function () {
433					changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1);
434					return false;
435				});
436				$('#prevArrow').on("click", function () {
437					changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1);
438					return false;
439				});
440				$('#nextArrow').on("click", function () {
441					changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1);
442					return false;
443				});
444
445				if($.fn.touchwipe){
446					$('#imageContainer').touchwipe({
447						wipeLeft: function() {
448							if ( ! isImageZoomed() ) {
449								changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1);
450							}
451						},
452						wipeRight: function() {
453							if ( ! isImageZoomed() ) {
454								changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1);
455							}
456						},
457						min_move_x: 20,				
458						preventDefaultEvents: true
459					});
460				}
461				if(opts.slidehowSpeed){				
462					$('#playPause').off('click').on("click", function() {										
463						if(opts.auto != -1){
464							$(this).text(opts.strings.play);							
465							clearTimeout(opts.auto);							
466							opts.auto = -1;
467						}else{											
468							$(this).text(opts.strings.pause);						
469							opts.auto = setTimeout(function(){changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1);}, opts.slidehowSpeed);
470						}
471						return false;
472					});							
473				}
474                enableKeyboardNav();
475            }
476        };
477        function end() {
478            disableKeyboardNav();
479			clearTimeout(opts.auto);
480			opts.auto = -1;
481            $('#lightbox').hide();
482            $('#overlay').fadeOut();         
483        };
484        function keyboardAction(e) {
485            var o = e.data.opts;
486            var keycode = e.keyCode;
487            var escapeKey = 27;
488            var key = String.fromCharCode(keycode).toLowerCase();
489            if ((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)) { // close lightbox
490                end();
491            } else if ((key == 'p') || (keycode == 37)) { // display previous image
492				disableKeyboardNav();
493                changeImage((o.activeImage == 0) ? (o.imageArray.length - 1) : o.activeImage - 1);
494            } else if ((key == 'n') || (keycode == 39)) { // display next image
495                disableKeyboardNav();
496                changeImage((o.activeImage == (o.imageArray.length - 1)) ? 0 : o.activeImage + 1);
497            }          
498            return false;
499        };
500						
501        function enableKeyboardNav() {			
502			$(document).off('keydown').on('keydown', {opts: opts}, keyboardAction);
503        };
504        function disableKeyboardNav() {
505            $(document).off('keydown');
506        };
507		function isImageZoomed() {
508			if ( jqlbIsZoomEnabled() && panzoom?.getScale() > 1 ) {
509				return true;
510			}
511			return false;
512		}
513    };    
514    $.fn.lightbox.defaults = {
515		showCaption:false,
516		showNumbers:true,
517		adminBarHeight:0, //28
518        overlayOpacity: '80%',
519        borderSize: 10,
520        imageArray: new Array,
521        activeImage: null,
522        inprogress: false, //this is an internal state variable. don't touch.
523        widthCurrent: 300,
524        heightCurrent: 300,
525        showTitle: true,       
526        imageClickClose: true
527    };	
528	$(document).ready(doLightBox);	
529})(jQuery);
530
531var panzoom = {};
532
533function jqlbIsTouchDevice() {
534	return (('ontouchstart' in window) ||
535		(navigator.maxTouchPoints > 0) ||
536		(navigator.msMaxTouchPoints > 0));
537}
538
539function jqlbIsZoomEnabled() {
540	return JQLBSettings.allowPinchZoom  === '1'
541}
542
543//you can call doLightBox() manually at any time to activate the lightboxing. Useful for AJAX-loaded content.
544function doLightBox(){
545	var haveConf = (typeof JQLBSettings == 'object');	
546	var ss, rs, ms = 0;
547	if(haveConf && JQLBSettings.slideshowSpeed) {
548		 ss = parseInt(JQLBSettings.slideshowSpeed);
549	}
550	if(haveConf && JQLBSettings.resizeSpeed) {
551		rs = parseInt(JQLBSettings.resizeSpeed);
552	}
553	if(haveConf && JQLBSettings.marginSize){
554		ms = parseInt(JQLBSettings.marginSize);
555	}
556	if(haveConf && jqlbIsTouchDevice() && JQLBSettings.mobileMarginSize){
557		ms = parseInt(JQLBSettings.mobileMarginSize)
558	}
559	var default_strings = {		
560		prevLinkTitle: 'previous image',
561		nextLinkTitle: 'next image',		
562		closeTitle: 'close image gallery',
563		image: 'Image ',
564		of: ' of ',
565		download: 'Download',
566		pause: '(pause slideshow)',
567		play: '(play slideshow)'
568	};
569	jQuery('a[rel^="lightbox"]').lightbox({
570		adminBarHeight: jQuery('#wpadminbar').height() || 0,
571		showNumbers: (haveConf && JQLBSettings.showNumbers == '1') ? true : false,
572		showCaption: (haveConf && JQLBSettings.showCaption == '1') ? true : false,
573		showTitle: (haveConf && JQLBSettings.showTitle == '1') ? true : false,
574		useAltForTitle: (haveConf && JQLBSettings.useAltForTitle == '1') ? true : false,
575		marginSize: (haveConf && ms) ? ms : 0,
576		fitToScreen: (haveConf && JQLBSettings.fitToScreen == '1') ? true : false,
577		resizeSpeed: (haveConf && rs >= 0) ? rs : 400,
578		slidehowSpeed: (haveConf && ss >= 0) ? ss : 4000,
579		showDownload: (haveConf && JQLBSettings.showDownload == '1') ? true : false,
580		navbarOnTop: (haveConf && JQLBSettings.navbarOnTop == '1') ? true : false,		
581		strings: (haveConf && typeof JQLBSettings.prevLinkTitle == 'string') ? JQLBSettings : default_strings,
582		borderSize: (haveConf && JQLBSettings?.borderSize ? JQLBSettings?.borderSize : 10),
583		borderColor: (haveConf && JQLBSettings?.borderColor ),
584		overlayColor: (haveConf && JQLBSettings?.overlayColor ),
585		overlayOpacity: (haveConf && JQLBSettings?.overlayOpacity ),
586		newNavStyle: (haveConf && JQLBSettings?.newNavStyle == '1' ? true : false ),
587		fixedNav: (haveConf && JQLBSettings?.fixedNav == '1' ? true : false ),
588		navArrowColor: (haveConf && JQLBSettings?.navArrowColor ),
589		navBackgroundColor: (haveConf && JQLBSettings?.navBackgroundColor ),
590		showInfoBar: (haveConf && JQLBSettings?.showInfoBar == '1' ? true : false )
591	});
592}
593

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.