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">×</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.