1ymaps.ready(init); 2 3objects = []; 4 5function init() { 6 // Создание каÑÑÑ. 7 // https://tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/map-docpage/ 8 var myMap = new ymaps.Map("map", { 9 // ÐооÑдинаÑÑ ÑенÑÑа каÑÑÑ. 10 // ÐоÑÑдок по ÑмолÑниÑ: «ÑиÑоÑа, долгоÑа». 11 center: [52.0317, 113.501], 12 // УÑÐ¾Ð²ÐµÐ½Ñ Ð¼Ð°ÑÑÑабиÑованиÑ. ÐопÑÑÑимÑе знаÑениÑ: 13 // Ð¾Ñ 0 (веÑÑ Ð¼Ð¸Ñ) до 19. 14 zoom: 5, 15 // ÐлеменÑÑ ÑпÑÐ°Ð²Ð»ÐµÐ½Ð¸Ñ 16 // https://tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/controls/standard-docpage/ 17 controls: [ 18 19 'zoomControl', // ÐолзÑнок маÑÑÑаба 20 'rulerControl', // Ðинейка 21 'routeButtonControl', // ÐÐ°Ð½ÐµÐ»Ñ Ð¼Ð°ÑÑÑÑÑизаÑии 22 'trafficControl', // ÐÑобки 23 'typeSelector', // ÐеÑеклÑÑаÑÐµÐ»Ñ Ñлоев каÑÑÑ 24 //'fullscreenControl', // ÐолноÑкÑаннÑй Ñежим 25 26 // ÐоиÑÐºÐ¾Ð²Ð°Ñ ÑÑÑока 27 new ymaps.control.SearchControl({ 28 options: { 29 // вид - поиÑÐºÐ¾Ð²Ð°Ñ ÑÑÑока 30 size: 'large', 31 // ÐклÑÑим возможноÑÑÑ Ð¸ÑкаÑÑ Ð½Ðµ ÑолÑко ÑопонимÑ, но и оÑганизаÑии. 32 provider: 'yandex#search' 33 } 34 }) 35 36 ] 37 }); 38 39 40 var fullscreenControl = new ymaps.control.FullscreenControl(); 41 myMap.controls.add(fullscreenControl); 42 fullscreenControl.enterFullscreen(); 43 44 for (let key in _coords) { 45 let bP = _coords[key]; 46 let polygon = new ymaps.Polygon(bP, {hintContent: ""}, { 47 fillColor: "#ff0000", 48 interactivityModel: "default#transparent", 49 strokeWidth: 2, 50 strokeColor: "#ff0000", 51 strokeOpacity: 1, 52 opacity: 0.3 53 }); 54 myMap.geoObjects.add(polygon) 55 } 56 57 for (let _key in _districts) { 58 let _d = _districts[_key]; 59 let _c = _d.coordinates; 60 for (let _k in _c) { 61 let bP = _c[_k]; 62 let polygon = new ymaps.Polygon(bP, { 63 hintContent: "<b>" + _d.name + "</b>", 64 custom: 1, 65 url: _d.url 66 }, { 67 fillColor: "#ff0000", 68 interactivityModel: "default#transparent", 69 strokeWidth: 1, 70 strokeColor: "#ffff00", 71 strokeOpacity: 1, 72 opacity: 0.3 73 }); 74 polygon.events.add(["mouseenter", "mouseleave"], function (g) { 75 if (g.get("target").properties.get("custom") !== "undefined") { 76 if (g.get("target").properties.get("custom") === 1) { 77 g.get("target").options.set("opacity", g.get("type") === "mouseenter" ? 0.7 : 0.3); 78 g.get("target").options.set("fillColor", g.get("type") === "mouseenter" ? "#ffff00" : "#ff0000") 79 } 80 } 81 }); 82 myMap.geoObjects.add(polygon) 83 } 84 } 85 86 87 $.getJSON('objects.php', function(data) { 88 objects1.forEach(function (item, i, arr) { 89 myPlacemark = new ymaps.Placemark([item.coord[0], item.coord[1]], { 90 // Ð¥Ð¸Ð½Ñ Ð¿Ð¾ÐºÐ°Ð·ÑваеÑÑÑ Ð¿Ñи наведении мÑÑкой на Ð¸ÐºÐ¾Ð½ÐºÑ Ð¼ÐµÑки. 91 hintContent: item.name, 92 // ÐалÑн оÑкÑоеÑÑÑ Ð¿Ñи клике по меÑке. 93 balloonContent: item.name 94 }, { 95 iconColor: item.color, 96 }); 97 98 item.placemark = myPlacemark; 99 100 }); 101 102 data.forEach(function (item, i, arr) { 103 myPlacemark = new ymaps.Placemark([item.latitude, item.longitude], { 104 // Ð¥Ð¸Ð½Ñ Ð¿Ð¾ÐºÐ°Ð·ÑваеÑÑÑ Ð¿Ñи наведении мÑÑкой на Ð¸ÐºÐ¾Ð½ÐºÑ Ð¼ÐµÑки. 105 hintContent: item.name, 106 // ÐалÑн оÑкÑоеÑÑÑ Ð¿Ñи клике по меÑке. 107 balloonContent: item.name 108 }, { 109 iconColor: item.color, 110 }); 111 112 item.placemark = myPlacemark; 113 114 objects1.push(item); 115 116 }); 117 });
118 119 $('.ffff').click(function (event) { 120 objects1.forEach(function (item, i, arr) { 121 if (item.type == $(event.target).attr('ftype')) { 122 if ($(event.target).prop("checked")) { 123 myMap.geoObjects.add(item.placemark); 124 } else { 125 myMap.geoObjects.remove(item.placemark); 126 } 127 } 128 }); 129 }); 130}
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.