PageSourceSearch

https://www.bcr.gob.sv/wp-content/themes/instituciones/js/blocs.js?1340

js bcr.gob.sv collected 2026-09-24 18:23:42 UTC 25,363 bytes, 621 lines download raw bytes

1// Page ready
2
3$(function(){
4	extraNavFuncs(); // Extra Nav Functions
5	setUpSpecialNavs(); // Set Up Special NavBars 
6	setUpDropdownSubs(); // Set Up Dropdown Menu Support
7	setUpLightBox(); // Add lightbox Support
8	setUpVisibilityToggle(); // Add visibility Toggle Support
9	addKeyBoardSupport(); // Add Keyboard Support - Used for Lightbox Nav
10	
11	$('a[onclick^="scrollToTarget"]').click(function(e){e.preventDefault()}); // Prevent page jump on scroll to links
12	$('.nav-item [data-active-page]').addClass($('.nav-item [data-active-page]').attr('data-active-page')); // Apply Active Link Classes
13	$('[data-toggle="tooltip"]').tooltip(); // Initialise Tool tips
14});
15
16// Loading page complete
17$(window).on('load', function()
18{
19	animateWhenVisible();  // Activate animation when visible	
20	$('#page-loading-blocs-notifaction').remove(); // Remove page loading UI
21})
22
23// Set Up Special NavBars 
24function setUpSpecialNavs()
25{
26	$('.navbar-toggler').click(function(e)
27	{ 
28		var targetNav = $(this).closest('nav');
29		var targetMenu = targetNav.find('ul.site-navigation');
30		var newMenu = targetMenu.clone();
31	
32		if (targetMenu.parent().is('.fullscreen-nav, .sidebar-nav')) // Nav is Special
33		{
34			e.stopPropagation(); // Dont do this is normal menu in use
35			targetMenu.parent().addClass('nav-special');
36			
37			if (!$(this).hasClass('selected-nav')) // Open Menu
38			{
39				$(this).addClass('selected-nav');
40				var navClasses = targetNav.attr('class').replace('navbar','').replace('row','');
41				var menuClasses = targetMenu.parent().attr('class').replace('navbar-collapse','').replace('collapse','');
42				
43				if ($('.content-tint').length =-1)
44				{
45					$('body').append('<div class="content-tint"></div>');
46				}
47				
48				newMenu.insertBefore('.page-container').wrap('<div class="blocsapp-special-menu '+navClasses+'"><blocsnav class="'+menuClasses+'">');
49				$('blocsnav').prepend('<a class="close-special-menu animated fadeIn" style="animation-delay:0.5s;"><div class="close-icon"></div></a>');
50				//$('blocsnav').prepend('<div class="row"><div class="buscador-movil"><div id="ajaxsearchlite1" class="wpdreams_asl_container asl_w asl_m asl_m_1 hasASL"><div class="probox"><div class="promagnifier"><div class="innericon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><path id="magnifier-2-icon" d="M460.355,421.59L353.844,315.078c20.041-27.553,31.885-61.437,31.885-98.037 C385.729,124.934,310.793,50,218.686,50C126.58,50,51.645,124.934,51.645,217.041c0,92.106,74.936,167.041,167.041,167.041 c34.912,0,67.352-10.773,94.184-29.158L419.945,462L460.355,421.59z M100.631,217.041c0-65.096,52.959-118.056,118.055-118.056 c65.098,0,118.057,52.959,118.057,118.056c0,65.096-52.959,118.056-118.057,118.056C153.59,335.097,100.631,282.137,100.631,217.041 z"></path></svg></div></div><div class="prosettings" style="display:none;" data-opened="0"><div class="innericon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><polygon id="arrow-25-icon" transform="rotate(90 256 256)" points="142.332,104.886 197.48,50 402.5,256 197.48,462 142.332,407.113 292.727,256 "></polygon></svg></div></div><div class="proinput"><form autocomplete="off" aria-label="Ajax search form"><input aria-label="Search input" type="search" class="orig" name="phrase" placeholder="Buscar aquí..." value="" autocomplete="off"><input aria-label="Autocomplete input, do not use this" type="text" class="autocomplete" name="phrase" value="" autocomplete="off"><span class="loading"></span><input type="submit" value="Start search" style="width:0; height: 0; visibility: hidden;"></form></div><div class="proloading"><div class="asl_loader"><div class="asl_loader-inner asl_simple-circle"></div></div></div><div class="proclose" style="display: none;"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><polygon id="x-mark-icon" points="438.393,374.595 319.757,255.977 438.378,137.348 374.595,73.607 255.995,192.225 137.375,73.622 73.607,137.352 192.246,255.983 73.622,374.625 137.352,438.393 256.002,319.734 374.652,438.378 "></polygon></svg></div></div></div><div id="asl_hidden_data"><svg style="position:absolute" height="0" width="0"><filter id="aslblur"><feGaussianBlur in="SourceGraphic" stdDeviation="4"></feGaussianBlur></filter></svg><svg style="position:absolute" height="0" width="0"><filter id="no_aslblur"></filter></svg></div><div class="asl_init_data wpdreams_asl_data_ct" style="display:none !important;" id="asl_init_id_1" data-asldata="ew0KICAgICJob21ldXJsIjogImh0dHA6Ly9nb2JpZXJuby51cmllbHJhbW9zLmNvbS8iLA0KICAgICJyZXN1bHRzdHlwZSI6ICJ2ZXJ0aWNhbCIsDQogICAgInJlc3VsdHNwb3NpdGlvbiI6ICJob3ZlciIsDQogICAgIml0ZW1zY291bnQiOiA0LA0KICAgICJpbWFnZXdpZHR
50oIjogNzAsDQogICAgImltYWdlaGVpZ2h0IjogNzAsDQogICAgInJlc3VsdGl0ZW1oZWlnaHQiOiAiNzBweCIsDQogICAgInNob3dhdXRob3IiOiAwLA0KICAgICJzaG93ZGF0ZSI6IDAsDQogICAgInNob3dkZXNjcmlwdGlvbiI6IDEsDQogICAgImNoYXJjb3VudCI6ICAwLA0KICAgICJkZWZhdWx0SW1hZ2UiOiAiaHR0cDovL2dvYmllcm5vLnVyaWVscmFtb3MuY29tL3dwLWNvbnRlbnQvcGx1Z2lucy9hamF4LXNlYXJjaC1saXRlL2ltZy9kZWZhdWx0LmpwZyIsDQogICAgImhpZ2hsaWdodCI6IDAsDQogICAgImhpZ2hsaWdodHdob2xld29yZHMiOiAxLA0KICAgICJzY3JvbGxUb1Jlc3VsdHMiOiAwLA0KICAgICJyZXN1bHRhcmVhY2xpY2thYmxlIjogMSwNCiAgICAiYXV0b2NvbXBsZXRlIjogew0KICAgICAgICAiZW5hYmxlZCIgOiAxLA0KICAgICAgICAibGFuZyIgOiAiZW4iDQogICAgfSwNCiAgICAidHJpZ2dlcm9udHlwZSI6IDEsDQogICAgInRyaWdnZXJfb25fY2xpY2siOiAwLA0KICAgICJ0cmlnZ2VyX29uX2ZhY2V0X2NoYW5nZSI6IDEsDQogICAgInNldHRpbmdzaW1hZ2Vwb3MiOiAicmlnaHQiLA0KICAgICJocmVzdWx0YW5pbWF0aW9uIjogImZ4LW5vbmUiLA0KICAgICJ2cmVzdWx0YW5pbWF0aW9uIjogImZ4LW5vbmUiLA0KICAgICJocmVzdWx0aGlkZWRlc2MiOiAiMSIsDQogICAgInByZXNjb250YWluZXJoZWlnaHQiOiAiNDAwcHgiLA0KICAgICJwc2hvd3N1YnRpdGxlIjogIjAiLA0KICAgICJwc2hvd2Rlc2MiOiAiMSIsDQogICAgImNsb3NlT25Eb2NDbGljayI6IDEsDQogICAgImlpZk5vSW1hZ2UiOiAiZGVzY3JpcHRpb24iLA0KICAgICJpaVJvd3MiOiAyLA0KICAgICJpaXRlbXNXaWR0aCI6IDIwMCwNCiAgICAiaWl0ZW1zSGVpZ2h0IjogMjAwLA0KICAgICJpaXNob3dPdmVybGF5IjogMSwNCiAgICAiaWlibHVyT3ZlcmxheSI6IDEsDQogICAgImlpaGlkZUNvbnRlbnQiOiAxLA0KICAgICJpaWFuaW1hdGlvbiI6ICIxIiwNCiAgICAiYW5hbHl0aWNzIjogIjAiLA0KICAgICJhbmFseXRpY3NTdHJpbmciOiAiIiwNCiAgICAicmVkaXJlY3RvbmNsaWNrIjogMSwNCiAgICAicmVkaXJlY3RDbGlja1RvIjogInJlc3VsdHNfcGFnZSIsDQogICAgInJlZGlyZWN0Q2xpY2tMb2MiOiAic2FtZSIsDQogICAgInJlZGlyZWN0X29uX2VudGVyIjogMSwNCiAgICAicmVkaXJlY3RFbnRlclRvIjogInJlc3VsdHNfcGFnZSIsDQogICAgInJlZGlyZWN0RW50ZXJMb2MiOiAic2FtZSIsDQogICAgInJlZGlyZWN0X3VybCI6ICI/cz17cGhyYXNlfSIsDQogICAgIm92ZXJyaWRld3BkZWZhdWx0IjogMCwNCiAgICAib3ZlcnJpZGVfbWV0aG9kIjogImdldCINCn0NCg=="></div></div></div>');
51				animateNavItems(); // Animate Nav Items
52				
53				$('blocsnav').append('<div class="instituciones-movil"><a href="#" class="follow-icon-item"  style="animation-delay:0.5s;" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230.32 37.319"><g id="Instituciones_ON" transform="translate(-65.68 -41.718)"><text id="Instituciones" transform="translate(126 73)" fill="#fff" font-size="20" font-family="MuseoSans-500, Museo Sans" font-weight="500"><tspan x="0" y="0">INSTITUCIONES</tspan></text><g id="Capa_2" data-name="Capa 2" transform="translate(65.679 41.718)"><g id="Capa_1" data-name="Capa 1"><path id="Trazado_206" data-name="Trazado 206" d="M38.973,24.2H35.167V18.3A1.311,1.311,0,0,0,34.6,17.06L20.654,8.138,20.6,8.109V6.089h6.135a.658.658,0,0,0,.652-.658V.658A.652.652,0,0,0,26.738,0H19.944a.658.658,0,0,0-.658.658V8.1h-.04L5.076,17.054A1.3,1.3,0,0,0,4.5,18.308a.853.853,0,0,0,0,.12V24.2H.658A.652.652,0,0,0,0,24.855V36.667a.652.652,0,0,0,.658.652H38.973a.652.652,0,0,0,.652-.652V24.855A.652.652,0,0,0,38.973,24.2ZM26.079,2.072V4.006H20.6V2.072ZM19.939,10.8l9.849,6.3H9.9ZM1.311,25.513H4.464V34.7H1.311ZM16.024,34.7H11.812V26.56a2.1,2.1,0,0,1,4.195,0Zm11.286,0H23.092V26.56a2.1,2.1,0,1,1,4.2,0Zm5.248,0H28.615V26.56a3.434,3.434,0,0,0-6.822,0V34.7h-4.47V26.56a3.434,3.434,0,0,0-6.827,0V34.7H7.062V19.738H32.541Zm5.774,0H35.185V25.513h3.159Z" fill="#fff"></path></g></g></g></svg></a></div>');
54				$('blocsnav').append('<div class="transparencia-movil"><a href="https://www.transparencia.gob.sv" class="follow-icon-item"  style="animation-delay:0.5s;" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 257 42"><g id="Transparencia_ON" transform="translate(-63 -108)"><g id="Elipse_1" data-name="Elipse 1" transform="translate(63 108)" fill="none" stroke="#fff" stroke-width="4"><circle cx="15" cy="15" r="15" stroke="none"></circle><circle cx="15" cy="15" r="13" fill="none"></circle></g><line id="Línea_1" data-name="Línea 1" x2="12" y2="12" transform="translate(87.5 132.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="5"></line><text id="Portal_de" data-name="Portal de" transform="translate(115 124)" fill="#fff" font-size="15" font-family="MuseoSans-700, Museo Sans" font-weight="700"><tspan x="0" y="0">Portal de</tspan></text><text id="Transparencia" transform="translate(115 144)" fill="#fff" font-size="22" font-family="MuseoSans-700, Museo Sans" font-weight="700"><tspan x="0" y="0">Transparencia</tspan></text></g></svg></a></div>');
55				setTimeout(function(){
56					$('.blocsapp-special-menu blocsnav').addClass('open');
57					$('.content-tint').addClass('on');
58					$('body').addClass('lock-scroll');
59				}, 10);
60			}
61			else // Close menu
62			{
63				$('.blocsapp-special-menu blocsnav').removeClass('open');
64				$('.selected-nav').removeClass('selected-nav');
65				
66				setTimeout(function(){
67					$('.blocsapp-special-menu').remove();
68					$('body').removeClass('lock-scroll');
69					$('.nav-special').removeClass('nav-special');
70				}, 300);
71			}
72		}
73	});
74	
75	// Close Special Menu with Tint Click	
76	$('body').on("mousedown touchstart",".content-tint, .close-special-menu",function(e)
77	{	
78		$('.content-tint').removeClass('on');
79		$('.selected-nav').click();
80	
81		setTimeout(function(){
82			$('.content-tint').remove();
83		}, 10);
84	}
85	).on("click",".blocsapp-special-menu a",function(e) // Close Menu On Link Click
86	{	
87		if (!$(e.target).closest('.dropdown-toggle').length)
88		{
89			$('.close-special-menu').mousedown();
90		} 
91	});
92	
93	// Animate Nav Items
94	function animateNavItems()
95	{
96		var animationStyle = 'fadeInRight';
97		var delay = 0;
98		var increaseVal = 60;
99	
100		if ($('.blocsapp-special-menu blocsnav').hasClass('fullscreen-nav'))
101		{
102			animationStyle = 'fadeIn';
103			increaseVal = 100;
104		}
105		else if ($('.blocsapp-special-menu').hasClass('nav-invert')) // Inverted Nav
106		{
107			animationStyle = 'fadeInLeft';
108		}
109	
110		$('.blocsapp-special-menu blocsnav li').each(function()
111		{
112			if ($(this).parent().hasClass('dropdown-menu')) // Not A drop down
113			{
114				$(this).addClass('animated fadeIn');	
115			}
116			else
117			{
118				delay += increaseVal; 
119				$(this).attr('style','animation-delay:'+delay+'ms').addClass('animated '+animationStyle);	
120			}
121		});
122	}
123}
124
125
126// Extra Nav Functions
127function extraNavFuncs()
128{
129	// Hide Menu On Item Click
130	$(".site-navigation a").click(function(e)
131	{
132		if (!$(e.target).closest('.dropdown-toggle').length) // Prevent Dropdowns Closing on click
133		{
134			$(".navbar-collapse").collapse('hide');
135		}
136	});
137	
138	// Close Open Dropdown Menu When Another menu on same level is opened
139	$("a.dropdown-toggle").click(function(e)
140	{
141		$(this).parent().addClass('target-open-menu');
142		$(this).closest('.dropdown-menu').find('.dropdown.open').each(function(i) // Loop all Open Dropdowns
143		{
144			if (!$(this).hasClass('target-open-menu'))
145			{
146				$(this).removeClass('open');
147			}
148		});
149		$('.target-open-menu').removeClass('target-open-menu');
150	});
151	
152	// Handle Multi Level Dropdowns
153	$( '.dropdown-menu a.dropdown-toggle' ).on( 'click', function ( e )
154	{
155        return openSubDropdown($(this));
156	});
157	
158	// Handle Multi Level Dropdowns
159	$('body').on("click",".dropdown-menu a.dropdown-toggle",function(e)
160	{
161        return openSubDropdown($(this));
162	});
163
164	// handle Sub Dropdowns
165	function openSubDropdown(target)
166	{
167		var $el = target;
168        var $parent = target.offsetParent( ".dropdown-menu" );
169        if ( !target.next().hasClass( 'show' ) ) {
170            target.parents( '.dropdown-menu' ).first().find( '.show' ).removeClass( "show" );
171        }
172        var $subMenu = target.next( ".dropdown-menu" );
173        $subMenu.toggleClass( 'show' );
174    
175        target.parent( "li" ).toggleClass( 'show' );
176
177        target.parents( 'li.nav-item.dropdown.show' ).on( 'hidden.bs.dropdown', function ( e ) {
178            $( '.dropdown-menu .show' ).removeClass( "show" );
179        } );
180    
181        if (!$parent.parent().hasClass( 'navbar-nav' ))
182        {
183        	if (!target.closest('.nav-special').length)
184        	{
185        		$el.next().css( { "top": $el[0].offsetTop, "left": $parent.outerWidth() - 4 } );
186        	}
187        }
188
189        return false;
190	}
191}
192
193// Scroll to target
194function scrollToTarget(D,T)
195{
196	var speed = 'slow';
197	
198	if (D == 0) // Next Bloc
199	{
200		D = $(T).closest('.bloc').height();
201	}
202	else if (D == 1) // Top of page
203	{
204		D = 0;
205	}
206	else if (D == 2) // Bottom of page
207	{
208		D = $(document).height();
209	}
210	else // Specific Bloc
211	{
212		D = $(D).offset().top;
213		if ($('.sticky-nav').length) // Sticky Nav in use
214		{
215			D -= $('.sticky-nav').outerHeight();
216		}
217	}
218	
219	if ($(T).is("[data-scroll-speed]")) // Use asigned scroll speed
220	{
221		speed = $(T).attr('data-scroll-speed');
222		
223		if (parseInt(speed)) // Is an integer
224		{
225			speed = parseInt(speed);
226		}
227	}
228
229
230	$('html,body').animate({scrollTop:D}, speed);
231	$(".navbar-collapse").collapse('hide');	
232}
233
234// Animate when visible
235function animateWhenVisible()
236{
237	hideAll(); // Hide all animation elements
238	inViewCheck(); // Initail check on page load
239	
240	$(window).scroll(function()
241	{		
242		inViewCheck(); // Check object visability on page scroll
243		scrollToTopView(); // ScrollToTop button visability toggle
244		stickyNavToggle(); // Sticky nav toggle
245	});		
246};
247
248// Set Up Dropdown Menu Support
249function setUpDropdownSubs()
250{
251	$('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event)
252	{
253		event.preventDefault(); 
254		event.stopPropagation(); 
255		$(this).parent().siblings().removeClass('open');
256		$(this).parent().toggleClass('open');
257		
258		var targetMenu = $(this).parent().children('.dropdown-menu');
259		var leftVal = targetMenu.offset().left+targetMenu.width();
260		if (leftVal > $(window).width())
261		{
262			targetMenu.addClass('dropmenu-flow-right');
263		}
264	});
265}
266
267// Sticky Nav Bar Toggle On / Off
268function stickyNavToggle()
269{
270	var offsetVal = 0; // offset Value
271	var classes = "sticky"; // Classes
272	var targetContainer = $('.page-container');
273	var isFillScreenSticky = $('.sticky-nav').hasClass('fill-bloc-top-edge');
274	
275	if (isFillScreenSticky) // Nav in hero Bloc
276	{
277		console.log('fill screen');
278		targetContainer = $('.fill-bloc-top-edge.sticky-nav').parent();
279		offsetVal = $('.sticky-nav').height();
280		classes = "sticky animated fadeInDown"; 
281	}
282	
283	if ($(window).scrollTop() > offsetVal)
284	{  
285		if (!$('.sticky-nav').hasClass('sticky')) // Add Sticky
286		{
287			$('.sticky-nav').addClass(classes);
288			offsetVal = $('.sticky-nav').height();
289
290			if (isFillScreenSticky)
291			{
292				// Set BG Color
293				var bgColor = targetContainer.css('background-color');
294				if (bgColor == "rgba(0, 0, 0, 0)") bgColor = '#FFFFFF';
295				$('.sticky-nav').css('background', bgColor);
296
297				offsetVal += parseInt(targetContainer.css('padding-top')); 
298			}
299
300			targetContainer.css('padding-top',offsetVal);
301		}
302	}
303	else if ($('.sticky-nav').hasClass('sticky')) // Remove Sticky
304	{
305		$('.sticky-nav').removeClass(classes).removeAttr('style');
306		targetContainer.removeAttr('style');
307	}	
308}
309
310// Hide all animation elements
311function hideAll()
312{
313	$('.animated').each(function(i)
314	{	
315		if (!$(this).closest('.hero').length) // Dont hide hero object
316		{
317			$(this).removeClass('animated').addClass('hideMe');
318		}
319	});
320}
321
322// Check if object is inView
323function inViewCheck()
324{	
325	$($(".hideMe").get().reverse()).each(function(i)
326	{	
327		var target = jQuery(this);
328		var a = target.offset().top + target.height();
329		var b = $(window).scrollTop() + $(window).height();
330		
331		if (target.height() > $(window).height()) // If object height is greater than window height
332		{
333			a = target.offset().top;
334		}
335		
336		if (a < b) 
337		{	
338			var objectClass = target.attr('class').replace('hideMe' , 'animated');
339			target.css('visibility','hidden').removeAttr('class');
340			setTimeout(function(){target.attr('class',objectClass).css('visibility','visible');},0.01);
341			
342			// Remove animtion when spent
343			target.on("webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd", function(event) {
344			    $(this).removeClass($(this).attr('data-appear-anim-style'))
345			});					
346		}
347	});
348};
349
350// ScrollToTop button toggle
351function scrollToTopView()
352{
353	if ($(window).scrollTop() > $(window).height()/3)
354	{	
355		if (!$('.scrollToTop').hasClass('showScrollTop'))
356		{
357			$('.scrollToTop').addClass('showScrollTop');
358		}	
359	}
360	else
361	{
362		$('.scrollToTop').removeClass('showScrollTop');
363	}
364};
365
366
367// Toggle Visibility
368function setUpVisibilityToggle()
369{
370	$(document).on('click', '[data-toggle-visibility]', function(e)
371	{
372		e.preventDefault();
373		var targetID = $(this).attr('data-toggle-visibility');
374		if (targetID.indexOf(',')!=-1) // Is Array
375		{
376			var targeArray = targetID.split(',');
377			
378			$.each(targeArray, function(i) // Loop Array
379			{
380				toggleVisibility($('#'+targeArray[i]));
381			});
382		}
383		else // Single
384		{
385			toggleVisibility($('#'+targetID));
386		}
387		
388		function toggleVisibility(T)
389		{
390			if (T.is('img')) // Image
391			{
392				T.toggle();
393			}
394			else if (T.is('.row, .bloc-group')) // Rows
395			{
396				T.toggleClass('d-flex');
397			}
398			else // Other
399			{
400				T.slideToggle();
401			}
402		}
403	});
404}
405
406// Light box support
407function setUpLightBox()
408{
409	window.targetLightbox;
410	
411	$(document).on('click', '[data-lightbox]', function(e) // Create Lightbox Modal
412	{
413		e.preventDefault();
414		targetLightbox = $(this);
415		var lightBoxPath = targetLightbox.attr('data-lightbox');
416		var lightBoxAutoPlay = targetLightbox.attr('data-autoplay');
417		var captionData ='<p class="lightbox-caption">'+targetLightbox.attr('data-caption')+'</p>';
418		var galleryID = 'no-gallery-set';
419		var lightBoxFrame = targetLightbox.attr('data-frame');
420		
421		if (targetLightbox.attr('data-gallery-id')) // Has a gallery ID so use it
422		{
423			galleryID = targetLightbox.attr('data-gallery-id');
424		}
425		
426		var autoplay = ""; // No Auto Play default
427
428		if (lightBoxAutoPlay == 1) // Add Auto Play
429		{
430			autoplay = "autoplay";
431		}
432
433		var customModal = $('<div id="lightbox-modal" class="modal fade"><div class="modal-dialog modal-dialog-centered modal-lg"><div class="modal-content '+lightBoxFrame+' blocs-lb-container"><button id="blocs-lightbox-close-btn" type="button" class="close-lightbox" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button><div class="modal-body"><a href="#" class="prev-lightbox" aria-label="prev"><span class="fa fa-chevron-left"></span></a><a href="#" class="next-lightbox" aria-label="next"><span class="fa fa-chevron-right"></span></a><img id="lightbox-image" class="img-fluid mx-auto d-block" src="'+lightBoxPath+'"><div id="lightbox-video-container" class="embed-responsive embed-responsive-16by9"><video controls '+autoplay+' class="embed-responsive-item"><source id="lightbox-video" src="'+lightBoxPath+'" type="video/mp4"></video></div>'+captionData+'</div></div></div></div>');
434		$('body').append(customModal);
435		
436		if (lightBoxFrame == "fullscreen-lb") // Full Screen Light Box
437		{
438			$('#lightbox-modal').addClass('fullscreen-modal').append('<a class="close-full-screen-modal animated fadeIn" style="animation-delay:0.5s;" onclick="$(\'#lightbox-modal\').modal(\'hide\');"><div class="close-icon"></div></a>');
439			$('#blocs-lightbox-close-btn').remove();
440		}
441		
442		if (lightBoxPath.substring(lightBoxPath.length-4) == ".mp4") // Video Object
443		{
444			$('#lightbox-image, .lightbox-caption').removeClass('d-block').hide();
445			$('#lightbox-video-container').show();
446		}
447		else // Image Object
448		{
449			$('#lightbox-image,.lightbox-caption').addClass('d-block').show();
450			$('#lightbox-video-container').hide();
451			
452			if (!targetLightbox.attr('data-caption')) // No caption data
453			{
454				$('.lightbox-caption').removeClass('d-block').hide();
455			}
456		}
457		
458		$('#lightbox-modal').modal('show');
459		
460		if (galleryID == 'no-gallery-set') // No Gallery ID
461		{
462			// Handle navigation buttons (next - prev)
463			if ($('a[data-lightbox]').index(targetLightbox) == 0)
464			{
465				$('.prev-lightbox').hide();
466			}
467			if ($('a[data-lightbox]').index(targetLightbox) == $('a[data-lightbox]').length-1)
468			{
469				$('.next-lightbox').hide();
470			}
471		}
472		else // Has Gallery ID
473		{
474			// Handle navigation buttons (next - prev)
475			if ($('a[data-gallery-id="'+galleryID+'"]').index(targetLightbox) == 0)
476			{
477				$('.prev-lightbox').hide();
478			}
479			if ($('a[data-gallery-id="'+galleryID+'"]').index(targetLightbox) == $('a[data-gallery-id="'+galleryID+'"]').length-1)
480			{
481				$('.next-lightbox').hide();
482			}
483		}
484		
485		addLightBoxSwipeSupport(); // Add Swipe Support
486	}
487	).on('hidden.bs.modal', '#lightbox-modal', function () // Handle destroy modal 
488	{
489		$('#lightbox-modal').remove();
490	})
491	
492	$(document).on('click', '.next-lightbox, .prev-lightbox', function(e) 
493	{
494		e.preventDefault();
495		var galleryID = 'no-gallery-set';
496		var idx = $('a[data-lightbox]').index(targetLightbox);
497		var next = $('a[data-lightbox]').eq(idx+1) // Next
498		
499		if (targetLightbox.attr('data-gallery-id')) // Has Gallery ID so Use
500		{
501			galleryID = targetLightbox.attr('data-gallery-id'); // ID
502			idx = $('a[data-gallery-id="'+galleryID+'"]').index(targetLightbox); // Index
503			next = $('a[data-gallery-id="'+galleryID+'"]').eq(idx+1) // Next
504		}
505		
506		if ($(this).hasClass('prev-lightbox'))
507		{
508			next = $('a[data-gallery-id="'+galleryID+'"]').eq(idx-1) // Prev
509			
510			if (galleryID == 'no-gallery-set') // No Gallery ID
511			{
512				next = $('a[data-lightbox]').eq(idx-1) // Prev
513			}
514		}
515		
516		var nextContentPath = next.attr('data-lightbox');
517		
518		if (nextContentPath.substring(nextContentPath.length-4) == ".mp4") // Video Object
519		{
520			var lightBoxAutoPlay = next.attr('data-autoplay');
521			var autoplay = ""; // No Auto Play default
522
523			if (lightBoxAutoPlay == 1) // Add Auto Play
524			{
525				autoplay = "autoplay";
526			}
527			
528			$('#lightbox-image, .lightbox-caption').removeClass('d-block').hide();
529			$('#lightbox-video-container').show().html('<video controls '+autoplay+' class="embed-responsive-item"><source id="lightbox-video" src="'+nextContentPath+'" type="video/mp4"></video>');	
530		}
531		else // Image Object
532		{
533			$('#lightbox-image').attr('src',nextContentPath).addClass('d-block').show();
534			$('#lightbox-video-container').hide();
535			$('.lightbox-caption').removeClass('d-block').hide();
536			
537			if (next.attr('data-caption'))
538			{
539				$('.lightbox-caption').html(next.attr('data-caption')).show();
540			}
541		}
542		
543		targetLightbox = next;	
544		
545		// Handle navigation buttons (next - prev)
546		$('.next-lightbox, .prev-lightbox').hide();	
547		
548		if (galleryID == 'no-gallery-set') // No Gallery ID
549		{
550			if ($('a[data-lightbox]').index(next) != $('a[data-lightbox]').length-1)
551			{
552				$('.next-lightbox').show();
553			}
554			if ($('a[data-lightbox]').index(next) > 0)
555			{
556				$('.prev-lightbox').show();
557			}
558		}
559		else // Has Gallery ID
560		{
561			if ($('a[data-gallery-id="'+galleryID+'"]').index(next) != $('a[data-gallery-id="'+galleryID+'"]').length-1)
562			{
563				$('.next-lightbox').show();
564			}
565			if ($('a[data-gallery-id="'+galleryID+'"]').index(next) > 0)
566			{
567				$('.prev-lightbox').show();
568			}
569		}
570	});
571}
572
573
574// Add Keyboard Support
575function addKeyBoardSupport()
576{
577	$(window).keydown(function(evt)
578	{		
579	  	if (evt.which == 37) // Arrow Left
580	  	{
581			if ($('.prev-lightbox').is(':visible')) // Lightbox Back
582			{
583				$('.prev-lightbox').click();
584			}
585	  	}
586	  	else if (evt.which == 39) // Arrow Right
587	  	{
588			if ($('.next-lightbox').is(':visible')) // Lightbox Forward
589			{
590				$('.next-lightbox').click();
591			}
592	  	}
593	});
594}
595
596// Add Lightbox Swipe Support
597function addLightBoxSwipeSupport()
598{
599	if ($("#lightbox-image").length) // Has Carousels
600	{
601		// Allow Swipes
602		$("#lightbox-image").swipe(
603		{
604			swipeLeft:function(event, direction, distance, duration, fingerCount)
605			{
606				if ($('.next-lightbox').is(':visible'))
607				{
608					$('.next-lightbox').click();
609				}
610			},
611			swipeRight: function()
612			{
613				if ($('.prev-lightbox').is(':visible'))
614				{
615					$('.prev-lightbox').click();
616				}
617			},
618			threshold:0
619		});
620	}
621}

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.