PageSourceSearch

https://ando.nl/templates/gk_john_s/js/gk.menu.js

js ando.nl collected 2026-10-10 01:52:45 UTC 6,461 bytes, 207 lines download raw bytes

1jQuery(document).ready(function() {
2	if(jQuery('#gkExtraMenu')) {
3	        // fix for the iOS devices     
4	        jQuery('#gkExtraMenu ul li span').each(function(el) {
5	            el.attr('onmouseover', '');
6	        });
7	
8	        jQuery('#gkExtraMenu ul li a').each(function(el) {
9	            el = jQuery(el);
10	            el.attr('onmouseover', '');
11	
12	            if(el.parent().hasClass('haschild') && jQuery('body').attr('data-tablet') !== undefined) {
13	                el.click(function(e) {
14	                    if(el.attr("dblclick") == undefined) {
15	                        e.preventDefault();
16	                        e.stopPropagation();
17	                        el.attr("dblclick", new Date().getTime());
18	                    } else {
19	                    	if(el.parent().find('div.childcontent').eq(0).css('overflow') == 'visible') {
20	    	 					window.location = el.attr('href');
21	 	                    }
22	                        var now = new Date().getTime();
23	                        if(now - attr("dblclick", 0) < 500) {
24	                            window.location = el.attr('href');
25	                        } else {
26	                           e.preventDefault();
27	                           e.stopPropagation();
28	                           el.attr("dblclick", new Date().getTime());
29	                        }
30	                    }
31	                });
32	            }
33	        });
34	
35	        var base = jQuery('#gkExtraMenu');
36
37	        if($GKMenu && ($GKMenu.height || $GKMenu.width)) {    
38	      	  	 
39	            base.find('li.haschild').each(function(i, el){   
40	            	el = jQuery(el);  
41	               
42	                if(el.children('.childcontent').length > 0) {
43	                    var content = el.children('.childcontent').first();
44	                    var prevh = content.height();
45	                    var prevw = content.width();
46						var duration = $GKMenu.duration;
47						var heightAnim = $GKMenu.height;
48						var widthAnim = $GKMenu.width;
49						
50
51	                    var fxStart = { 
52							'height' : heightAnim ? 0 : prevh, 
53							'width' : widthAnim ? 0 : prevw, 
54							'opacity' : 0 
55						};
56						var fxEnd = { 
57							'height' : prevh, 
58							'width' : prevw, 
59							'opacity' : 1 
60						};	
61						
62						
63	                    content.css(fxStart);
64	                    content.css({'left' : 'auto', 'overflow' : 'hidden' });
65												
66	                    el.mouseenter(function(){
67                    			                    
68                            var content = el.children('.childcontent').first();
69                            content.css('display', 'block');
70							
71							if(content.attr('data-base-margin') != null) {
72								content.css({
73									'margin-left': content.attr('data-base-margin') + "px"
74								});
75							}
76								
77							var pos = content.offset();
78							var winWidth = jQuery(window).outerWidth();
79							var winScroll = jQuery(window).scrollLeft();
80							
81							content.addClass('active');
82							
83							if(pos.left + prevw > (winWidth + winScroll)) {
84								var diff = (winWidth + winScroll) - (pos.left + prevw) - 5;
85								var base = parseInt(content.css('margin-left'));
86								var margin = base + diff;
87								
88								if(base > 0) {
89									margin = -prevw + 10;	
90								}
91								content.css('margin-left', margin + "px");
92								
93								if(content.attr('data-base-margin') == null) {
94									content.attr('data-base-margin', base);
95								}
96							}
97							//
98							content.animate(
99								fxEnd, 
100								duration, 
101								function() { 
102									if(content.outerHeight() == 0){ 
103										content.css('overflow', 'hidden'); 
104									} else if(
105										content.outerHeight(true) - prevh < 30 && 
106										content.outerHeight(true) - prevh >= 0
107									) {
108										content.css('overflow', 'visible');
109									}
110								}
111							);
112						});
113					el.mouseleave(function(){
114					
115							content.css({
116								'overflow': 'hidden'
117							});
118							//
119							content.animate(
120								fxStart, 
121								duration, 
122								function() { 
123									if(content.outerHeight() == 0){ 
124										content.css('overflow', 'hidden'); 
125									} else if(
126										content.outerHeight(true) - prevh < 30 && 
127										content.outerHeight(true) - prevh >= 0
128									) {
129										content.css('overflow', 'visible');
130									}
131									content.removeClass('active');
132									content.css('display', 'none');
133								}
134							);
135						});
136					}
137				});
138	            
139	            base.find('li.haschild').each(function(i, el) {
140					el = jQuery(el);
141					content = jQuery(el.children('.childcontent').first());
142					content.css({ 'display': 'none' });
143				});       
144	        }
145	}
146	// Aside menu
147	if(jQuery('#gkAsideMenu').length) {
148			
149		jQuery('#aside-menu-toggler').click(function() {
150			gkOpenAsideMenu();
151		});
152		
153		jQuery('#close-menu').click(function() {
154			jQuery('#close-menu').toggleClass('menu-open');
155			jQuery('#gkBg').toggleClass('menu-open');
156			jQuery('#aside-menu').toggleClass('menu-open');
157		});
158
159		jQuery('#aside-menu').find('a[href^="#"]').click(function() {
160        	jQuery('#close-menu').trigger('click');
161        });
162		
163	}
164	// detect android browser
165	var ua = navigator.userAgent.toLowerCase();
166	var isAndroid = ua.indexOf("android") > -1 && !window.chrome;
167	
168	if(isAndroid) {
169		jQuery(document.body).addClass('android-stock-browser')
170	}
171	
172	// Android stock browser fix for the aside menu
173	if(jQuery(document.body).hasClass('android-stock-browser') && jQuery('#aside-menu').length) {
174		jQuery('#aside-menu-toggler').click(function() {
175			window.scrollTo(0, 0);
176		});
177		// menu dimensions
178		var asideMenu = jQuery('#aside-menu');
179		var menuHeight = jQuery('#aside-menu').outerHeight();
180		//
181		window.scroll(function(e) {
182			if(asideMenu.hasClass('menu-open')) {
183	    		// get the necessary values and positions
184	    		var currentPosition = jQuery(window).scrollTop();
185	    		var windowHeight = jQuery(window).height();
186	    		
187				// compare the values
188	    		if(currentPosition > menuHeight - windowHeight) {
189	    			jQuery('#close-menu').trigger('click');
190	    		}
191			}
192		});
193	}
194});
195
196function gkOpenAsideMenu() {
197	jQuery('#gkBg').toggleClass('menu-open');
198	jQuery('#aside-menu').toggleClass('menu-open');
199	
200	if(!jQuery('#close-menu').hasClass('menu-open')) {
201		setTimeout(function() {
202			jQuery('#close-menu').toggleClass('menu-open');
203		}, 300);
204	} else {
205		jQuery('#close-menu').removeClass('menu-open');
206	}
207}

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.