PageSourceSearch

https://odgsicilia.it/assets/js/script.js

js odgsicilia.it collected 2026-10-02 13:33:04 UTC 20,504 bytes, 746 lines download raw bytes

1;(function($){
2
3	'use strict';
4
5	$(function(){
6
7		document.addEventListener("touchstart", function() {},false);
8
9		if ('ontouchstart' in document.documentElement) {
10			$('body').css('cursor', 'pointer');
11		}
12
13		/* ------------------------------------------------
14		Socials popup
15		------------------------------------------------ */
16
17		if ($('.social-btn').length){
18
19			$('.wrapper-container').append('<div id="social-popup"><ul class="social-icons share"><li><a href="#" class="sh-facebook"><i class="icon-facebook"></i>Facebook</a></li><li><a href="#" class="sh-twitter"><i class="icon-twitter"></i>Twitter</a></li><li><a href="#" class="sh-google"><i class="icon-gplus-3"></i>Google Plus</a></li><li><a href="#" class="sh-pinterest"><i class="icon-pinterest"></i>Pinterest</a></li></ul></div>');
20
21			var popup_item = $("#social-popup");
22
23			popup_item.fadeOut();
24
25		    $(document).mouseup(function (e) {
26
27			    var container = $("#social-popup");
28			    if (container.has(e.target).length === 0){
29			        container.fadeOut("slow");
30			    }
31
32			});
33
34			$('.social-btn').on('click', function() {
35		      popup_item.fadeIn("slow");
36		      return false;
37		    });
38
39		    $('.close-popup').on('click', function() {
40		      popup_item.fadeOut("slow");
41		    });
42
43		};
44
45		/* ------------------------------------------------
46		Sticky sidebar
47		------------------------------------------------ */
48
49		$(window).on("load resize",function(){
50
51			if ($(window).width() > 992 && $('.sticky-bar').length) {
52
53		        $('.content, .sidebar , #sidebar').theiaStickySidebar({
54			      // Settings
55			      additionalMarginTop: 30
56			    });
57
58		    }
59
60		});
61
62		/* ---------------------------------------------------- */
63		/*	Tribes									    		*/
64		/* ---------------------------------------------------- */
65
66		if ($('.tribe-events-filters').length){
67
68			$('#tribe_events_filters_toggle').on('click', function() {
69				$('.tribe-events-filters').addClass('show-filter');
70			});
71
72			$('#tribe_events_filters_close_filters').on('click', function() {
73				$('.tribe-events-filters').removeClass('show-filter');
74			});
75
76			$('.tribe-events-filters-group-heading').on('click', function() {
77				$(this).parent('.tribe_events_filter_item').toggleClass('active');
78			});
79
80		}
81
82		/* ---------------------------------------------------- */
83		/*	Running stream										*/
84		/* ---------------------------------------------------- */
85
86		$(window).on('load', function(){
87
88			if ($(".str").length) {
89				$('.str').liMarquee();
90			}
91			
92		});
93
94		/* ---------------------------------------------------- */
95		/*	Charts												*/
96		/* ---------------------------------------------------- */
97
98		if ($("#sparkline").length) {
99
100			$("#sparkline").sparkline([25,36,27,39,46,35,16,27,29,25,47,49,41,43,35,25,36,49,36,44,68,79,53,92,126,154,130,143,122,156,151,116,127,112,98,87,80,75,79,75,79,75,73,62,19,4,6,2,5,6,7,9,6,5,6,7,9,15,17,19,21,23,25,35,36,49,36,44,60,53,52,56,51,50,53,52,56,51,26,27,39,45,56,57,59,65,69,75,73,76,89,54,56,42,32,2], {
101			    type: 'line',
102			    disableInteraction: 'true',
103			    lineColor: '#333333',
104			    fillColor: 'transparent',
105			    spotColor: '#00aa1b',
106			    minSpotColor: 'transparent',
107			    maxSpotColor: 'transparent',
108			    highlightSpotColor: 'transparent',
109			    highlightLineColor: 'transparent',
110			    width: '285',
111	    		height: '35',
112	    		normalRangeColor: 'transparent',
113			    spotRadius: 3
114			});
115
116		}
117
118		/* ---------------------------------------------------- */
119		/*	Countdown											*/
120		/* ---------------------------------------------------- */
121
122		$('.countdown').each(function(){
123			var $this = $(this),
124				endDate = $this.data(),
125				until = new Date(
126					endDate.year,
127					endDate.month || 0,
128					endDate.day || 1,
129					endDate.hours || 0,
130					endDate.minutes || 0,
131					endDate.seconds || 0
132				);
133			// initialize
134			$this.countdown({
135				until : until,
136				format : 'dHMS',
137				labels : ['Years', 'Month', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds']
138			});
139		});
140
141	    /* ---------------------------------------------------- */
142        /*	Isotope												*/
143        /* ---------------------------------------------------- */
144
145		$( window ).on('load', function() {
146
147		  	var $container = $('.isotope');
148		    // filter buttons
149		    $('#filters button').on('click', function(){
150		    	var $this = $(this);
151		        // don't proceed if already selected
152		        if ( !$this.hasClass('is-checked') ) {
153		          $this.parents('#options').find('.is-checked').removeClass('is-checked');
154		          $this.addClass('is-checked');
155		        }
156				var selector = $this.attr('data-filter');
157				$container.isotope({  itemSelector: '.item', filter: selector });
158				return false;
159		    });
160
161		    $.mad_core.isotope();
162		     
163		});
164
165		/* ---------------------------------------------------- */
166        /*	Gallery carousel									*/
167        /* ---------------------------------------------------- */
168
169	  	var pageCarousel = $('.owl-carousel');
170
171		if(pageCarousel.length){
172
173			$('.owl-carousel').not('#thumbnails').each(function(){
174	
175				/* Max items counting */
176				var max_items = $(this).data('max-items');
177				var tablet_items = max_items;
178				if(max_items > 1){
179					tablet_items = max_items - 1;
180				}
181				var smart_items = max_items;
182				if(max_items > 3){
183					smart_items = max_items - 2;
184				}
185				var mobile_items = 1;
186
187				var autoplay_carousel = $(this).data('autoplay');
188
189				var center_carousel = $(this).data('center');
190
191				var item_margin = $(this).data('item-margin');
192				
193				/* Install Owl Carousel */
194				$(this).owlCarousel({
195				    smartSpeed : 450,
196				    nav : true,
197				    loop  : true,
198				    autoplay : autoplay_carousel,
199				    center: center_carousel,
200				    navText : false,
201				    margin: item_margin,
202				    lazyLoad: true,
203				    rtl: $.mad_core.SUPPORT.ISRTL ? true : false,
204				    responsiveClass:true,
205				    responsive : {
206				        0:{
207				            items:mobile_items
208				        },
209				        480:{
210				        	items:smart_items
211				        },
212				        768:{
213				            items:tablet_items
214				        },
215				        992:{
216				            items:max_items
217				        }
218				    },
219				    dotsContainer: '#carousel-custom-dots',
220				    dotsClass: '.owl-dot',
221				    dotsEach:true
222				});
223
224				// Call Vars
225    			var owl = $('.owl-carousel');
226
227				$( '.owl-dot' ).on( 'click', function() {
228				  owl.trigger('to.owl.carousel', [$(this).index(), 300]);
229				  $( '.owl-dot' ).removeClass( 'active' );
230				  $(this).addClass( 'active' );
231				})
232
233			});
234
235			if($('#thumbnails').length){
236				$('#thumbnails').each(function(){
237					
238					/* Max items counting */
239					var data = $(this).data();
240					var max_items = $(this).data('max-items');
241					var tablet_items = max_items;
242					if(max_items > 1){
243						tablet_items = max_items - 1;
244					}
245					var mobile_items = 1;
246
247					var autoplay_carousel = $(this).data('autoplay');
248					
249					$(this).owlCarousel({
250						items : max_items,
251						URLhashListener : false,
252						navSpeed : 800,
253						nav : false,
254						nav : true,
255						loop : true,
256						margin: 10,
257						rtl: $.mad_core.SUPPORT.ISRTL ? true : false,
258						navText:false,
259						responsive : {
260					        0:{
261					            items:tablet_items
262					        },
263					        481:{
264					            items:max_items
265					        },
266					        1200:{
267					            items:max_items
268					        }
269					    }
270				    });
271				});
272			    
273			}
274
275		}
276
277		/* ---------------------------------------------------- */
278		/*	Elevate zoom										*/
279		/* ---------------------------------------------------- */
280
281		if($('[data-zoom-image]').length){
282
283			var button = $('.qv-preview');
284
285			$("#zoom-image").elevateZoom({
286				gallery:'thumbnails',
287				galleryActiveClass: 'active',
288				zoomType: "inner",
289				cursor: "crosshair",
290				responsive:true,
291			    zoomWindowFadeIn: 500,
292				zoomWindowFadeOut: 500,
293				easing:true,
294				lensFadeIn: 500,
295				lensFadeOut: 500
296			});
297
298		}
299
300		/* ---------------------------------------------------- */
301        /*	Custom Select										*/
302        /* ---------------------------------------------------- */
303
304		if ($('.custom-select').length) {
305			$('.custom-select').madCustomSelect();
306		}
307
308		/* ---------------------------------------------------- */
309        /*	Tabs												*/
310        /* ---------------------------------------------------- */
311
312        $(window).on("load",function(){
313
314        	var tabs = $('.tabs-section');
315			if(tabs.length){
316				tabs.tabs({
317					beforeActivate: function(event, ui) {
318				        var hash = ui.newTab.children("li a").attr("href");
319				   	},
320					hide : {
321						effect : "fadeOut",
322						duration : 450
323					},
324					show : {
325						effect : "fadeIn",
326						duration : 450
327					},
328					updateHash : false
329				});
330			}
331
332        });
333
334		/* ---------------------------------------------------- */
335        /*	Newsletter											*/
336        /* ---------------------------------------------------- */
337
338	    var subscribe = $('[id^="newsletter"]');
339	      subscribe.append('<div class="message-container-subscribe"></div>');
340	      var message = $('.message-container-subscribe'),text;
341
342	      subscribe.on('submit',function(e){
343	        var self = $(this);
344	        
345	        if(self.find('input[type="email"]').val() === ''){
346	          text = "Inserisci indirizzo email!";
347	          message.html('<div class="alert-box warning"><p>'+text+'</p></div>')
348	            .slideDown()
349	            .delay(4000)
350	            .slideUp(function(){
351	              $(this).html("");
352	            });
353
354	        }else{
355	          self.find('span.error').hide();
356	          $.ajax({
357	            type: "POST",
358	            url: "bat/newsletter.php",
359	            data: self.serialize(), 
360	            success: function(data){
361	              if(data === '1'){
362	                text = "Your email has been sent successfully!";
363	                message.html('<div class="alert-box success"><p>'+text+'</p></div>')
364	                  .slideDown()
365	                  .delay(4000)
366	                  .slideUp(function(){
367	                    $(this).html("");
368	                  })
369	                  .prevAll('input[type="email"]').val("");
370	              }else{
371	                text = "Invalid email address!";
372	                message.html('<div class="alert-box error"></i><p>'+text+'</p></div>')
373	                  .slideDown()
374	                  .delay(4000)
375	                  .slideUp(function(){
376	                    $(this).html("");
377	                  });
378	              }
379	            }
380	          });
381	        }
382	        e.preventDefault();
383	    });
384
385		/* ---------------------------------------------------- */
386        /*	Loader												*/
387        /* ---------------------------------------------------- */
388
389		if($('.loader').length){
390
391        	$("body").queryLoader2({
392		        backgroundColor: '#fff',
393		        barColor : '#1e46a5',
394		        barHeight: 4,
395		        deepSearch:true,
396		        minimumTime:1000,
397		        onComplete: function(){
398		        	$(".loader").fadeOut('200');
399		        }
400	      	});
401
402        }
403
404		/* ---------------------------------------------------- */
405        /*	Sticky menu											*/
406        /* ---------------------------------------------------- */
407
408		$('body').Temp({
409			sticky: true
410		});
411
412		/* ------------------------------------------------
413		Instagram Feed
414		------------------------------------------------ */
415
416	    if($('.instagram-feed').length){
417
418	    	$('#instafeed').each(function(){
419
420	    		var insta_items = $(this).data('instagram');
421
422	    		var feed = new Instafeed({
423			      target: 'instafeed',
424			      tagName: 'living',
425			      limit: insta_items,
426			      get: 'user',
427			      userId: 3067565993,
428			      accessToken: '3067565993.1677ed0.4fbaf898eea744519229e245845e9b98',
429			      resolution: 'standard_resolution',
430			      clientId: '679b01f9f2fb4bfebd6b8eebbf2e787a',
431			      template: '<li class="nv-instafeed-item"><a class="fancybox nv-lightbox" data-fancybox="instagram" href="{{image}}" title="{{location}}"><img src="{{image}}" /></a></li>',
432			      after: function(){
433			       $('#' + this.options.target).find('.fancybox').fancybox();
434			      }
435			    });
436			      
437			    feed.run();
438
439	    	});
440
441	    }
442
443	    if($('.instagram-carousel').length){
444
445	    	$('#instafeed').each(function(){
446
447	    		var feed = new Instafeed({
448			      target: 'instafeed',
449			      tagName: 'living',
450			      limit: 6,
451			      get: 'user',
452			      userId: 3067565993,
453			      accessToken: '3067565993.1677ed0.4fbaf898eea744519229e245845e9b98',
454			      resolution: 'standard_resolution',
455			      clientId: '679b01f9f2fb4bfebd6b8eebbf2e787a',
456			      template: '<div class="nv-instafeed-item"><a href="{{image}}" title="{{location}}" data-fancybox="instagram"><img src="{{image}}" /></a></div>',
457			        after: function() {
458				        $('#instafeed').addClass('owl-carousel').owlCarousel({
459				            items: 1,
460				            nav : false,
461				            dots: true,
462						    loop  : true,
463						    autoplay : true,
464						    navText: false
465				        });
466				    }
467			    });
468			      
469			    feed.run();
470
471	    	});
472
473	    }
474
475	    /* ------------------------------------------------
476		Twitter Feed
477		------------------------------------------------ */
478
479	    if($("#twitter").length){
480
481			var twitter_items = $(this).attr('data-twitter-items');
482
483    		$('#twitter').tweet({
484
485			    modpath: 'plugins/twitter/',
486			    username: "odgsicilia",
487			    template: "{text}{time}<div class='tweet-action'>{reply_action}{retweet_action}{favorite_action}</div>",
488			    count: twitter_items,
489			    loading_text: 'loading twitter feed...'
490			    /* etc... */
491
492			});
493
494		}
495		
496		/* ---------------------------------------------------- */
497        /*	Price Scale										    */
498        /* ---------------------------------------------------- */
499
500		var slider;
501		if($('#price').length){
502			slider = $('#price').slider({ 
503		 		animate: true,
504				range: true,
505				values: [ 1, 99],
506				min: 0,
507				max: 100,
508				slide : function(event ,ui){
509					$('.range-values').find('.first-limit').val('$' + ui.values[0] + ',000');
510					$('.range-values').find('.last-limit').val('$' + ui.values[1] + ',000');
511				}
512			});
513		}
514
515		/* ---------------------------------------------------- */
516        /*	Accordion & Toggle									*/
517        /* ---------------------------------------------------- */
518
519		var aItem = $('.accordion:not(.toggle) .accordion-item'),
520			link = aItem.find('.a-title'),
521			$label = aItem.find('label'),
522			aToggleItem = $('.accordion.toggle .accordion-item'),
523			tLink = aToggleItem.find('.a-title');
524
525			aItem.add(aToggleItem).children('.a-title').not('.active').next().hide();
526
527		function triggerAccordeon($item) {
528			$item
529			.addClass('active')
530			.next().stop().slideDown()
531			.parent().siblings()
532			.children('.a-title')
533			.removeClass('active')
534			.next().stop().slideUp();
535		}
536
537
538		if ($label.length) {
539			$label.on('click',function(){
540				triggerAccordeon($(this).closest('.a-title'))
541			});
542		} else {
543			link.on('click',function(){
544				triggerAccordeon($(this))
545			});
546		}
547
548		tLink.on('click',function(){
549			$(this).toggleClass('active')
550			.next().stop().slideToggle();
551
552		});
553
554		/* ---------------------------------------------------- */
555        /*	Quantity											*/
556        /* ---------------------------------------------------- */
557
558		var q = $('.quantity');
559
560		q.each(function(){
561			var $this = $(this),
562				button = $this.children('button'),
563				input = $this.children('input[type="text"]'),
564				val = +input.val();
565
566			button.on('click',function(){
567				if($(this).hasClass('qty-minus')){
568					if(val === 1) return false;
569					input.val(--val);
570				}
571				else{
572					input.val(++val);
573				}
574			});
575		});
576
577		/* ---------------------------------------------------- */
578        /*	Contact Form										*/
579        /* ---------------------------------------------------- */
580
581		if ($('#contact-form').length){
582
583			var cf = $('#contact-form');
584			cf.append('<div class="message-container"></div>');
585
586			cf.on("submit",function(event){
587
588				var self = $(this),text;
589
590				var request = $.ajax({
591					url  : "bat/mail.php",
592					type : "POST",
593					data : self.serialize()
594				});
595
596				request.then(function(data){
597					if(data === "1"){
598
599						text = "Abbiamo ricevuto il tuo messaggio, ti risponderemo nel più breve tempo possibile, Grazie!";
600
601						cf.find('input:not([type="submit"]),textarea').val('');
602
603						$('.message-container').html('<div class="alert-success"><p>'+text+'</p></div>')
604							.delay(150)
605							.slideDown(300)
606							.delay(4000)
607							.slideUp(300,function(){
608								$(this).html("");
609							});
610
611					}
612					else{
613						if(cf.find('textarea').val().length < 20){
614							text = "Il messaggio deve essere superiore a 20 caratteri!"
615						}
616						if(cf.find('textarea').val().length < 20){
617							text = "Il messaggio deve essere superiore a 20 caratteri!"
618						}
619						if(cf.find('select').val() === ""){
620							text = "Seleziona un ufficio!";
621						}
622					
623						$('.message-container').html('<div class="alert-error"><p>'+text+'</p></div>')
624							.delay(150)
625							.slideDown(300)
626							.delay(4000)
627							.slideUp(300,function(){
628								$(this).html("");
629							});
630					}
631				},function(){
632					$('.message-container').html('<div class="alert-error"><p>Si è verificato un errore riprova più tardi!</p></div>')
633					.delay(150)
634					.slideDown(300)
635					.delay(4000)
636					.slideUp(300,function(){
637						$(this).html("");
638					});
639				});
640
641				event.preventDefault();
642
643			});
644
645		}
646
647		/* ---------------------------------------------------- */
648		/*	Google Maps											*/
649		/* ---------------------------------------------------- */
650
651		if ($('#googleMap').length) {
652
653			$(document).ready(function() {
654
655				var myCenter = new google.maps.LatLng(38.132050,13.327650);
656
657				function loadMap() {
658				  	var mapProp = {
659					    center: myCenter,
660					    zoom:11,
661					    mapTypeId:google.maps.MapTypeId.ROADMAP
662					};
663
664					var map = document.getElementById('googleMap');
665
666					if(map !== null){
667
668				    	var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);
669
670					}
671
672		            var marker = new google.maps.Marker({
673		               	position:myCenter,
674		               	map: map
675		            });
676		            
677		            marker.setMap(map);
678
679		            //Zoom to 7 when clicked on marker
680		            google.maps.event.addListener(marker,'click',function() {
681		               map.setZoom(9);
682		               map.setCenter(marker.getPosition());
683		            });
684
685				}
686				google.maps.event.addDomListener(window, 'load', loadMap);
687
688			});
689			
690		}
691
692		if ($('#googleMap2').length) {
693
694			$(document).ready(function() {
695
696				function loadMap() {
697				  	var mapProp = {
698					    center: {lat: 38.132050, lng: 13.327650},
699					    zoom:15,
700					    mapTypeId:google.maps.MapTypeId.ROADMAP
701					};
702
703					var map = document.getElementById('googleMap2');
704
705					if(map !== null){
706
707				    	var map = new google.maps.Map(document.getElementById("googleMap2"),mapProp);
708
709					}
710		            
711		            setMarkers(map);
712
713				}
714				var marks = [
715				  ['first', 38.132050,13.327650],
716				  ['second', 38.132050,13.327650],
717				  ['third', 38.132050,13.327650]
718				];
719
720	            function setMarkers(map) {
721
722					for (var i = 0; i < marks.length; i++) {
723						var mark = marks[i];
724						var marker = new google.maps.Marker({
725						  position: {lat: mark[1], lng: mark[2]},
726						  map: map,
727						  icon: 'images/map_marker.png',
728						  title: mark[0],
729						  zIndex: mark[3]
730						});
731					}
732				}
733				google.maps.event.addDomListener(window, 'load', loadMap);
734
735			});
736			
737		}
738
739	});
740
741})(jQuery);
742
743
744
745
746

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.