PageSourceSearch

https://sakh-ohotnik.ru/js/template.js

js sakh-ohotnik.ru collected 2026-10-07 23:38:13 UTC 6,417 bytes, 227 lines download raw bytes

1    $(document).ready(function() {
2	
3	//MOBILE MENU TOOGLE
4	var $window = $(window),
5	    $html = $('html');
6	
7	$window.resize(function resize() {
8	    if ($window.width() < 599) {
9		return $('.nav').addClass('mobile');
10	    }
11	    
12	    $('.nav').removeClass('mobile');
13	}).trigger('resize');
14	
15	var nav = $('.mobile .uMenuV > ul > li, .sidebar .uMenuV > ul > li');
16	nav.find('li').hide();
17	nav.click(function () {
18	    nav.not(this).find('li').hide('slow');
19	    $(this).find('li').slideToggle('slow');
20	});
21	
22	//SLOW ANCHOR
23	$('a[href*=#]').click(function(event){
24	    event.preventDefault();
25	    var target_top= $('a[name="'+this.href.split("#")[1]+'"]').offset().top;
26	    $('html, body').animate({scrollTop:target_top}, 'slow');
27	});
28
29	//TOOGLE MENU
30	$("ul.goods-menu li").click(function() {
31		$("ul.goods-menu li").removeClass("active");
32		$(this).addClass("active");
33	});
34	
35	//PLACEHOLDER
36	$('[placeholder]').focus(function() {
37	    var input = $(this);
38	    if (input.val() == input.attr('placeholder')) {
39		input.val('');
40		input.removeClass('placeholder');
41	    }
42	}).blur(function() {
43	    var input = $(this);
44	    if (input.val() == '' || input.val() == input.attr('placeholder')) {
45		input.addClass('placeholder');
46		input.val(input.attr('placeholder'));
47	    }
48	}).blur().parents('form').submit(function() {
49	    $(this).find('[placeholder]').each(function() {
50		var input = $(this);
51		if (input.val() == input.attr('placeholder')) {
52		    input.val('');
53		}
54	    })
55		});
56	
57	//PARALLAX
58	$(document).ready(function() {
59	    var origheight = $("#parallax").height();
60	    var height = $(window).height();
61	    if (height > origheight) {
62		$("#parallax").height(height);
63	    }
64	    
65	    $(window).scroll(function(){
66		var x = $(this).scrollTop();
67		$('#parallax, #parallax2, #parallax3').css('background-position','center -'+parseInt(x/5)+'px');
68	    });
69	    
70	});
71	
72
73	//DATE VIEW
74	$('.ndate').each(function(){  
75	    date = String($(this).attr('title')).split('.');  
76	    temp_date = new Date();  
77	    day = temp_date.getDate();  
78	    month = temp_date.getMonth() + 1;  
79	    if(month < 10) { month = '0'+month;}  
80	    if(date[0] == 'Вчера'){  
81		date[0] = day-1;  
82		if(date[0] == 0){  
83		    if(month < 10) { temp_date = new Date();  
84				    day = temp_date.getDate()-1;  
85				    month = temp_date.getMonth();  
86				    date[0] = day ;  
87				    date[1] = '0'+month;}}  
88		else {date[1] = month;}  
89	    }  
90	    if(date[0] == 'Сегодня') {  
91		date[1] = month;  
92		date[0] = day;  
93	    }  
94	    mes = '';  
95	    switch(date[1]){  
96		case '01': mes = 'января';  
97		    break;  
98			case '02': mes = 'февраля';  
99		    break;  
100			case '03': mes = 'марта';  
101		    break;  
102			case '04': mes = 'апреля';  
103		    break;  
104			case '05': mes = 'мая';  
105		    break;  
106			case '06': mes = 'июня';  
107		    break;  
108			case '07': mes = 'июля';  
109		    break;  
110			case '08': mes = 'августа';  
111		    break;  
112			case '09': mes = 'сентября';  
113		    break;  
114			case '10': mes = 'октября';  
115		    break;  
116			case '11': mes = 'ноября';  
117		    break;  
118			case '12': mes = 'декабря';  
119		    break;  
120			}
121	    $(this).html('<span class="cou">'+date[0]+'</span> <span class="des">'+mes+'</span>'); 
122	}) 
123	    
124	    });
125
126    
127
128    
129    //ANIMATE COUNTER
130    (function ($) {
131	$.fn.countTo = function (options) {
132	    options = options || {};
133	    
134	    return $(this).each(function () {
135		// set options for current element
136		var settings = $.extend({}, $.fn.countTo.defaults, {
137		    from:            $(this).data('from'),
138		    to:              $(this).data('to'),
139		    speed:           $(this).data('speed'),
140		    refreshInterval: $(this).data('refresh-interval'),
141		    decimals:        $(this).data('decimals')
142		}, options);
143		
144		// how many times to update the value, and how much to increment the value on each update
145		var loops = Math.ceil(settings.speed / settings.refreshInterval),
146		    increment = (settings.to - settings.from) / loops;
147		
148		// references & variables that will change with each update
149		var self = this,
150		    $self = $(this),
151		    loopCount = 0,
152		    value = settings.from,
153		    data = $self.data('countTo') || {};
154		
155		$self.data('countTo', data);
156		
157		// if an existing interval can be found, clear it first
158		if (data.interval) {
159		    clearInterval(data.interval);
160		}
161		data.interval = setInterval(updateTimer, settings.refreshInterval);
162		
163		// initialize the element with the starting value
164		render(value);
165		
166		function updateTimer() {
167		    value += increment;
168		    loopCount++;
169		    
170		    render(value);
171		    
172		    if (typeof(settings.onUpdate) == 'function') {
173			settings.onUpdate.call(self, value);
174		    }
175		    
176		    if (loopCount >= loops) {
177			// remove the interval
178			$self.removeData('countTo');
179			clearInterval(data.interval);
180			value = settings.to;
181			
182			if (typeof(settings.onComplete) == 'function') {
183			    settings.onComplete.call(self, value);
184			}
185		    }
186		}
187		
188		function render(value) {
189		    var formattedValue = settings.formatter.call(self, value, settings);
190		    $self.html(formattedValue);
191		}
192	    });
193	};
194	    
195	    $.fn.countTo.defaults = {
196		from: 0,               // the number the element should start at
197		to: 0,                 // the number the element should end at
198		speed: 1000,           // how long it should take to count between the target numbers
199		refreshInterval: 100,  // how often the element should be updated
200		decimals: 0,           // the number of decimal places to show
201		formatter: formatter,  // handler for formatting the value before rendering
202		onUpdate: null,        // callback method for every time the element is updated
203		onComplete: null       // callback method for when the element finishes updating
204	    };
205	    
206	    function formatter(value, settings) {
207		return value.toFixed(settings.decimals);
208	    }
209	}(jQuery));
210    
211    jQuery(function ($) {
212	// custom formatting example
213	$('#count-number').data('countToOptions', {
214	    formatter: function (value, options) {
215		return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
216	    }
217	});
218	
219	// start all the timers
220	$('.timer').each(count);  
221	
222	function count(options) {
223	    var $this = $(this);
224	    options = $.extend({}, options || {}, $this.data('countToOptions') || {});
225	    $this.countTo(options);
226	}
227    });

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.