PageSourceSearch

https://sala-negra.com/wp-content/themes/actua-theme/js/theme.js?ver=7.1.2

js sala-negra.com collected 2026-10-03 22:11:15 UTC 15,145 bytes, 533 lines download raw bytes

1(function( $, i18n ) {
2	
3	var ActuaTheme = {};
4	
5	ActuaTheme.Calendar = {
6		
7		init: function(){
8			ActuaTheme.Calendar.enableClickableRow();
9			ActuaTheme.Calendar.enableCalendarPage();
10		},
11		enableClickableRow: function(){
12			if($('.clickable-row').length){
13				$(".clickable-row").click(function() {
14					window.open($(this).data("href"), '_blank');
15					//window.location = $(this).data("href");
16				});	
17			}
18		},
19		enableCalendarPage: function(){
20			
21			if($('.calendar-filter-btn').length){
22				$("body").on('click','.calendar-filter-btn',function(event){	
23					event.preventDefault();
24					if($(this).hasClass('active')){
25						$(this).removeClass('active');
26					}else{
27						$(this).addClass('active');
28					}
29					$('.tr-filter').hide();
30					$('.calendar-filter-btn.active').each(function(index){
31						var filter_id = $(this).data('filter_term_id');
32						var classselector = '.tr-filter-' + filter_id;
33						$(classselector).show('slow');
34					});
35					
36				});
37				$("body").on('click','.past-calendar-filter-btn',function(event){	
38					event.preventDefault();
39					if($(this).hasClass('active')){
40						$(this).removeClass('active');
41					}else{
42						$(this).addClass('active');
43					}
44					$('.tr-past-filter').hide();
45					$('.past-calendar-filter-btn.active').each(function(index){
46						var filter_id = $(this).data('filter_term_id');
47						var classselector = '.tr-past-filter-' + filter_id;
48						$(classselector).show('slow');
49					});
50					
51				});
52			}
53				
54		}
55		
56	}
57	
58	ActuaTheme.Filter = {
59		
60		init: function(){
61			ActuaTheme.Filter.enableFilterPage();
62		},
63		enableFilterPage: function(){
64			if($('#filter-page').length){
65				
66				$('.multi-collapse').collapse('show');
67				
68				$('body').on('change','#filter-page .autosubmit',function(event){
69					event.preventDefault();
70					$('#filters-form').submit();	
71				});
72				
73				$('body').on('click','.filter-display-mode-submit-btn',function(event){
74					event.preventDefault();
75					var new_value = $(this).data('val');
76					$("#display_input").val(new_value);
77					$('#filters-form').submit();
78				});
79				
80			}
81		}
82		
83	}
84	
85	ActuaTheme.EntityFilter = {
86		
87		init: function(){
88			ActuaTheme.EntityFilter.enableFilterPage();
89		},
90		enableFilterPage: function(){
91			if($('.page-template-page_filter_entity').length){
92				
93				$('.multi-collapse').collapse('show');
94				
95				$('body').on('change','.autosubmit',function(event){
96					event.preventDefault();
97					$('#filters-form').submit();	
98				});
99				
100				$('body').on('click','.display-submit-btn',function(event){
101					event.preventDefault();
102					var new_value = $(this).data('val');
103					$("#display").val(new_value);
104					$('#filters-form').submit();
105				});
106				
107			}
108		}
109		
110	}
111	
112	ActuaTheme.Carousel = {
113		init: function(){
114			ActuaTheme.Carousel.enableCarousel();
115		},
116		enableCarousel: function(){
117			if($(".main-slider").length){		
118				var slideWrapper = $(".main-slider"),
119					iframes = slideWrapper.find('.embed-player'),
120					lazyImages = slideWrapper.find('.slide-image'),
121					lazyCounter = 0;
122				slideWrapper.on("init", function(slick){
123					slick = $(slick.currentTarget);
124					ActuaTheme.Carousel.resizePlayer(iframes,16/9);
125					setTimeout(function(){
126						ActuaTheme.Carousel.playPauseVideo(slick,"play");
127					},1000);
128				});
129				slideWrapper.on("beforeChange", function(event, slick) {
130					slick = $(slick.$slider);
131					ActuaTheme.Carousel.playPauseVideo(slick,"pause");
132				});
133				slideWrapper.on("afterChange", function(event, slick) {
134					slick = $(slick.$slider);
135					ActuaTheme.Carousel.playPauseVideo(slick,"play");
136				});
137				slideWrapper.on("lazyLoaded", function(event, slick, image, imageSource) {
138    				lazyCounter++;
139    				if (lazyCounter === lazyImages.length){
140						lazyImages.addClass('show');
141					}
142  				});
143				
144				var arrows = false,
145					dots = false;
146				if(slideWrapper.data('arrows') == 'yes'){
147					arrows = true;
148				}
149				if(slideWrapper.data('dots') == 'yes'){
150					dots = true;
151				}
152				slideWrapper.slick({
153					autoplay:true,
154					autoplaySpeed:5000,
155					lazyLoad:"progressive",
156					speed:1000,
157					nextArrow:'<button type="button" class="slick-next"><i class="fas fa-arrow-right"></i></button>',
158					prevArrow:'<button type="button" class="slick-prev"><i class="fas fa-arrow-left"></i></button>',
159					arrows:arrows,
160					dots:dots,
161					cssEase:"cubic-bezier(0.87, 0.03, 0.41, 0.9)"
162				});		
163			}
164		},
165		resizePlayer: function(iframes,ratio){
166			if (!iframes[0]) return;
167			var win = $(".main-slider"),
168				width = win.width(),
169				playerWidth,
170				height = win.height(),
171				playerHeight,
172				ratio = ratio || 16/9;
173			iframes.each(function(){
174    			var current = $(this);
175    			if (width / ratio < height) {
176      				playerWidth = Math.ceil(height * ratio);
177					current.width(playerWidth).height(height).css({
178        				left: (width - playerWidth) / 2,
179         				top: 0
180        			});
181    			} else {
182					playerHeight = Math.ceil(width / ratio);
183      				current.width(width).height(playerHeight).css({
184        				left: 0,
185						top: (height - playerHeight) / 2
186      				});
187    			}
188  			});			
189		},
190		postMessageToPlayer: function(player,command){
191			if (player == null || command == null) return;
192			player.contentWindow.postMessage(JSON.stringify(command), "*");
193		},
194		playPauseVideo: function(slick,control){
195			var currentSlide, slideType, startTime, player, video;
196			currentSlide = slick.find(".slick-current");
197			slideType = currentSlide.attr("class").split(" ")[1];
198			player = currentSlide.find("iframe").get(0);
199			startTime = currentSlide.data("video-start");
200			if(slideType === "vimeo"){
201				switch(control){
202					case "play":
203						if ((startTime != null && startTime > 0 ) && !currentSlide.hasClass('started')) {
204							ActuaTheme.Carousel.postMessageToPlayer(player,{"method":"setCurrentTime","value":startTime});
205						}
206						ActuaTheme.Carousel.postMessageToPlayer(player,{"method":"play","value":1});
207						break;
208					case "pause":
209						ActuaTheme.Carousel.postMessageToPlayer(player,{"method":"pause","value":1});
210						break;
211				}
212			}else if(slideType === "youtube"){
213				switch(control){
214					case "play":
215						ActuaTheme.Carousel.postMessageToPlayer(player,{"event":"command","func":"mute"});
216						ActuaTheme.Carousel.postMessageToPlayer(player,{"event":"command","func":"playVideo"});
217						break;
218					case "pause":
219						ActuaTheme.Carousel.postMessageToPlayer(player,{"event":"command","func":"pauseVideo"});
220						break;
221				}
222			}else if (slideType === "video"){
223				video = currentSlide.children("video").get(0);
224				if (video != null) {
225					if (control === "play"){
226						video.play();
227					}else{
228						video.pause();
229					}
230				}
231			}
232		}
233	}
234	
235	ActuaTheme.Ux = {
236		
237		init: function(){
238			ActuaTheme.Ux.reorderPosts();
239			ActuaTheme.Ux.setBodyClasses();
240			ActuaTheme.Ux.enableBackToTop();
241			ActuaTheme.Ux.enableLogosCarousel();
242			ActuaTheme.Ux.enableMagnificPopup();
243			ActuaTheme.Ux.skipLinkFocusFix();
244			ActuaTheme.Ux.enableGoToEvent();
245			ActuaTheme.Ux.contactFormToBs4();
246		},
247		setBodyClasses: function(){
248			
249			if($('article.type-actua').length){
250				
251				var classes = $('article.type-actua').attr("class").split(/\s+/);
252				
253				for (var j = 0; j < classes.length; j++) {
254					
255					var className = classes[j];
256					
257					if (0 === className.indexOf('actua_category')) {
258						
259						$('body').addClass(className);
260						
261					}
262					
263				}
264				
265			}
266			
267		},
268		enableBackToTop: function(){
269				
270			$("body").on('click','.back-to-top',function(event){
271				event.preventDefault();
272				$('html, body').animate({scrollTop: 0},500);
273				return false;	
274			});
275			
276		},
277		reorderPosts: function(){
278			var sem = true;
279			$('.jqorderrow').each(function(index){
280				$(this).children('.jqorder:nth(0)').addClass('order-sm-1');
281				$(this).children('.jqorder:nth(1)').addClass('order-sm-2');
282				if(sem){
283					$(this).children('.jqorder:nth(0)').addClass('order-md-2');
284					$(this).children('.jqorder:nth(1)').addClass('order-md-1');
285					sem = false;
286				}else{
287					$(this).children('.jqorder:nth(0)').addClass('order-md-1');
288					$(this).children('.jqorder:nth(1)').addClass('order-md-2');
289					sem = true;
290				}
291			});
292		},
293		enableLogosCarousel: function(){
294			
295			if($('.logos-footer-carousel').length){
296				var max_logos = $('.logos-footer-carousel').data('items');
297				var sm_logos = 2;
298				var md_logos = 3;
299				var lg_logos = 4;
300				if(max_logos < sm_logos){
301					sm_logos = max_logos;
302				}
303				if(max_logos < md_logos){
304					md_logos = max_logos;
305				}
306				if(max_logos < lg_logos){
307					lg_logos = max_logos;
308				}
309				
310				$('.logos-footer-carousel').owlCarousel({
311					loop:false,
312					margin:30,
313					navText:['<i class="fas fa-arrow-left"></i>','<i class="fas fa-arrow-right"></i>'],
314					autoWidth:false,
315					autoHeight:false,
316					center:false,
317					responsiveClass:true,
318					responsive:{
319						0:{items:1,nav:true,dots:false,center:false,autoWidth:true},
320						480:{items:sm_logos,nav:true,dots:false,center:false,autoWidth:true},
321						768:{items:md_logos,nav:true,dots:false,center:false,autoWidth:true},
322						992:{items:lg_logos,nav:true,dots:false,center:false,autoWidth:false},
323					}
324				});
325			}
326			
327		},
328		enableMagnificPopup: function(){
329			
330			if ($('.gallery-item').length){
331				$('.gallery-item a').magnificPopup({
332					 type:'image',
333					 image: {
334					   verticalFit: true
335					 },
336					 gallery: {
337					  enabled: true
338					 }
339				});
340			}
341
342			if ($('.blocks-gallery-item').length){
343				$('.blocks-gallery-item a').magnificPopup({
344					 type:'image',
345					 image: {
346					   verticalFit: true
347					 },
348					 gallery: {
349					  enabled: true
350					 }
351				});
352			}
353			
354		},
355		skipLinkFocusFix: function(){
356			var isIe = /(trident|msie)/i.test( navigator.userAgent );
357			if ( isIe && document.getElementById && window.addEventListener ) {
358				window.addEventListener( 'hashchange', function() {
359					var id = location.hash.substring( 1 ),
360						element;
361
362					if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
363						return;
364					}
365
366					element = document.getElementById( id );
367
368					if ( element ) {
369						if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
370							element.tabIndex = -1;
371						}
372
373						element.focus();
374					}
375				}, false );
376			}
377		},
378		enableGoToEvent: function(){
379			
380			if($('.link-to-actua-event').length){
381				
382				$("body").on('click','.link-to-actua-event',function(event){
383					
384					event.preventDefault();
385					
386					if($('#bookingContainer').length){
387						var t = $('#bookingContainer');
388					}else if($('#actuaLiveContainer').length){
389						var t = $('#actuaLiveContainer');	 
390					}else if($('#primary-footer').length){
391						var t = $('#primary-footer');	 
392					}else if($('#secondary-footer').length){
393						var t = $('#secondary-footer');	 
394					}else{
395						var t = $('#third-footer');
396					} 
397				
398					$('html,body').animate({scrollTop: t.offset().top - 175},500);
399					return false;
400					
401				});
402				
403			}
404			
405		},
406		contactFormToBs4: function(){
407			
408			$('.wpcf7-form-control:not(.wpcf7-submit)').addClass('form-control');
409			$('.wpcf7-submit').addClass('btn btn-primary');
410			
411		}
412		
413	}
414	
415	ActuaTheme.Menus = {
416		
417		init: function(){
418			
419			ActuaTheme.Menus.closeWhenEsc();
420			ActuaTheme.Menus.enableSearch();
421			ActuaTheme.Menus.enableStickyMenu();
422			ActuaTheme.Menus.createMobileCloseBtn();
423			ActuaTheme.Menus.enableMobileMenu();
424			
425		},
426		closeWhenEsc:function(){
427			$(document).keydown(function(e){
428				//Close search
429				if(e.keyCode == 27 && $('#actua-menu-search-container').hasClass('open')) {
430					$('#actua-menu-search-container').toggleClass('open');
431				}
432				if(e.keyCode == 27 && $('.actua-menu-default-mobile-style.open').length) {
433					$('.actua-menu-default-mobile-style').removeClass('open');
434				}
435			});
436		},
437		enableSearch:function(){
438			$('body').on('click','.actua-menu-search a, .search-close-button',function(event){
439				event.preventDefault();
440				$('#actua-menu-search-container').toggleClass('open');
441			});
442		},
443		enableStickyMenu: function(){
444			if($('.actua-navbar-container.sticky').length){
445				var stickyHeader = document.querySelector( '.actua-navbar-container.sticky' ),
446				offsetHeight = document.querySelector( '#actua-site-header' ).offsetHeight,
447				stickHeader;
448				if ( stickyHeader && typeof Headroom !== undefined ) {
449					stickHeader = new Headroom( stickyHeader, {
450						offset: offsetHeight,
451						classes: {
452							initial: 'actua-sticky-menu-header',
453							pinned: 'actua-sticky-menu-header--pinned',
454							unpinned: 'actua-sticky-menu-header--unpinned',
455							top: 'actua-sticky-menu-header--top',
456							notTop: 'actua-sticky-menu-header--not-top',
457							bottom: 'actua-sticky-menu-header--bottom',
458							notBottom: 'actua-sticky-menu-header--not-bottom'
459						}
460					} );
461					stickHeader.init();
462				}
463			}
464		},
465		createMobileCloseBtn: function(){
466			
467			$('.actua-menu-default-mobile-style ul.menu').prepend('<li class="menu-item"><a class="close-menu-btn" href="#"><i class="fas fa-times"></i></a></li>');
468		
469		},
470		enableMobileMenu: function(){
471			
472			$('body').on('click','.actua-menu-hamburguer a',function(event){
473				event.preventDefault();
474				var toggleBtn = $(this);
475				var target = $(this).data('target');
476				var currentMenu = $('.actua-menu-default-mobile-style' + target);
477				currentMenu.toggleClass('open');
478				ActuaTheme.Menus.menuCloseOnBody(currentMenu,toggleBtn);
479			})
480			
481			$('body').on('click','.actua-menu-default-mobile-style li.menu-item-has-children > a',function(event){
482				event.preventDefault();
483				$(this).parent('li').toggleClass('open');
484			})
485			
486			$('body').on('click','.actua-menu-default-mobile-style a.close-menu-btn',function(event){
487				event.preventDefault();
488				$(this).parent('li').parent('ul').parent('nav').toggleClass('open');
489			})
490			
491		},
492		menuCloseOnBody: function($menu,$toggleBtn){
493			
494			$("body").on('mouseup', function( event ) {
495				if(!$menu.is(event.target) && !$menu.has(event.target).length){
496					$menu.removeClass('open');
497					$( this ).off( event );
498				}
499			})
500			
501		}
502	}
503	
504	ActuaTheme.App = {
505		
506		init: function(){
507			
508			ActuaTheme.Ux.init();
509			ActuaTheme.Carousel.init();
510			ActuaTheme.Calendar.init();
511			ActuaTheme.Filter.init();
512			ActuaTheme.EntityFilter.init();
513			ActuaTheme.Menus.init();
514						
515		}
516		
517	}
518	
519	jQuery(document).ready(function($) {
520		
521		$(".preloader").fadeOut("slow");
522		
523		ActuaTheme.App.init();
524		
525		$(window).on("resize.slickVideoPlayer", function(){
526			ActuaTheme.Carousel.resizePlayer($(".main-slider").find('.embed-player'), 16/9);
527		});
528		
529	})
530	
531})( jQuery, window.wp.i18n );
532
533

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.