PageSourceSearch

https://materolbia.com/wp-content/themes/gemelli/assets/scripts/min/theme.min.js?ver=1.0.0

js materolbia.com collected 2026-10-08 09:28:48 UTC 6,777 bytes, 258 lines download raw bytes

1/**
2 * Add any custom theme JavaScript to this file.
3 */
4( function ( document, $ ) {
5
6	var topMenuPosition = 'TOPNAV';
7
8	var lan = $('html').attr('lang');
9	var suffix = lan === 'en-US' ? 'en-' : '';
10
11	function moveTopMenuToHamburger() {
12		console.log(topMenuPosition);
13		if (topMenuPosition === 'TOPNAV') {
14			$( '.menu-top-nav-' + suffix + 'container' ).clone().appendTo( '.nav-secondary .menu' );
15			$( '.before-header' ).addClass('kf-sidemenu-top');
16			$( '#nav_menu-3 > div .menu-top-nav-' + suffix + 'container' ).remove();
17	
18			topMenuPosition = 'HAMBURGER';
19		}	
20	}
21
22	function moveTopMenuToTop() {
23		if (topMenuPosition === 'HAMBURGER') {
24			$( '.menu-top-nav-' + suffix + 'container' ).clone().appendTo( '#nav_menu-3 > div' );
25			$( '.before-header' ).removeClass('kf-sidemenu-top');
26			$( '.nav-secondary .menu .menu-top-nav-' + suffix + 'container' ).remove();
27	
28			topMenuPosition = 'TOPNAV';
29		}
30	}
31	
32	/**
33	 * Add shrink class to header on scroll.
34	 */
35	$( window ).scroll( function () {
36		var scroll = $( window ).scrollTop();
37		var height = $( '.hero-section' ).outerHeight();
38		var header = $( '.before-header' ).outerHeight();
39		if ( scroll >= 40 ) {
40			$( '.site-header' ).addClass( 'shrink' );
41		} else {
42			$( '.site-header' ).removeClass( 'shrink' );
43		}
44	} );
45
46	/*
47	 * Search form toggle.
48	 */
49	$( '.site-header .search-form' ).append( '<a href="javascript:document.getElementsByName(\"s\").focus()" class="search-toggle"></a>' );
50	$( '.site-header .search-toggle' ).on( 'click', function () {
51		$( this ).toggleClass( 'active' );
52		$( '.nav-primary .menu-item' ).fadeToggle();
53		$( '.site-header .search-form input[type="search"]' ).fadeToggle();
54	} );
55
56	/*
57	 * Send icon button enews footer.
58	 */
59	$( '.site-footer .enews form' ).append( '<span class="send-icon"></span>' );
60
61	/*
62	 * Move before header into nav on mobile.
63	 */
64	
65	
66	$( window ).on( "resize", function () {
67        if ( $( window ).width() < 896 ) {
68			moveTopMenuToHamburger();
69		} else {
70			moveTopMenuToTop();
71		}
72	} ).resize();
73    
74	/*
75	 * Object fit fallback
76	 */
77	jQuery( document ).ready( function ( $ ) {
78
79		if ($("body").hasClass("home")) {
80			var video_name = ($( window ).width()>767) ? 'Mater_Olbia_wb_desktpo' : 'MaterOlbia_mobile';
81			//console.log($( window ).width());
82			var video=$('<figure class="wp-block-video alignfull"><video autoplay="" loop="" muted="" src="https://goat.keyformat.it/video/materolbia/'+ video_name +'.mp4" playsinline=""></video></figure>');
83			$('.entry-content').prepend(video);
84		}
85
86        if ( $( window ).width() < 896 ) {
87			moveTopMenuToHamburger();
88		} else {
89			moveTopMenuToTop();
90		}
91        
92		if ( !Modernizr.objectfit ) {
93			$( '.front-page-9' ).each( function () {
94				var $container = $( this ),
95					imgUrl = $container.find( 'img' ).prop( 'src' );
96				if ( imgUrl ) {
97					$container.css( 'backgroundImage', 'url(' + imgUrl + ')' ).addClass( 'no-object-fit' );
98				}
99				$container.find( 'img' ).css( 'display', 'none' );
100			} );
101		}
102
103		var els = $('.kf-loop-hp');
104        var idxToShow = Math.floor(Math.random() * ((els.length - 1) - 0) + 0);
105        els.eq(idxToShow).show();
106
107
108        var accordionOptCommon = {
109            header: '> div.kf-accordion-item > h3',
110            icons: { "header": "ui-icon-caret-1-s", "activeHeader": "ui-icon-caret-1-e" },
111            heightStyle: "content",
112            collapsible: true,
113            active: false
114        };
115
116		$(".kf-accordion").each(function() {
117            var el = $(this);
118			var _accordionOpt = JSON.parse(JSON.stringify(accordionOptCommon));
119
120			if (el.hasClass('kf-prenota')) {
121				_accordionOpt.collapsible = true;
122				_accordionOpt.active = 0;
123			}
124
125            el.accordion(_accordionOpt);
126        });
127        $(".kf-aree-wrap").show();
128
129
130        $('.kf-topnav-ico-search').click(function(e) {
131			e.preventDefault();
132			
133			/*if (/.it\/?$/.test(document.location.href) || /.it\/en\/?$/.test(document.location.href)) { // SIAMO IN HOME
134				window.scrollTo(0, $('#aa-search-input').offset().top - 80);
135			} else { */
136				$('.kfpg-overlay').fadeIn('fast');
137	
138				$('#ajaxsearchlite1').appendTo($('.kfpg-overlay > div.kfpg-overlay-content'));
139				$('div.kfpg-overlay-close').click(function() {
140					$('.kfpg-overlay').fadeOut('fast');
141					$('#ajaxsearchlite1').appendTo($('#search-4 .widget-wrap'));
142				});
143			//}
144        });
145
146		$('#menu-item-4405 a').attr('target', '_blank');
147		
148		var topNavMenuEl = $('#nav_menu-3 ul');
149        topNavMenuEl.superfish();
150	} );
151
152	jQuery(window).on("load", function() {
153
154		$('input[name=privacy]').attr("disabled",true);
155		$('input[name=acceptance-375]').attr("disabled",true);
156		
157
158		$( ".link-3" ).click(function() {
159			$('input[name=privacy]').attr("disabled",false);
160			$('input[name=acceptance-375]').attr("disabled",false);
161		});
162		
163		
164	});
165
166	/*
167	 * Logo slider.
168	 */
169	jQuery( document ).ready( function ( $ ) {
170		$( '.front-page-2 .gallery' ).slick( {
171			dots: false,
172			infinite: true,
173			speed: 1000,
174			arrows: false,
175			autoplay: true,
176			autoplaySpeed: 5000,
177			fade: false,
178			slidesToShow: 2,
179			slidesToScroll: 1,
180			mobileFirst: true,
181			responsive: [ {
182				breakpoint: 384,
183				settings: {
184					slidesToShow: 3,
185				}
186			}, {
187				breakpoint: 768,
188				settings: {
189					slidesToShow: 4,
190				}
191			}, {
192				breakpoint: 896,
193				settings: {
194					slidesToShow: 5,
195				}
196			}, {
197				breakpoint: 1152,
198				settings: {
199					slidesToShow: 6,
200				}
201			} ]
202		} )
203	} );
204
205	/**
206	 * Smooth scrolling.
207	 */
208
209	 // Select all links with hashes
210	$( 'a[href*="#"]' )
211
212	// Remove links that don't actually link to anything
213		.not( '[href="#"]' ).not( '[href="#0"]' )
214
215		// Remove WooCommerce tabs
216		.not( '[href*="#tab-"]' ).click( function ( event ) {
217
218			// On-page links
219			if ( location.pathname.replace( /^\//, '' ) == this.pathname.replace( /^\//, '' ) && location.hostname == this.hostname ) {
220
221				// Figure out element to scroll to
222				var target = $( this.hash );
223				target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' );
224
225				// Does a scroll target exist?
226				if ( target.length ) {
227
228					// Only prevent default if animation is actually gonna happen
229					event.preventDefault();
230					$( 'html, body' ).animate( {
231						scrollTop: target.offset().top
232					}, 1000, function () {
233
234						// Callback after animation, must change focus!
235						var $target = $( target );
236						$target.focus();
237
238						// Checking if the target was focused
239						if ( $target.is( ":focus" ) ) {
240
241							return false;
242						} else {
243
244							// Adding tabindex for elements not focusable
245							$target.attr( 'tabindex', '-1' );
246
247							// Set focus again
248							$target.focus();
249						};
250					} );
251				}
252			}
253		} );
254		
255		window.KF_PRENOTA_CALLBACK = function() {
256			window.scrollTo(0, 440);
257		}
258} )( document, 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.