PageSourceSearch

https://implantcity.ru/bitrix/cache/js/s1/new/page_f0494863f6c8562…c8562bc7cd43be13afeaed_v1.js?17743370037824

js implantcity.ru collected 2026-09-25 20:32:00 UTC 7,824 bytes, 255 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:53:"/local/templates/implantcity/js/map.js?17659582647563";s:6:"source";s:38:"/local/templates/implantcity/js/map.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3function initMaps(opts) {
4
5	opts = $.extend({
6		map: null,
7		zoom: 11,
8		center: [],
9		coords: [],
10		popup: false,
11		callback: function () { }
12	}, opts);
13
14	if (!opts.map) {
15		return false;
16	}
17
18	var MyBalloonContentLayout;
19	var MyBalloonLayout;
20	var myPlacemark;
21
22	var params = {
23		center: opts.center,
24		zoom: opts.zoom
25	};
26
27	if (!!opts.controls) {
28		params.controls = opts.controls;
29	}
30
31	var myMap = new ymaps.Map(opts.map, params);
32
33	if (!opts.controls) {
34
35		myMap.controls
36			.remove('mapTools')
37			.remove('typeSelector')
38			.remove('smallZoomControl')
39			.remove('scaleLine')
40			.remove('miniMap')
41			.remove('searchControl')
42			// .remove('zoomControl')
43			.remove('trafficControl')
44			.remove('mapTools');
45	}
46
47	if (/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || screen.width < 768) {
48		myMap.behaviors.disable('drag');
49	}
50
51	for (var i = 0, l = opts.coords.length; i < l; i += 1) {
52
53		if (opts.popup) {
54
55			MyBalloonLayout = ymaps.templateLayoutFactory.createClass(
56				'<div class="map-popup">' +
57				'<div class="map-popup__close">&times;</div>' +
58				'<div class="map-popup__arrow"></div>' +
59				'<div class="map-popup__inner">' +
60				'$[[options.contentLayout observeSize minWidth=230 maxWidth=230 maxHeight=350]]' +
61				'</div>' +
62				'</div>', {
63					/**
64					 * Строит экземпляр макета на основе шаблона и добавляет его в родительский HTML-элемент.
65					 * @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/layout.templateBased.Base.xml#build
66					 * @function
67					 * @name build
68					 */
69					build: function () {
70						this.constructor.superclass.build.call(this);
71
72						this._$element = $('.map-popup', this.getParentElement());
73
74						this.applyElementOffset();
75
76						this._$element.find('.map-popup__close')
77							.on('click', $.proxy(this.onCloseClick, this));
78					},
79
80					/**
81					 * Удаляет содержимое макета из DOM.
82					 * @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/layout.templateBased.Base.xml#clear
83					 * @function
84					 * @name clear
85					 */
86					clear: function () {
87						this._$element.find('.map-popup__close')
88							.off('click');
89
90						this.constructor.superclass.clear.call(this);
91					},
92
93					/**
94					 * Метод будет вызван системой шаблонов АПИ при изменении размеров вложенного макета.
95					 * @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/IBalloonLayout.xml#event-userclose
96					 * @function
97					 * @name onSublayoutSizeChange
98					 */
99					onSublayoutSizeChange: function () {
100						MyBalloonLayout.superclass.onSublayoutSizeChange.apply(this, arguments);
101
102						if (!this._isElement(this._$element)) {
103							return;
104						}
105
106						this.applyElementOffset();
107
108						this.events.fire('shapechange');
109					},
110
111					/**
112					 * Сдвигаем балун, чтобы "хвостик" указывал на точку привязки.
113					 * @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/IBalloonLayout.xml#event-userclose
114					 * @function
115					 * @name applyElementOffset
116					 */
117					applyElementOffset: function () {
118						this._$element.css({
119							left: -(this._$element[0].offsetWidth / 2),
120							top: -(this._$element[0].offsetHeight + this._$element.find('.map-popup__arrow')[0].offsetHeight)
121						});
122					},
123
124					/**
125					 * Закрывает балун при клике на крестик, кидая событие "userclose" на макете.
126					 * @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/IBalloonLayout.xml#event-userclose
127					 * @function
128					 * @name onCloseClick
129					 */
130					onCloseClick: function (e) {
131						e.preventDefault();
132
133						this.events.fire('userclose');
134					},
135
136					/**
137					 * Используется для автопозиционирования (balloonAutoPan).
138					 * @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/ILayout.xml#getClientBounds
139					 * @function
140					 * @name getClientBounds
141					 * @returns {Number[][]} Координаты левого верхнего и правого нижнего углов шаблона относительно точки привязки.
142					 */
143					getShape: function () {
144						if (!this._isElement(this._$element)) {
145							return MyBalloonLayout.superclass.getShape.call(this);
146						}
147
148						var position = this._$element.position();
149
150						return new ymaps.shape.Rectangle(new ymaps.geometry.pixel.Rectangle([
151							[position.left, position.top - 50], [
152								position.left + this._$element[0].offsetWidth,
153								position.top + this._$element[0].offsetHeight + this._$element.find('.map-popup__arrow')[0].offsetHeight
154							]
155						]));
156					},
157
158					/**
159					 * Проверяем наличие элемента (в ИЕ и Опере его еще может не быть).
160					 * @function
161					 * @private
162					 * @name _isElement
163					 * @param {jQuery} [element] Элемент.
164					 * @returns {Boolean} Флаг наличия.
165					 */
166					_isElement: function (element) {
167						return element && element[0] && element.find('.map-popup__arrow')[0];
168					}
169				}),
170
171				// Создание вложенного макета содержимого балуна.
172				MyBalloonContentLayout = ymaps.templateLayoutFactory.createClass(
173					'<h3 class="map-popup__title">$[properties.balloonHeader]</h3>' +
174					'<div class="map-popup__text">$[properties.balloonContent]</div>'
175				),
176
177				// Создание метки с пользовательским макетом балуна.
178				myPlacemark = new ymaps.Placemark([opts.coords[i].x, opts.coords[i].y], {
179					balloonHeader: opts.coords[i].title,
180					balloonContent: opts.coords[i].content
181				}, {
182						// balloonShadow: false,
183						// balloonLayout: MyBalloonLayout,
184						// balloonContentLayout: MyBalloonContentLayout,
185						balloonPanelMaxMapArea: 0,
186						// Не скрываем иконку при открытом балуне.
187						hideIconOnBalloonOpen: false,
188						// И дополнительно смещаем балун, для открытия над иконкой.
189						balloonOffset: [0, -40],
190						iconLayout: 'default#image',
191						iconImageHref: '/local/templates/implantcity/img/pin.svg',
192						// iconImageHref: '../images/lens-sign-blue.svg',
193						iconImageSize: [52, 46],
194						iconImageOffset: [-26, -46]
195					});
196
197		} else {
198
199			myPlacemark = new ymaps.Placemark([opts.coords[i].x, opts.coords[i].y], {}, {
200				// Не скрываем иконку при открытом балуне.
201				hideIconOnBalloonOpen: true,
202				// И дополнительно смещаем балун, для открытия над иконкой.
203				balloonOffset: [0, -40],
204				iconLayout: 'default#image',
205				iconImageHref: '../img/pin.svg',
206				// iconImageHref: '../images/lens-sign-blue.svg',
207				iconImageSize: [52, 46],
208				iconImageOffset: [-26, -46]
209			});
210
211		}
212
213		myMap.geoObjects.add(myPlacemark);
214
215		if (opts.callback) {
216			opts.callback();
217		}
218
219	}
220
221}
222
223ymaps.ready(function () {
224
225	// main page
226	//(function () {
227	//window.onload = function() {
228
229		var mainMap = document.querySelector('#js-requisites__map');
230		if (!mainMap) {
231			return false;
232		}
233
234		var _coords = [];
235		var _center = [55.736878, 37.664689];
236
237		_coords.push({
238			x: 55.736878,
239			y: 37.664689,
240		});
241		
242		initMaps({
243			map: mainMap,
244			zoom: 15,
245			center: _center,
246			coords: _coords,
247			popup: true
248		});
249
250	//};
251	//})();
252
253});
254/* End */
255;; /* /local/templates/implantcity/js/map.js?17659582647563*/

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.