PageSourceSearch

https://arenarussia.ru/js/big_map.js?999999914

js arenarussia.ru collected 2026-10-04 20:53:01 UTC 32,269 bytes, 851 lines download raw bytes

1$(document).ready(function() {
2	if ($('.big_map').size() > 0) {
3		big_map.init();
4	}
5});
6
7var big_map = {
8	markers: [],
9	visibles: 0,
10	userAction: true,
11	showAll: false,
12	init: function() {
13		big_map.resize();
14		$(window).resize(function() {
15			big_map.resize();
16		});
17		ymaps.ready(function() {
18			big_map.ymap_init($('.big_map_container'));
19		});
20	},
21	resize: function() {
22		var h = Math.min(Math.max($(window).height() - $('.big_map_wrap').offset().top, 300), 820);
23		big_map.scrollHeight = h * 0.87 - 40;
24		$('.big_map_container').height(h);
25		$('.big_map_wrap .scroll:visible').each(function() {
26			big_map.scroll_init($(this));
27		});
28	},
29	ymap_init: function(container) {
30		var center_zoom = big_map.get_center_zoom();
31		big_map.map = new ymaps.Map(
32			container.attr('id'),
33			{
34				center: center_zoom.center,
35				zoom: center_zoom.zoom,
36				behaviors: ['default'],
37				controls: ['typeSelector', 'fullscreenControl', 'zoomControl']
38			},
39			{
40				searchControlProvider: 'yandex#search'
41			}
42		);
43		if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
44		    big_map.map.behaviors.disable('drag');
45		}
46		// big_map.map.behaviors.disable('scrollZoom');
47		big_map.map.events.add('click', function(e) {
48			big_map.map.balloon.close();
49			$('.balloon .close').click();
50		});
51		big_map.map.events.add('boundschange', function(e) {
52			if (!big_map.userAction) {
53				if (e.get('newZoom') != e.get('oldZoom')) {
54					big_map.set_markers(null, null, true);
55				}
56			}
57			big_map.userAction = false;
58		});
59		if (typeof(add_map_points) != 'undefined') {
60			big_map.fill_data();
61		}
62		$(document).on('click', '.big_map_cities .item', function() {
63			big_map.userAction = true;
64			var opt = $('.big_map_cities').find('[data-city="' + $(this).attr('data-city') + '"]');
65			if (opt.attr('uniqid')) {
66				big_map.show_info($(this).attr('data-city'), opt.attr('uniqid'));
67			}
68			else {
69				big_map.show_info($(this).attr('data-city'));
70			}
71		});
72		$(document).on('click', '.big_map_shops .shop', function() {
73			big_map.show_info($(this).data('city'), $(this).data('shop'));
74			$('html, body').animate({
75				scrollTop:0
76			})
77			// if ($(this).hasClass('visible')) {
78			// 	var opt = $('.big_map_cities').find('[data-city="' + $(this).attr('data-city') + '"]');
79			// 	if (opt.attr('uniqid')) {
80			// 		big_map.show_info(big_map.cityID, opt.attr('uniqid'));
81			// 	}
82			// 	else {
83			// 		big_map.userAction = true;
84			// 		var ind = $('.big_map_shops .shop').index($(this));
85			// 		var marker = big_map.markers[ind];
86			// 		big_map.map.setCenter(marker.geometry.getCoordinates(), big_map.map.getZoom(), {
87			// 			useMapMargin: true
88			// 		});
89			// 		marker.balloon.open();
90			// 	}
91			// }
92		});
93		$(document).on('click', '.big_map_wrap .collapse_lnk, .big_map_wrap .layer .title', function() {
94			$(this).closest('.layer').toggleClass('collapsed');
95			big_map.scroll_init($(this).closest('.layer').find('.scroll'));
96		});
97		$(document).on('click', '.big_map_shop .back_lnk', function() {
98			big_map.userAction = true;
99			var opt = $('.big_map_cities').find('[data-city="' + big_map.cityID + '"]');
100			if (opt.attr('uniqid')) {
101				big_map.show_info(null);
102			}
103			else {
104				big_map.show_info(big_map.cityID);
105			}
106		});
107		$(document).on('click', '.big_map_shop .but_print', function() {
108			big_map.print_shop();
109		});
110		$(document).on('click', '.big_map_shop .route_icon', function() {
111			big_map.user_position();
112		});
113		$(document).on('focus', '.big_map_shop .route input[name=address]', function() {
114			$('.big_map_shop .route_msg').html('');
115		});
116		$(document).on('submit', '.big_map_shop .route', function(e) {
117			e.preventDefault();
118			big_map.create_route();
119			return false;
120		});
121		$('.big_map_wrap .scroll').bind('scroll mousewheel DOMMouseScroll', function(e) {
122			e.stopPropagation();
123			var scroll = $(this);
124			var h = scroll.outerHeight() - scroll.find('.scroll_content').outerHeight();
125			e.delta = null;
126			if (e.originalEvent) {
127				if (e.originalEvent.wheelDelta) e.delta = e.originalEvent.wheelDelta / -40;
128				if (e.originalEvent.deltaY) e.delta = e.originalEvent.deltaY;
129				if (e.originalEvent.detail) e.delta = e.originalEvent.detail;
130			}
131			if ($(this).find('.jspPane').position().top <= h && e.delta > 0 || $(this).find('.jspPane').position().top == 0 && e.delta <= 0) {
132				e.preventDefault();
133				return false;
134			}
135		});
136
137		var opt = $('.big_map_cities').find('[data-city="' + big_map.cityID + '"]');
138		if (opt.attr('uniqid')) {
139			big_map.show_info(big_map.cityID, opt.attr('uniqid'));
140		}
141		else {
142			big_map.show_info(big_map.cityID, big_map.shopID);
143		}
144		window.onpopstate = function(event) {
145			window.location = window.location.pathname;
146		};
147		$('.but').each(function() {
148			if($('.big_map_shop .shop').attr('data-shop') == $(this).parent().attr('data-shop')) {
149				$(this).hide();
150			}
151		})
152	},
153	get_center_zoom: function() {
154		var markers = [], xmin = 9999, xmax = -9999, ymin = 9999, ymax = -9999, c = 0, a = 0;
155		for (var i in add_map_points) {
156			if (big_map.cityID != null && typeof(big_map.cityID) != 'undefined' && add_map_points[i].city == big_map.cityID || big_map.cityID == null || typeof(big_map.cityID) == 'undefined') {
157				var coords = add_map_points[i].coords.split(',');
158				coords = [parseFloat(coords[0]), parseFloat(coords[1])];
159				if (coords[0] > ymax) {
160					ymax = coords[0];
161				}
162				if (coords[0] < ymin) {
163					ymin = coords[0];
164				}
165				if (coords[1] > xmax) {
166					xmax = coords[1];
167				}
168				if (coords[1] < xmin) {
169					xmin = coords[1];
170				}
171				c ++;
172			}
173			a ++;
174		}
175		var z = 16, o = 0;
176		if (c == 2) {
177			z = 12;
178		}
179		else if (c > 2 && c <= 15) {
180			z = 10;
181		}
182		else if (c > 15) {
183			z = 4;
184		}
185		var ox = c < a ? 274 / Math.pow(2, z) : 0;
186		var oy = c == a ? 36 / Math.pow(2, z) : 0;
187		return {'center': c > 1 ? [(ymax + ymin) / 2 + oy, (xmax + xmin) / 2 - ox] : [ymin + oy, xmin - ox], 'zoom': z};
188	},
189	fill_data: function() {
190		big_map.markers = [];
191		$('.big_map_shops .scroll_content').html('');
192		var html = '<div class="hiddable">';
193		var massive_add_map_points  = Object.entries(add_map_points)
194		function SortArray(x, y){
195			if (x[1].metro)
196				return  y[1].metro ? x[1].metro[0].localeCompare(y[1].metro[0]) : -1;
197			else if (y[1].metro)
198				return x[1].metro ? y[1].metro[0].localeCompare(x[1].metro[0]) : 1;
199		}
200		const filtered_add_map_points = massive_add_map_points.sort(SortArray)
201
202    console.log(filtered_add_map_points)
203		filtered_add_map_points.map(el=> {
204			var balloonLayout = ymaps.templateLayoutFactory.createClass(
205				'<div class="balloon">' +
206					'<div class="close"></div>' +
207					'<div class="arrow"></div>' +
208					'$[[options.contentLayout observeSize minWidth=340 maxWidth=340 maxHeight=380]]' +
209				'</div>', {
210					build: function () {
211						this.constructor.superclass.build.call(this);
212						this._$element = $('.balloon', this.getParentElement());
213						this.applyElementOffset();
214						this._$element.find('.close').on('click', $.proxy(this.onCloseClick, this));
215						// this._$element.find('.but').on('click', $.proxy(this.onButtonMoreClick, this));
216						// var elem = this._$element;
217						// $('.but').on("click touch", function () {
218						// 	console.log(1)
219						// 	if (!$('.big_map_shop').is(':visible') || $('.big_map_shop .shop').attr('data-shop') != elem.find('.buttons').attr('data-shop')) {
220						// 		big_map.userAction = true;
221						// 		big_map.show_info(elem.find('.buttons').attr('data-city'), elem.find('.buttons').attr('data-shop'));
222						// 	}
223						// });
224						// $('.buttons').on("click touch", function () {
225						// 	console.log(2)
226						// 	if (!$('.big_map_shop').is(':visible') || $('.big_map_shop .shop').attr('data-shop') != elem.find('.buttons').attr('data-shop')) {
227						// 		big_map.userAction = true;
228						// 		big_map.show_info(elem.find('.buttons').attr('data-city'), elem.find('.buttons').attr('data-shop'));
229						// 	}
230						// });
231
232					},
233					clear: function () {
234						this._$element.find('.close').off('click');
235						this.constructor.superclass.clear.call(this);
236					},
237					onSublayoutSizeChange: function () {
238						balloonLayout.superclass.onSublayoutSizeChange.apply(this, arguments);
239						if(!this._isElement(this._$element)) {
240							return;
241						}
242						this.applyElementOffset();
243						this.events.fire('shapechange');
244					},
245					applyElementOffset: function () {
246						this._$element.css({
247							left: -(this._$element[0].offsetWidth / 2),
248							top: -(this._$element[0].offsetHeight + this._$element.find('.arrow')[0].offsetHeight)
249						});
250					},
251					getShape: function () {
252						if(!this._isElement(this._$element)) {
253							return balloonLayout.superclass.getShape.call(this);
254						}
255						var position = this._$element.position();
256						return new ymaps.shape.Rectangle(new ymaps.geometry.pixel.Rectangle([
257							[position.left, position.top], [
258								position.left + this._$element[0].offsetWidth,
259								position.top + this._$element[0].offsetHeight + this._$element.find('.arrow')[0].offsetHeight
260							]
261						]));
262					},
263					_isElement: function (element) {
264						return element && element[0] && element.find('.arrow')[0];
265					},
266					onCloseClick: function (e) {
267						e.preventDefault();
268						this.events.fire('userclose');
269					},
270					onButtonMoreClick: function (e) {
271						e.preventDefault();
272						if (!$('.big_map_shop').is(':visible') || $('.big_map_shop .shop').attr('data-shop') != this._$element.find('.buttons').attr('data-shop')) {
273
274							big_map.userAction = true;
275							big_map.show_info(this._$element.find('.buttons').attr('data-city'), this._$element.find('.buttons').attr('data-shop'));
276						}
277					}
278				});
279			var balloonContentLayout = ymaps.templateLayoutFactory.createClass(
280				'$[properties.balloonContent]'
281			);
282			var balloonContent = big_map.short_shop_content(el[0], true);
283			var marker_img = '/img/map_point.png';
284			if(el[1].status){
285				if(['zakrit_na_karantin','zakrit_na_pereezd','zakrit_po_tehnicheskim_prichinam'].indexOf(el[1].status.code)!='-1'){
286					marker_img = '/img/map_point_red.png';
287				}else if(['punkt_vidachi_zakazov','internet_magazin','distantsionnaya_prodazha'].indexOf(el[1].status.code)!='-1'){
288					marker_img = '/img/map_point_green.png';
289				}
290			}
291			var marker = new ymaps.Placemark(
292				el[1].coords.split(','),
293				{
294					balloonContent: balloonContent
295				},
296				{
297					id: el[0],
298					city: el[1].city,
299					iconLayout: 'default#image',
300					iconImageHref: marker_img,
301					iconImageSize: [44,49],
302					iconImageOffset: [-20, -49],
303					balloonShadow: false,
304					balloonLayout: balloonLayout,
305					balloonContentLayout: balloonContentLayout,
306					hideIconOnBalloonOpen: false,
307					balloonOffset: [3, -68],
308					visible: true
309				}
310			);
311			big_map.markers.push(marker);
312			html += big_map.short_shop_content(el[0], false);
313		})
314		html += '</div>';
315		$('.big_map_shops .scroll_content').html(html);
316	},
317	create_group: function() {
318		big_map.group = new ymaps.GeoObjectCollection({}, {});
319		big_map.map.geoObjects.add(big_map.group);
320	},
321	set_markers: function(cityID, shopID, bounds) {
322		if (!big_map.group) {
323			big_map.create_group();
324		}
325		var markers = [];
326		if (cityID != null && typeof(cityID) != 'undefined') {
327			big_map.group.removeAll();
328			for (var i = 0; i < big_map.markers.length; i ++) {
329				if ((big_map.markers[i].options.get('city') == cityID) && (shopID != null && typeof(shopID) != 'undefined' && big_map.markers[i].options.get('id') == shopID || shopID == null || typeof(shopID) == 'undefined')) {
330					markers.push(big_map.markers[i]);
331					big_map.group.add(big_map.markers[i]);
332				}
333			}
334			if (markers.length == 1) {
335				big_map.map.setCenter(markers[0].geometry.getCoordinates(), 16, {
336					useMapMargin: true
337				});
338			}
339			else {
340				big_map.set_bounds();
341			}
342		}
343		else if (bounds) {
344			var searchMarkers = ymaps.geoQuery(big_map.markers).searchInside(big_map.map);
345			var cities = [], shops = [];
346			searchMarkers.each(function(m) {
347				cities.push(m.options.get('city'));
348				big_map.cityID = null;
349				if (big_map.shopID == null) {
350					shops.push(m.options.get('id'));
351				}
352				else if (m.options.get('id') != big_map.shopID) {
353					shops.push(m.options.get('id'));
354					big_map.shopID = null;
355				}
356			});
357			if (big_map.visibles != searchMarkers.getLength()) {
358				big_map.group.removeAll();
359				if (cities.length == 1) {
360					big_map.cityID = cities[0];
361				}
362				else if (cities.length > 1 && cities.filter(uniqueVal).length == 1) {
363					big_map.cityID = cities.filter(uniqueVal)[0];
364				}
365				if (shops.length == 1) {
366					big_map.shopID = shops[0];
367				}
368				if (big_map.cityID) {
369					for (var i = 0; i < big_map.markers.length; i ++) {
370						if (big_map.markers[i].options.get('city') == big_map.cityID) {
371							markers.push(big_map.markers[i]);
372							big_map.group.add(big_map.markers[i]);
373						}
374					}
375					if (!big_map.showAll) {
376						big_map.set_margins(true);
377					}
378					big_map.showAll = true;
379					big_map.show_layers(big_map.cityID, big_map.shopID);
380				}
381				else {
382					markers = big_map.markers;
383					for (var i = 0; i < big_map.markers.length; i ++) {
384						big_map.group.add(big_map.markers[i]);
385					}
386					if (big_map.showAll) {
387						big_map.show_layers(big_map.cityID, big_map.shopID);
388					}
389				}
390			}
391		}
392		else {
393			markers = big_map.markers;
394			if (big_map.visibles != markers.length) {
395				big_map.group.removeAll();
396				for (var i = 0; i < big_map.markers.length; i ++) {
397					big_map.group.add(big_map.markers[i]);
398				}
399				big_map.set_bounds();
400			}
401		}
402		big_map.visibles = markers.length;
403		big_map.change_url();
404	},
405	set_margins: function(isFit) {
406		if(page_mobile.w_w>990) {
407			var side = Math.round($(document).width() * 0.5 - 470);
408			var margins = [50, (isFit ? side : 50), 50, isFit ? (side + 390) : 50];
409			big_map.map.margin.setDefaultMargin(margins);
410			$('.big_map_wrap').toggleClass('big_map_all', !isFit)
411		}
412	},
413	set_bounds: function() {
414		big_map.map.setBounds(
415			big_map.group.getBounds(),
416			{
417				checkZoomRange: true,
418				useMapMargin: true
419			}
420		);
421	},
422	select_city: function(cityID) {
423		big_map.userAction = true;
424		var opt = $('.big_map_cities').find('[data-city="' + cityID + '"]');
425		if (opt.attr('uniqid')) {
426			big_map.show_info(cityID, opt.attr('uniqid'));
427		}
428		else {
429			big_map.show_info(cityID);
430		}
431	},
432	show_info: function(cityID, shopID) {
433		console.log(1234)
434		big_map.cityID = cityID;
435		big_map.shopID = shopID;
436		$('.big_map_wrap .layer').addClass('collapsed').hide();
437		if (cityID != null && typeof(cityID) != 'undefined') {
438			big_map.showAll = true;
439			if($(window).width()>900) {
440				big_map.set_margins(true);
441			}
442			big_map.set_markers(cityID, shopID, false);
443			big_map.show_layers(cityID, shopID);
444		}
445		else {
446			if($(window).width()>900)
447				big_map.set_margins(big_map.showAll);
448			big_map.set_markers(cityID, shopID, false);
449			if (big_map.showAll) {
450				big_map.show_layers(cityID, shopID);
451			}
452		}
453	},
454	change_url: function() {
455		var url = '/magaz';
456		if (big_map.cityID != null && typeof(big_map.cityID) != 'undefined') {
457			url += '/' + big_map.cityID;
458			var opt = $('.big_map_cities').find('[data-city="' + big_map.cityID + '"]');
459			if (!opt.attr('uniqid') && big_map.shopID != null && typeof(big_map.shopID) != 'undefined') {
460				url += '/' + big_map.shopID;
461			}
462		}
463		url += '.html';
464		if (window.location.pathname + window.location.search != url) {
465			if (big_map.cityID == null || typeof(big_map.cityID) == 'undefined') {
466				url = '?all';
467			}
468			window.history.pushState({cityID: big_map.cityID, shopID: big_map.shopID}, null, url);
469		}
470	},
471	show_layers: function(cityID, shopID) {
472		big_map.remove_route();
473		if (cityID != null && typeof(cityID) != 'undefined' && shopID != null && typeof(shopID) != 'undefined') {
474			var block = $('.big_map_shop');
475			var opt = $('.big_map_cities .item[data-city="' + cityID + '"]');
476			block.find('.title').html(opt.text());
477			block.find('.scroll_content').html(big_map.full_shop_content(shopID));
478		}
479		else if (cityID != null && typeof(cityID) != 'undefined') {
480			var block = $('.big_map_shops');
481			var opt = $('.big_map_cities .item[data-city="' + cityID + '"]');
482            block.find('.title').html('Список магазинов' + (opt.attr('rod') ? (' в ' + opt.attr('rod')) : ''));
483			block.find('.shop').each(function() {
484				$(this).removeClass('first').toggleClass('visible', $(this).attr('data-city') == cityID);
485			});
486			block.find('.shop.visible:first').addClass('first');
487		}
488		else {
489			var block = $('.big_map_cities');
490		}
491		$('.big_map_wrap .layer').addClass('collapsed').hide();
492		block.toggleClass('collapsed', block.hasClass('big_map_cities')).show();
493		big_map.scroll_init(block.find('.scroll'));
494	},
495	short_shop_content: function(shopID, isBalloon) {
496		var shop = add_map_points[shopID];
497		var shopContent = '<div class="' + (isBalloon ? '' : 'item ') + 'shop" data-city="' + shop.city + '" data-shop="' + shopID + '">';
498		if (isBalloon) {
499			shopContent += '<div class="block"><big>' + $('.big_map_cities .item[data-city="' + shop.city + '"]').text() + '</big></div>';
500		}
501		if (shop.metro) {
502			shopContent += '<div class="block">';
503			for (var i = 0; i < shop.metro.length; i ++) {
504				shopContent += '<div class="info metro"><i><img src="/img/sprite_shops.png"></i>' + shop.metro[i] + '</div>';
505			}
506			shopContent += '</div>';
507		}
508		console.log(shop.status);
509
510		if (shop.status) {
511			if(shop.status.code){
512				var shop_status_text = shop.status.status_name;
513				var stat_class = '';
514
515				if(shop.status.code == 'zakrit_na_karantin'){
516					//shop_status_text = 'Закрыт на карантин';
517					stat_class = 'stat1';
518				}else if(shop.status.code == 'zakrit_na_pereezd'){
519					//shop_status_text = 'Закрыт на переезд';
520					stat_class = 'stat1';
521				}else if(shop.status.code == 'zakrit_po_tehnicheskim_prichinam'){
522					//shop_status_text = 'Закрыт по техническим причинам';
523					stat_class = 'stat1';
524				}else if(shop.status.code == 'punkt_vidachi_zakazov'){
525					//shop_status_text = 'Пункт выдачи заказов';
526					stat_class = 'stat2';
527				}else if(shop.status.code == 'internet_magazin'){
528					//shop_status_text = 'Интернет-магазин';
529					stat_class = 'stat2';
530				}else if(shop.status.code == 'distantsionnaya_prodazha'){
531					//shop_status_text = 'Дистанционная продажа';
532					stat_class = 'stat2';
533				}
534
535				shopContent += '<div class="block">';
536				shopContent += '<div class="info"><div class="avail_stat_back '+stat_class+'"><div class="avail_stat"><span>'+shop_status_text+'</span></div> </div></div>';
537				shopContent += '</div>';
538			}
539		}
540		if (shop.addr) {
541			shopContent += '<div class="block">';
542			shopContent += '<div class="info address"><i><img src="/img/sprite_shops.png"></i>' + shop.addr + '</div>';
543			shopContent += '</div>';
544		}
545		if (shop.phone) {
546			shopContent += '<div class="block">';
547			shopContent += '<div class="info phone"><i><img src="/img/sprite_shops.png"></i>';
548			for (var i = 0; i < shop.phone.length; i ++) {
549				shopContent += (i > 0 ? '<br>' : '') + shop.phone[i][0] + (shop.phone[i][1] != '' ? (' <small>/ ' + shop.phone[i][1] + ' /</small>') : '');
550			}
551			shopContent += '</div>';
552			shopContent += '</div>';
553		}
554		if (shop.time) {
555			shopContent += '<div class="block">';
556			shopContent += '<div class="info time"><i><img src="/img/sprite_shops.png"></i>';
557			for (var i = 0; i < shop.time.length; i ++) {
558				shopContent += (i > 0 ? '<br>' : '') + shop.time[i];
559			}
560			shopContent += '</div>';
561			shopContent += '</div>';
562		}
563		shopContent += '</div>';
564		if (isBalloon && (big_map.shopID == null || typeof(big_map.shopID) == 'undefined')) {
565			shopContent += '<div class="buttons" data-city="' + shop.city + '" data-shop="' + shopID + '">';
566			shopContent += '<a href="javascript:void(0)" class="but" onclick="big_map.func(this)">Подробнее</a>';
567			shopContent += '</div>';
568		}
569		return shopContent;
570	},
571	func: function(elem) {
572		if (!$('.big_map_shop').is(':visible') || $('.big_map_shop .shop').attr('data-shop') != $(elem).parent().attr('data-shop')) {
573			big_map.userAction = true;
574			big_map.show_info($(elem).parent().attr('data-city'), $(elem).parent().attr('data-shop'));
575		}
576	},
577	full_shop_content: function(shopID) {
578		var shop = add_map_points[shopID];
579		var shopContent = '<div class="item shop" data-city="' + shop.city + '" data-shop="' + shopID + '" data-print="1">';
580		if (shop.metro) {
581			shopContent += '<div class="block">';
582			for (var i = 0; i < shop.metro.length; i ++) {
583				shopContent += '<div class="info metro"><i><img src="/img/sprite_shops.png"></i>' + shop.metro[i] + '</div>';
584			}
585			shopContent += '</div>';
586		}
587
588		if (shop.status) {
589			if(shop.status.code){
590				var shop_status_text = shop.status.status_name;
591				var stat_class = '';
592
593				if(shop.status.code == 'zakrit_na_karantin'){
594					//shop_status_text = 'Закрыт на карантин';
595					stat_class = 'stat1';
596				}else if(shop.status.code == 'zakrit_na_pereezd'){
597					//shop_status_text = 'Закрыт на переезд';
598					stat_class = 'stat1';
599				}else if(shop.status.code == 'zakrit_po_tehnicheskim_prichinam'){
600					//shop_status_text = 'Закрыт по техническим причинам';
601					stat_class = 'stat1';
602				}else if(shop.status.code == 'punkt_vidachi_zakazov'){
603					//shop_status_text = 'Пункт выдачи заказов';
604					stat_class = 'stat2';
605				}else if(shop.status.code == 'internet_magazin'){
606					//shop_status_text = 'Интернет-магазин';
607					stat_class = 'stat2';
608				}else if(shop.status.code == 'distantsionnaya_prodazha'){
609					//shop_status_text = 'Дистанционная продажа';
610					stat_class = 'stat2';
611				}
612
613				shopContent += '<div class="block">';
614				shopContent += '<div class="info"><div class="avail_stat_back '+stat_class+'"><div class="avail_stat"><span>'+shop_status_text+'</span></div> </div></div>';
615				shopContent += '</div>';
616			}
617		}
618		if (shop.addr) {
619			shopContent += '<div class="block">';
620			shopContent += '<div class="info address"><i><img src="/img/sprite_shops.png"></i>' + shop.addr + '</div>';
621			shopContent += '</div>';
622		}
623		if (shop.phone) {
624			shopContent += '<div class="block">';
625			shopContent += '<div class="info phone"><i><img src="/img/sprite_shops.png"></i>';
626			for (var i = 0; i < shop.phone.length; i ++) {
627				shopContent += (i > 0 ? '<br>' : '') + '<a href="tel:' + shop.phone[i][0] + '">' + shop.phone[i][0] + '</a>' + (shop.phone[i][1] != '' ? (' <small>/ ' + shop.phone[i][1] + ' /</small>') : '');
628			}
629			shopContent += '</div>';
630			shopContent += '</div>';
631		}
632		if (shop.email) {
633			shopContent += '<div class="block">';
634			shopContent += '<div class="info email"><i><img src="/img/sprite_shops.png"></i><a href="mailto:' + shop.email + '">' + shop.email + '</a></div>';
635			shopContent += '</div>';
636		}
637		if (shop.time) {
638			shopContent += '<div class="block">';
639			shopContent += '<div class="info time"><i><img src="/img/sprite_shops.png"></i>';
640			for (var i = 0; i < shop.time.length; i ++) {
641				shopContent += (i > 0 ? '<br>' : '') + shop.time[i];
642			}
643			shopContent += '</div>';
644			shopContent += '</div>';
645		}
646		shopContent += '</div>';
647		if (shop.credit == '1' || shop.cards == '1') {
648			shopContent += '<div class="item hiddable" data-print="1">';
649			shopContent += '<div class="block">';
650			if (shop.credit == '1') {
651				shopContent += '<div class="info credit"><i><img src="/img/sprite_shops.png"></i>Кредит</div>';
652			}
653			if (shop.cards == '1') {
654				shopContent += '<div class="info cards"><i><img src="/img/sprite_shops.png"></i>Оплата картами</div>';
655			}
656			shopContent += '</div>';
657			shopContent += '</div>';
658		}
659		shopContent += '<div class="item hiddable">';
660		shopContent += '<div class="block">';
661		shopContent += '<div class="b5">Проложить маршрут</div>';
662		shopContent += '<form class="route">';
663		shopContent += '<table cellpadding="0" cellspacing="0" width="100%"><tr valign="top">';
664		shopContent += '<td width="40"><a href="javascript:void(0)" class="route_icon" title="Определить текущее местоположение"></a></td>';
665		shopContent += '<td><span class="route_input"><input type="text" name="address" value="" placeholder="Введите адрес"><span class="route_but"><input type="submit" value=" "></span></span></td>';
666		shopContent += '</tr></table>';
667		shopContent += '<div class
667="route_msg"></div>';
668		shopContent += '</form>';
669		shopContent += '</div>';
670		shopContent += '</div>';
671		shopContent += '<div class="item last hiddable">';
672		if (shop.info) {
673			shopContent += '<div class="block_grey" data-print="1">' + shop.info + '</div>';
674		}
675		shopContent += '<div class="but but_print"><span>Распечатать</span></div>';
676		shopContent += '</div>';
677		var opt = $('.big_map_cities').find('[data-city="' + big_map.cityID + '"]');
678		//var lnk_txt = opt.attr('uniqid') ? 'все города' : 'все магазины';
679		//shopContent += '<div align="center" style="margin-top: 10px;"><a href="javascript:void(0)" class="back_lnk">'+lnk_txt+'</a></div>';
680		if (!opt.attr('uniqid')) {
681			shopContent += '<div align="center" style="margin-top: 10px;"><a href="javascript:void(0)" class="back_lnk">все магазины</a></div>';
682		}
683		return shopContent;
684	},
685	user_position: function() {
686		$('.big_map_shop .route_msg').html('');
687		ymaps.geolocation.get({
688			provider: 'auto',
689			mapStateAutoApply: true
690		}).then(
691			function(result) {
692				var coords = result.geoObjects.position;
693				$('.big_map_shop .route_msg').html('');
694				$('.big_map_shop .route input[name=address]').val(coords);
695				big_map.create_route();
696			},
697			function() {
698				$('.big_map_shop .route_msg').html('Не удалось определить текущее местоположение. Введите адрес.');
699			}
700		);
701	},
702	remove_route: function() {
703		if (big_map.route) {
704			big_map.map.geoObjects.remove(big_map.route);
705		}
706	},
707	create_route: function() {
708		big_map.userAction = true;
709		big_map.remove_route();
710		$('.big_map_shop .route_msg').html('');
711		if ($('.big_map_shop .route input[name=address]').val() != '') {
712			var balloonLayout = ymaps.templateLayoutFactory.createClass(
713				'<div class="balloon balloon_route">' +
714					'<div class="close"></div>' +
715					'<div class="arrow"></div>' +
716					'<div class="shop">' +
717						'<div class="block">{{ properties.distance.text }}, {{ properties.duration.text }}</div>' +
718					'</div>' +
719				'</div>', {
720				build: function () {
721					this.constructor.superclass.build.call(this);
722					this._$element = $('.balloon', this.getParentElement());
723					this.applyElementOffset();
724					this._$element.find('.close').on('click', $.proxy(this.onCloseClick, this));
725				},
726				clear: function () {
727					this._$element.find('.close').off('click');
728					this.constructor.superclass.clear.call(this);
729				},
730				onSublayoutSizeChange: function () {
731					balloonLayout.superclass.onSublayoutSizeChange.apply(this, arguments);
732					if(!this._isElement(this._$element)) {
733						return;
734					}
735					this.applyElementOffset();
736					this.events.fire('shapechange');
737				},
738				applyElementOffset: function () {
739					this._$element.css({
740						left: -(this._$element[0].offsetWidth / 2),
741						top: -(this._$element[0].offsetHeight + this._$element.find('.arrow')[0].offsetHeight)
742					});
743				},
744				getShape: function () {
745					if(!this._isElement(this._$element)) {
746						return balloonLayout.superclass.getShape.call(this);
747					}
748					var position = this._$element.position();
749					return new ymaps.shape.Rectangle(new ymaps.geometry.pixel.Rectangle([
750						[position.left, position.top], [
751							position.left + this._$element[0].offsetWidth,
752							position.top + this._$element[0].offsetHeight + this._$element.find('.arrow')[0].offsetHeight
753						]
754					]));
755				},
756				_isElement: function (element) {
757					return element && element[0] && element.find('.arrow')[0];
758				},
759				onCloseClick: function (e) {
760					e.preventDefault();
761					this.events.fire('userclose');
762				}
763			});
764			big_map.route = new ymaps.multiRouter.MultiRoute({
765				referencePoints: [
766					$('.big_map_shop .route input[name=address]').val(),
767					add_map_points[big_map.shopID].coords.split(',')
768				],
769				params: {
770					routingMode: 'auto'
771				}
772			}, {
773				useMapMargin: true,
774				zoomMargin: big_map.shopID != null && typeof(big_map.shopID) != 'undefined' ? [0, 390, 0, 0] : big_map.cityID != null && typeof(big_map.cityID) != 'undefined' ? [0, 0, 0, 390] : [0, 0],
775				boundsAutoApply: true,
776				wayPointStartIconLayout: 'default#image',
777				wayPointStartIconImageHref: '/img/big_map_origin.png',
778				wayPointStartIconImageSize: [30, 34],
779				wayPointStartIconImageOffset: [-15, -34],
780				wayPointFinishVisible: false,
781				routeStrokeWidth: 2,
782				routeStrokeColor: '000000',
783				routeActiveStrokeWidth: 5,
784				routeActiveStrokeColor: '000000',
785				balloonLayout: balloonLayout,
786				balloonPanelMaxMapArea: 0,
787				balloonOffset: [-3, -25]
788			});
789			big_map.map.geoObjects.add(big_map.route);
790		}
791		else {
792			$('.big_map_shop .route_msg').html('Введите адрес или определите текущее местоположение.');
793		}
794	},
795	scroll_init: function(scroll) {
796		scroll.removeData('jsp').removeAttr('style').removeClass('jspScrollable').html('<div class="scroll_content">' + scroll.find('.scroll_content').html() + '</div>').css({'max-height': (big_map.scrollHeight - scroll.closest('.layer').find('.title').outerHeight()) + 'px'});
797		scroll.jScrollPane({
798			verticalGutter: 30,
799			scrollbarWidth: 5,
800			mouseWheelSpeed: 50
801		});
802		scroll.find('.jspHorizontalBar').remove();
803		scroll.toggleClass('jspScrollable', scroll.find('.jspVerticalBar').size() == 1);
804	},
805	print_shop: function() {
806		var shop = add_map_points[big_map.shopID];
807		var c = shop.coords.split(',');
808		var z = 16;
809		var url = 'http://static-maps.yandex.ru/1.x/?ll='+c[1]+','+c[0]+'&z='+z+'&pt='+c[1]+','+c[0]+',pm2ntl&l=map&size=580,310';
810		var head = '';
811		head += '<link href="/css/all.css" rel="stylesheet" type="text/css" media="all" />';
812		head += '<link href="/css/big_map.css" rel="stylesheet" type="text/css" media="all" />';
813		head += '<link href="/css/print.css" rel="stylesheet" type="text/css" media="print" />';
814		var content = '<html><head>' + head + '</head><body>';
815		content += '<div class="big_map_wrap printable">';
816		content += '<div class="big_map_shop">';
817		$('.big_map_shop [data-print]').each(function() {
818			content += '<div class="item">' + $(this).html() + '</div>';
819		});
820		content += '</div>';
821		content += '<div class="big_map"><img src="' + url + '" /></div>';
822		content += '</div>';
823		content += '</div>';
824		content += '</body></html>';
825		var prwin = window.open('', 'printWin', 'width=940,height=640,toolbar=no,Scrollbars=1');
826		if (typeof prwin == 'object') {
827			prwin.focus();
828			prwin.document.open();
829			prwin.document.write(content);
830			prwin.document.close();
831			img_load(url, function() { prwin.print(); })
832		}
833	}
834};
835
836function uniqueVal(value, index, self) {
837	return self.indexOf(value) === index;
838}
839
840function img_load(src, callback) {
841	var image = document.createElement('img');
842	image.src = src;
843	if (image.width != 0) {
844		callback();
845	}
846	else {
847		$(image).load(function() {
848			callback();
849		});
850	}
851}

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.