var BuilderMaps = function() { this.form = $('#builderProperties .sidebar-panel[data-panel="maps"]'); } BuilderMaps.prototype = { form: null, modalForm: null, row: null, col:null, idx: null, map: null, placemark: null, bindElement: function(e) { this.idx = $(e).data('index'); this.row = $(e).data('row'); this.col = $(e).data('col'); this.form.show(); }, unbindElement: function() { this.form.hide(); }, showForm: function() { this.modalForm = $('
').appendTo($(document.body)).modal('show').load('/_builder/maps/modalform.html?index='+this.idx+'&row='+this.row+'&col='+this.col+'&page='+$.builder.page_id, $.proxy(function() { var original_map = $.builder.currentElement.data('container'); var original_placemark = $.builder.currentElement.data('placemark'); var coords = original_placemark.geometry.getCoordinates(); map = this.map = new ymaps.Map ('builderMaps', { center: coords, zoom: original_map.getZoom() }); map.setType(original_map.getType()); map.controls.add('zoomControl', { left: 5, top: 5 }).add('typeSelector'); this.placemark = new ymaps.Placemark(coords, {iconContent: original_placemark.properties.get('iconContent')}, {preset: 'twirl#blueStretchyIcon', draggable: true}); this.placemark.events.add(['click'], $.proxy(function(e) { //alert($.builder.maps.placemark.getIconContent()); var s = prompt('Укажите текст подписи метки', this.placemark.properties.get('iconContent')); if (typeof s == 'string') this.placemark.properties.set('iconContent', s); }, this)); //$.builder.maps.placemark.Events.Click = function() { alert(0); } map.geoObjects.add(this.placemark); $('#builderMapsSearchInput').keypress(function(e) { if (e.keyCode == 13 && this.value.trim() != '') { var result = $('#builderMapsSearchResult').html(''); $.ajax({ url: 'http://geocode-maps.yandex.ru/1.x/', type: 'get', dataType: "jsonp", data: {format: 'json', geocode: this.value}, beforeSend: $.proxy(function() { this.disabled = 'on'; }, this), success: function(s) { var list = s.response.GeoObjectCollection.featureMember; for (i = 0; i < list.length; i++) { var e = list[i]; $('