1// YandexMap 2 (function() { 3 4 function coords(str) { 5 return str.split(','); 6 } 7 8 function init(options) { 9 options.center = coords(options.center); 10 11 $.each(options.data, function(key, item) { 12 item.coords = coords(item.coords); 13 }); 14 15 if (options.type == 1) { 16 17 google.maps.event.addDomListener(window, 'load', function() { 18 19 var map = new google.maps.Map(document.getElementById(options.id), { 20 zoom: 15, 21 scrollwheel: false, 22 center: new google.maps.LatLng(options.center[0], options.center[1]) 23 }); 24 25 $.each(options.data, function(key, item) { 26 27 var marker = new google.maps.Marker({ 28 position: new google.maps.LatLng(item.coords[0], item.coords[1]), 29 map: map, 30 title: item.name 31 }); 32 33 var infowindow = new google.maps.InfoWindow({ 34 content: '<div class="baloon-content">' + 35 '<h3 style="margin: 0; padding-bottom: 3px;">' + item.name + '</h3>' + 36 item.desc + 37 '</div>' 38 }); 39 40 google.maps.event.addListener(marker, 'click', function() { 41 infowindow.open(map, marker); 42 }); 43 44 }); 45 }); 46 47 } else { 48 49 ymaps.ready(function() { 50 51 var map = new ymaps.Map(options.id, { 52 center: options.center, 53 zoom: options.zoom, 54 behaviors: ['drag', 'rightMouseButtonMagnifier'], 55 }); 56 57 map.controls.add( 58 new ymaps.control.ZoomControl() 59 ); 60 61 var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass( 62 '<div class="baloon-content" style="padding: 0 10px;">' + 63 '<h3 style="margin: 0;">$[properties.name]</h3>' + 64 '$[properties.desc]' + 65 '</div>' 66 ); 67 68 var myCollection = new ymaps.GeoObjectCollection(); 69 70 $.each(options.data, function(key, item) { 71 myCollection.add(new ymaps.Placemark( 72 item.coords, 73 item, 74 {balloonContentLayout: MyBalloonContentLayoutClass} 75 )); 76 }); 77 78 map.geoObjects.add(myCollection); 79 80 }); 81 } 82 } 83 84 window.mjsMap = init; 85 })(); 86 // /YandexMap
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.