PageSourceSearch

https://fishing-v.ru/templates/gk_news/js/gk.menu.js

js fishing-v.ru collected 2026-10-04 23:11:15 UTC 6,256 bytes, 219 lines download raw bytes

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

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.