PageSourceSearch

https://orologopoulos.gr/templates/gk_hotel/js/gk.menu.js

js orologopoulos.gr collected 2026-09-25 09:58:23 UTC 13,044 bytes, 357 lines download raw bytes

1jQuery(document).ready(function() {
2	// Aside menu
3	if(jQuery('#aside-menu').length > 0) {
4		var staticToggler = jQuery('#gkMobileMenu');
5	 
6		staticToggler.click(function() {
7	    	gkOpenAsideMenu();
8		});
9	 
10		jQuery('#close-menu').click( function() {
11	    	gkOpenAsideMenu();
12		});
13		
14		jQuery('#aside-menu').find('a[href^="#"]').click(function() {
15			jQuery('#close-menu').trigger('click');
16		});
17	
18		// detect android browser
19		var ua = navigator.userAgent.toLowerCase();
20		var isAndroid = ua.indexOf("android") > -1 && !window.chrome;
21		if(isAndroid) {
22			jQuery('body').addClass('android-stock-browser');
23		}
24		// Android stock browser fix for the aside menu
25		if(jQuery('body').hasClass('android-stock-browser') && jQuery('#aside-menu').length > 0) {
26			jQuery('#gkMobileMenu').click( function() {
27				window.scrollTo(0, 0);
28			});
29			// menu dimensions
30			var asideMenu = jQuery('#aside-menu');
31			var menuHeight = jQuery('#aside-menu').height();
32			//
33			jQuery(window).scroll( function(e) {
34				if(asideMenu.hasClass('menu-open')) {
35			    	// get the necessary values and positions
36			    	var currentPosition = jQuery(window).scrollTop();
37			    	var windowHeight = jQuery(window).height();
38			
39			    	// compare the values
40			    	if(currentPosition > menuHeight - windowHeight) {
41			        	jQuery('#close-menu').trigger('click');
42			    	}
43				}
44			});
45		}
46		
47		function gkOpenAsideMenu() {
48			jQuery('#gkBg').toggleClass('menu-open');
49			
50			if(jQuery('#aside-menu').hasClass('menu-open')) {
51				setTimeout(function() {
52					jQuery('#aside-menu').removeClass('menu-open');
53					jQuery('#gkBg').removeClass('menu-visible');
54				}, 350);
55			} else {
56				jQuery('#aside-menu').addClass('menu-open');
57				jQuery('#gkBg').addClass('menu-visible');
58			}
59			
60			if(!jQuery('#close-menu').hasClass('menu-open')) {
61				setTimeout(function() {
62			    	jQuery('#close-menu').toggleClass('menu-open');
63				}, 300);
64			} else {
65				jQuery('#close-menu').removeClass('menu-open');
66			}
67		}
68	}
69	
70	// Classic menu
71	if(jQuery('.gkMainMenu').length > 0) {
72		// set the menu config only if it is visible
73        if(jQuery(window).outerWidth() > jQuery(document.body).attr('data-tablet-width')) {
74        	gk_hotel_classic_menu_init();
75        }
76        // evaluate the menu initialization on every window resize
77        jQuery(window).resize(function() {
78        	// it will be evaluated only if it wasn't evaluated earlier
79        	if(jQuery(window).outerWidth() > jQuery(document.body).attr('data-tablet-width')) {
80        		gk_hotel_classic_menu_init();
81        	}
82        });
83        
84        // Overlay menu
85        jQuery('#gkMobileMenu').click(function(e) {
86        	e.preventDefault();
87        	
88        	if(jQuery('#gk-menu-overlay').length === 0) {
89        		var menu_wrap = jQuery('<div id="gk-menu-overlay">&nbsp;</div><div id="gk-menu-overlay-wrap"><span id="gk-menu-overlay-close">&times;</span></div>');
90        		jQuery(document.body).append(menu_wrap);
91        		jQuery('#gk-menu-overlay-wrap').append(jQuery('.gkMainMenu').clone());
92        		
93        		jQuery('#gk-menu-overlay-wrap').click(function(e) {
94        			e.stopPropagation();
95        		});
96        		
97        		jQuery('#gk-menu-overlay-close').click(function() {
98        			jQuery('#gk-menu-overlay').removeClass('gk-active');
99        			jQuery('#gk-menu-overlay-wrap').removeClass('gk-active');
100        			
101        			setTimeout(function() {
102        				jQuery('#gk-menu-overlay').removeClass('gk-show');
103        				jQuery('#gk-menu-overlay-wrap').removeClass('gk-show');	
104        			}, 350);
105        		});
106        		
107        		jQuery('#gk-menu-overlay').click(function() {
108        			jQuery('#gk-menu-overlay-close').trigger('click');
109        		});
110        		
111        		jQuery('#gk-menu-overlay-wrap').find('a[href^="#"]').click(function() {
112        			jQuery('#gk-menu-overlay-close').trigger('click');
113        		});
114        	}
115    		
116    		jQuery('#gk-menu-overlay-wrap').css('top', jQuery(window).scrollTop());
117    		jQuery('#gk-menu-overlay').addClass('gk-show');
118    		jQuery('#gk-menu-overlay').css('height', jQuery('body').outerHeight() + jQuery('#gk-menu-overlay-wrap').outerHeight() + "px");
119    		jQuery('#gk-menu-overlay-wrap').addClass('gk-show');
120    		
121    		setTimeout(function() {
122    			jQuery('#gk-menu-overlay').addClass('gk-active');
123    			jQuery('#gk-menu-overlay-wrap').addClass('gk-active');
124    		}, 50);
125        });
126    }
127    
128    // Fixed menu
129    if(jQuery('#gkHeaderNav').attr('data-fixed') === '1') {
130    	var page_nav = jQuery('#gkHeaderNav');
131    	var prev_scroll_value = 0;
132    	var logo_img = jQuery('#gkLogo').find('img').first();
133    	var image_logo_exists = jQuery('#gkLogo').find('img').length;
134    	var dark_logo_img = logo_img.attr('data-dark');
135    	var light_logo_img = logo_img.attr('data-light');
136    	var dark_bg_class = jQuery(document.body).hasClass('dark-bg');
137    		
138		function menu_scroll() {
139			var new_scroll_value = jQuery(window).scrollTop() >= 0 ? jQuery(window).scrollTop() : 0;	
140			var local_diff = new_scroll_value - prev_scroll_value;
141			var current = parseInt(page_nav.css('top'));
142			var h = 210;
143			
144			if(new_scroll_value >= h) {
145				if(
146					!page_nav.hasClass('gk-fixed-nav')
147				) {
148					page_nav.addClass('gk-fixed-nav');
149					page_nav.css('top', '-250px');
150					current = -250;
151					
152					// Logo switching
153					if(image_logo_exists && dark_logo_img) {
154						logo_img.attr('src', dark_logo_img);
155					}
156				}
157			
158				if(new_scroll_value >= prev_scroll_value) {
159					page_nav.css('top', (current - local_diff >= -250 ? current - local_diff : -250) + "px");
160				} else {
161					page_nav.css('top', (current - local_diff <= 0 ? current - local_diff : 0) + "px");
162				}
163			} else {
164				if(page_nav.hasClass('gk-fixed-nav')) {
165					page_nav.removeClass('gk-fixed-nav');
166					page_nav.css('top', 0);
167					
168					// Logo switching
169					if(image_logo_exists) {
170						if(dark_logo_img && dark_bg_class) {
171							logo_img.attr('src', dark_logo_img);
172						} else {
173							logo_img.attr('src', light_logo_img);
174						}
175					}
176				}
177			}
178			
179			prev_scroll_value = new_scroll_value;
180		}
181		
182		jQuery(window).scroll(menu_scroll);
183    }
184}); 
185
186function gk_hotel_classic_menu_init() {
187	if(!jQuery('.gkMainMenu').attr('data-loaded')) {
188		jQuery('.gkMainMenu').attr('data-loaded', true);
189		// fix for the iOS devices     
190	    jQuery('.gkMainMenu ul li span').each(function(i, el) {
191	        jQuery(el).attr('onmouseover', '');
192	    });
193	
194	    jQuery('.gkMainMenu ul li a').each(function(i, el) {
195	        el = jQuery(el);
196	        el.attr('onmouseover', '');
197	        
198	        if(el.parent().hasClass('haschild') && jQuery('body').attr('data-tablet') !== undefined) {
199	            el.click(function(e) {
200	                if(el.attr("dblclick") === undefined) {
201	                    e.preventDefault();
202	                    e.stopPropagation();
203	                    el.attr("dblclick", new Date().getTime());
204	                } else {
205	                    if(el.parent().find('div.childcontent').eq(0).css('overflow') === 'visible') {
206	                        window.location = el.attr('href');
207	                    }
208	                    var now = new Date().getTime();
209	                    if(now - el.attr("dblclick", 0) < 500) {
210	                        window.location = el.attr('href');
211	                    } else {
212	                       e.preventDefault();
213	                       e.stopPropagation();
214	                       el.attr("dblclick", new Date().getTime());
215	                    }
216	                }
217	            });
218	        }
219	    });
220	
221	    var base = jQuery('.gkMainMenu');
222	
223	    base.find('.childcontent-inner').each(function(i, submenu) {
224	        var cols = jQuery(submenu).children('.gkcol');
225	        
226	        if(cols.length > 1) {
227	            var max = jQuery(cols[0]).outerHeight();
228	            
229	            for(i = 0; i < cols.length; i++) {
230	                max = jQuery(cols[i]).outerHeight() > max ? jQuery(cols[i]).outerHeight() : max;
231	            }
232	            
233	            cols.css('height', max + "px");
234	        }
235	    });
236	    
237	    base.find('li.haschild').each(function(i, el){   
238	        el = jQuery(el);  
239	        if(el.children('.childcontent').length > 0) {
240	            var content = el.children('.childcontent').first();
241	            var prevh = content.outerHeight();
242	            var prevw = content.outerWidth();
243	            var duration = base.attr('data-duration');
244	            var heightAnim = base.attr('data-height') == '1';
245	            var widthAnim = base.attr('data-width') == '1';
246	            var opacityAnim = base.attr('data-opacity') == '1'; 
247	            
248	            if(!opacityAnim && !widthAnim && !heightAnim) {
249	            	duration = 0;
250	            }
251	            
252	            // hide the menu till opened
253	            if(content.parent().parent().hasClass('level0')) {
254	                content.css('margin-left', "-9999px");
255	            }
256	
257	            var fxStart = { 
258	                'height' : heightAnim ? 0 : prevh, 
259	                'width' : widthAnim ? 0 : prevw, 
260	                'opacity' : opacityAnim ? 0 : 1 
261	            };
262	            var fxEnd = { 
263	                'height' : prevh, 
264	                'width' : prevw, 
265	                'opacity' : 1 
266	            };  
267	            
268	            
269	            content.css(fxStart);
270	            content.css({'left' : 'auto', 'overflow' : 'hidden' });
271	            //                      
272	            el.mouseenter(function() {                    
273	                var content = el.children('.childcontent').first();
274	                var basicMargin = (el.parent().hasClass('level0')) ? -1 * ((prevw / 2) - (el.outerWidth() / 2)) : 0;
275	                content.css('display', 'block');
276	            
277	                var pos = content.offset();
278	                var winWidth = jQuery(window).outerWidth();
279	                var winScroll = jQuery(window).scrollLeft();
280	                
281	                // calculations
282	                var posStart = pos.left;
283	                var posEnd = pos.left + prevw;
284	                var diff;
285					
286					content.addClass('active');
287					
288	                if(el.parent().hasClass('level0')) {
289	                    content.css('margin-left', basicMargin + "px");
290	                    pos = content.offset();
291	                    posStart = pos.left;
292	                    posEnd = pos.left + prevw;
293	                    
294	                    if(posStart < 0) {
295	                        content.css('margin-left', parseInt(content.css('margin-left')) + (-1 * posStart) + 10);
296	                    }
297	                    
298	                    if(posEnd > winWidth + winScroll) {
299	                        diff = (winWidth + winScroll) - posEnd;
300	                        content.css('margin-left', parseInt(content.css('margin-left')) + diff - 24);
301	                    }
302	                } else {
303	                    diff = (winWidth + winScroll) - posEnd;
304	                    
305	                    if(posEnd > winWidth + winScroll) {
306	                        content.css('margin-left', diff - 150 + "px");
307	                    }
308	                }
309	                //
310	                content.stop().animate(
311	                    fxEnd, 
312	                    {
313		                    "duration": duration, 
314		                    "queue": false,
315		                    "complete": function() { 
316					                        if(content.outerHeight() === 0){ 
317					                            content.css('overflow', 'hidden'); 
318					                        } else if(
319					                            content.outerHeight(true) - prevh < 30 && 
320					                            content.outerHeight(true) - prevh >= 0
321					                        ) {
322					                            content.css('overflow', 'visible');
323					                        }
324					                    }
325	                    }
326	                );
327	            });
328	            
329	        	el.mouseleave(function(){
330	                content.css({
331	                    'overflow': 'hidden'
332	                });
333	                //
334	                content.stop().animate(
335	                    fxStart, 
336	                    {
337	                        "duration": duration, 
338	                        "queue": false,
339	                        "complete": function() { 
340					                        if(content.outerHeight() === 0){ 
341					                            content.css('overflow', 'hidden'); 
342					                        } else if(
343					                            content.outerHeight(true) - prevh < 30 && 
344					                            content.outerHeight(true) - prevh >= 0
345					                        ) {
346					                            content.css('overflow', 'visible');
347					                        }
348					                        content.removeClass('active');
349					                        content.css('display', 'none');
350					                    }
351					    }
352	                );
353	            });
354	        }
355	    });  
356    }  
357}

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.