PageSourceSearch

https://www.csttropea.it/wp-content/themes/os2/js/fn.js?ver=1790322306

js csttropea.it collected 2026-09-25 07:45:35 UTC 4,308 bytes, 198 lines download raw bytes

1var CommonService = (function(){
2
3	var $ = jQuery.noConflict(),
4		$html = $("html"),
5		$menuicon = $("[icon=menu]"),
6		$menunav = $("header [icon=menu] + nav"),
7		$menuuser = $(".header-links-general"),
8		$menuhassub = $menunav.find("li.menu-item-has-children > a"),
9		$overlay = $(".modal-overlay"),
10		$overlay_clicked = false;
11
12	var GlobalFNs = function(){
13
14		InitMenu();
15		DetectRedirectIE();
16		DetectAppleOS();
17
18	}
19
20	var InitMenu = function(){
21
22		OpenMenu();
23		ToggleOverlay(null,"open-menu");
24		CorrectionMenu();
25		
26		FNOnResize(1001,1000,
27			function(){
28				if( $html.hasClass("open-menu") && !$overlay.is(":visible") )
29					ToggleOverlay(true, "open-menu");
30				
31				OpenSubMenu();
32			},
33			function(){
34				if( $html.hasClass("open-menu") && $overlay.is(":visible") )
35					ToggleOverlay(false, "open-menu");
36				
37				CorrectionMenu();
38			});
39
40	}
41	
42	var OpenMenu = function(){
43
44		$menuicon.click(function(){
45			$html.stop().toggleClass("open-menu");
46			$overlay.stop().fadeToggle(300);
47		});
48		
49	}
50
51	var OpenSubMenu = function(){
52
53		DoubleTapToGo($menuhassub, null, function(e){
54			$(".sub-menu").removeClass("open");
55			$(e.currentTarget).siblings(".sub-menu").stop().addClass("open");
56		});
57
58	}
59
60	var ToggleOverlay = function(force, htmlClassToRemove){
61
62		if(force != null && force != "undefined"){
63			if( force )
64				$overlay.fadeIn();
65			else
66				$overlay.fadeOut();
67		}
68
69		if(!$overlay_clicked){
70			$overlay.click(function(){
71				$(this).fadeToggle();
72				$html.removeClass(htmlClassToRemove);
73			});
74			$overlay_clicked = true;
75		}
76	
77	}
78		
79	var CorrectionMenu = function(){
80		
81		$menunav.find("ul > li > a").each(function(i, e){
82			
83			if( $(e).offset().left > ($(window).outerWidth()/2) )
84				$(e).closest("li").addClass("dx");
85			
86		});	
87
88	}
89
90	var FNOnResize = function(down, up, fn1, fn2){
91
92		var called = ($(window).width() < down) ? true : false;
93
94		($(window).width() < down) ? fn1() : fn2();
95
96		$(window).resize(function () {
97			if (!called && $(window).width() < down) {
98				fn1();
99				called = true;
100			}
101			if (called && $(window).width() > up) {
102				fn2();
103				called = false;
104			}
105		});
106
107	}
108
109	var DynCarousel = function(dyn, down, up){
110
111		var owl = $(".dyn-owl");
112		var owls = function(){
113			if(owl != null){
114				owl.addClass("owl-carousel owl-theme");
115				dyn();
116			}
117		};
118
119		FNOnResize(down,up,
120			function(){
121				owls();
122			},
123			function(){
124				if(owl != null){
125					owl.removeClass("owl-carousel owl-theme");
126					owl.trigger("destroy.owl.carousel");
127				}
128			});
129		
130	}
131
132	var DetectRedirectIE = function(){
133
134		var ie = (!!window.ActiveXObject && +(/msie\s(\d+)/i.exec(navigator.userAgent)[1])) || NaN;
135		if (ie <= 9) {
136			window.location.replace("https://browser-update.org/it/update.html");
137		}
138	
139	}
140	
141	var DetectAppleOS = function(){
142	
143		if (/iPad|iPhone|iPod|Mac OS X/.test(navigator.userAgent) && !window.MSStream){
144			$("html").addClass("ios");
145		}
146	
147	}
148
149	var DoubleTapToGo = function(o, url, fn){
150
151		var delay = 300, clicks = 0, timer = null;
152		o.on("touchstart", function(e){
153			
154			e.preventDefault();
155			
156			if (typeof fn !== "undefined" && fn !== null)
157				fn(e);
158			
159			clicks++;  //count clicks
160			if (clicks === 1) {
161				timer = setTimeout(function () {
162					clicks = 0;             //after action performed, reset counter
163				}, delay);
164			} else {
165				clearTimeout(timer);    //prevent single-click action
166				clicks = 0;             //after action performed, reset counter
167				if (typeof url !== "undefined" && url !== null)
168					location.href = url;
169				else
170					location.href = e.currentTarget.href;
171			}
172		});
173		
174	}
175
176	var ReadMore = function(obj, down, up, openText, closeText){
177
178		var container = obj.addClass("readmore").append("<button class='open button'>" + openText +"</button>");
179		var button = obj.find("button.open");
180		
181		button.on('click', function(e){
182			container.stop().toggleClass("open",400, function(){
183				button.stop().text( container.hasClass("open") ? closeText : openText);
184			});
185		});
186
187	}
188
189	return {
190		GlobalFNs: GlobalFNs,
191		DynCarousel: DynCarousel,
192		ReadMore: ReadMore,
193		FNOnResize: FNOnResize
194	};
195	
196})();
197
198CommonService.GlobalFNs();

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.