PageSourceSearch

https://centerstart.ru/themes/new_start/js/map.js?v=10.1.0

js centerstart.ru collected 2026-10-02 04:58:15 UTC 4,863 bytes, 173 lines download raw bytes

1var $ = jQuery.noConflict();
2
3let filtredOrganizations = []
4function renderOrganizations(){
5  document.getElementById('organizations').replaceChildren(document.getElementById('organizations').children[0])
6  gCollection.removeAll();
7  if(selectOkrug.value==='okrug' || selectType.value==='type'){
8    gCollection.removeAll()
9  }
10  else{
11    for (let index = 0; index < schools.length; index++) {
12      if (
13        ((selectOkrug.value == 4 ? true : (schools[index][1] == selectOkrug.value)) && 
14        (selectType.value == 3 ? true : (schools[index][3] == selectType.value)))
15      ) 
16      {
17        selectOrganization.appendChild(createOption(index, schools[index][0]))
18        GeoAdd.apply(null, schools[index])
19      }
20    }
21  }
22
23}
24
25//Написать функцию которая при выборе фильтров будет менять значения в фильтре оу
26//использовать <> и ||
27function fillSelectOfOrganizations(){
28  document.getElementById('organizations').replaceChildren(document.getElementById('organizations').children[0])
29    for (let index = 0; index < schools.length; index++) {
30      if (
31        ((selectOkrug.value < 4 ? (schools[index][1] == selectOkrug.value) : false) 
32        ||
33        (selectType.value < 3 ? (schools[index][3] == selectType.value) : false))
34      ) 
35      {
36        selectOrganization.appendChild(createOption(index, schools[index][0]))
37      }
38    }
39}
40
41function renderOrganizationByName(){
42  gCollection.removeAll();
43  if(selectOrganization.value!='organization'){
44    GeoAdd.apply(null, schools[(selectOrganization.value)])
45  }
46  else{
47    renderOrganizations()
48   // fillSelectOfOrganizations()
49  }
50}
51
52function createOption(elementValue, text){
53  var opt = document.createElement('option');
54  opt.value = elementValue;
55  opt.innerHTML = text;
56  return opt
57}
58
59function option(){
60  selectOkrug = document.getElementById('okruga')
61  selectType = document.getElementById('types')
62  selectOrganization = document.getElementById('organizations')
63
64  selectOkrug.onchange = function() { 
65    renderOrganizations()
66    Number.isInteger(selectOkrug.value*selectType.value) ? 
67    '' :
68    fillSelectOfOrganizations();
69  };
70  for (var i = 0; i<okrug.length; i++){  
71    selectOkrug.appendChild(createOption(i, okrug[i]));
72  }
73
74  selectType.onchange = function() { 
75    renderOrganizations()
76    Number.isInteger(selectOkrug.value*selectType.value) ? 
77    '' :
78    fillSelectOfOrganizations();
79  };
80  for (var i = 0; i<type.length; i++){
81    selectType.appendChild(createOption(i, type[i]));
82  }
83
84  selectOrganization.onchange = function() { renderOrganizationByName() }
85  for (var i = 0; i<schoolsNames.length; i++){
86    selectOrganization.appendChild(createOption(i, schoolsNames[i]));
87  }
88}
89
90
91
92
93schools.forEach((el) => schoolsNames.push(el[0]))
94color = ['#46b5d5', '#ad46d5', '#d56646', '#6dd546'];
95
96function GeoAdd(name, okr, cords){
97  gCollection.add(new ymaps.Placemark([cords[1], cords[0]], 
98      {
99        hintContent: name
100      },{
101        preset: 'islands#Icon',
102        iconColor: color[okr]
103      } ));
104}
105
106let center = [45.033231, 38.977566];
107function start() {
108	var map = new ymaps.Map('school_map', {
109		center: center,
110		zoom: 12,
111    contorls: []
112    
113	},{
114    yandexMapDisablePoiInteractivity: true,
115  }),
116
117  mySearchControl = new ymaps.control.SearchControl({
118    options: {
119        noPlacemark: true
120    }
121  });
122  
123  mySearchResults = new ymaps.GeoObjectCollection(null,
124    {
125      preset: 'islands#redHomeIcon',
126      hintContentLayout: ymaps.templateLayoutFactory.createClass('$[properties.name]'),
127      hintContent:  'Ваш дом',
128      openBalloonOnClick: false
129    } );
130
131  gCollection = new ymaps.GeoObjectCollection();
132
133
134  map.geoObjects.add(new ymaps.Placemark([45.033231, 38.977566], 
135  {
136    balloonContent: 'Краснодарский методический центр информационно-коммуникационных технологий "Старт"'
137  },{
138    preset: 'islands#redEducationIcon'
139  } ))
140  
141
142  map.geoObjects.add(mySearchResults);
143  map.geoObjects.add(gCollection);
144  map.controls.add(mySearchControl);
145  
146  mySearchControl.events.add('resultselect', function (e) {
147    var index = e.get('index');
148    mySearchControl.getResult(index).then(function (res) {
149       mySearchResults.add(res);
150    });
151    }).add('submit', function () {
152        mySearchResults.removeAll();
153    });
154
155  
156
157	map.controls.remove('geolocationControl');
158  map.controls.remove('searchControl')
159  map.controls.remove('trafficControl'); 
160  map.controls.remove('typeSelector'); 
161  map.controls.remove('fullscreenControl'); 
162  map.controls.remove('zoomControl'); 
163  map.controls.remove('rulerControl'); 
164}
165
166
167$(document).ready(function () {
168  let mapOnPage = document.getElementById('school_map')
169  if(mapOnPage){
170    ymaps.ready(start);
171    option();
172  }
173});

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.