1var placemarks = placemarks || []; 2var mapCoordinate = mapCoordinate || false; 3var mapButton = mapButton || false; 4var mapButton_toggle = false; 5var myMap; 6var clusterer = {}; 7var geoObjects = {}; 8var myGroup = {}; 9var unknown_price = 'УÑоÑнÑйÑе Ñ Ð´Ð¸Ð»ÐµÑа' 10 11var car_data = { 12 "ASX": { 13 image: '/files/images/auto/mini/asx.png', 14 url: 'asx' 15 }, 16 "Eclipse Cross": { 17 image: '/files/images/auto/mini/eclipse-cross.png', 18 url: 'eclipse-cross' 19 }, 20 "L200 Diesel IV": { 21 image: '/files/images/auto/mini/l200-15my.png', 22 url: 'l200-18my' 23 }, 24 "L200-18MY Diesel V": { 25 synonym: 'L200 Diesel V', 26 image: '/files/images/auto/mini/l200-18my.png', 27 url: 'l200-18my' 28 }, 29 "L200 Diesel V": { 30 image: '/files/images/auto/mini/l200.png', 31 url: 'l200' 32 }, 33 "Lancer": { 34 image: '/files/images/auto/mini/lancer-x.png', 35 url: 'lancer' 36 }, 37 "Outlander II XL": { 38 image: '/files/images/auto/mini/outlander-xl.png', 39 url: 'outlander' 40 }, 41 "Outlander III before17": { 42 synonym: 'Outlander III', 43 image: '/files/images/auto/mini/outlander.png', 44 url: 'outlander' 45 }, 46 "Outlander III": { 47 image: '/files/images/auto/mini/outlander.png', 48 url: 'outlander' 49 }, 50 "Pajero III": { 51 image: '/files/images/auto/mini/pajero-iii.png', 52 url: 'pajero-iv' 53 }, 54 "Pajero IV": { 55 image: '/files/images/auto/mini/pajero-iv.png', 56 url: 'pajero-iv' 57 }, 58 "Pajero IV Diesel": { 59 image: '/files/images/auto/mini/pajero-iv.png', 60 url: 'pajero-iv' 61 }, 62 "Pajero Sport": { 63 image: '/files/images/auto/mini/pajero-sport-16MY.png',
64 url: 'pajero-sport' 65 }, 66 "Pajero Sport Diesel": { 67 image: '/files/images/auto/mini/pajero-sport-16MY.png', 68 url: 'pajero-sport' 69 }, 70 "Pajero Sport QX": { 71 image: '/files/images/auto/mini/pajero-sport.png', 72 url: 'pajero-sport' 73 }, 74 "Pajero Sport QX Diesel": { 75 image: '/files/images/auto/mini/pajero-sport.png', 76 url: 'pajero-sport' 77 } 78}; 79 80function prepareBallonData(dealerObj) { 81 if (dealerObj.btn == undefined) dealerObj.btn = ''; 82 83 strHTML = '<table cellpadding="3" cellspacing="0" border="0" data-dccode="' + dealerObj.dcCode + '">'; 84 85 if (dealerObj.befText != undefined) { 86 strHTML += ' <tr>'; 87 strHTML += ' <td id="befText">' + dealerObj.befText + '</td>'; 88 strHTML += ' </tr>'; 89 } 90 if (dealerObj.name != undefined) { 91 strHTML += ' <tr>'; 92 strHTML += ' <td'; 93 if (dealerObj.park) { 94 strHTML += ' ><b>OffRoad Park</b> <b style="color:#ed1c24">«' + dealerObj.name + '»</b></td>'; 95 } else if (dealerObj.no_salon) { 96 strHTML += ' ><b>ÐвÑоÑеÑвиÑ</b><b style="color:#ed1c24">«' + dealerObj.name + '»</b></td>'; 97 } else { 98 if (dealerObj.service_partner === '1') { 99 strHTML += ' ><b>ÐвÑоÑалон</b> <b style="color:red">«' + dealerObj.name + '»</b><br><span style="color: grey">ÑеÑвиÑнÑй паÑÑнÑÑ</span></td>' 100 } else { 101 strHTML += ' ><b>ÐвÑоÑалон</b> <b style="color:red">«' + dealerObj.name + '»</b></td>'; 102 } 103 } 104 strHTML += ' </tr>'; 105 } 106 if (dealerObj.address != undefined) { 107 strHTML += ' <tr>'; 108 strHTML += ' <td>' + dealerObj.address + '</td>'; 109 strHTML += ' </tr>'; 110 } 111 if (dealerObj.phone != undefined) { 112 strHTML += ' <tr>'; 113 strHTML += ' <td style="font-size:120%;">' + dealerObj.phone + '</td>'; 114 strHTML += ' </tr>'; 115 } 116 117 if (dealerObj.www != undefined) { 118 strHTML += ' <tr>'; 119 strHTML += ' <td><a href="https://' + dealerObj.www + '" target="_blank" class="red" onclick="ym(155501,\'reachGoal\',\'СеÑвиÑ_19_ÐеÑÐµÑ Ð¾Ð´_на_ÑайÑ_дилеÑа\');">' + dealerObj.www + '</a>' + dealerObj.btn + '</td>'; 120 strHTML += ' </tr>'; 121 } 122 if (dealerObj.button_to != undefined && dealerObj.price != false) { 123 strHTML += ' <tr>'; 124 var link_hash = ''; 125 if (car_data[car_names.val()].url != undefined) 126 link_hash = '#' + car_data[car_names.val()].url; 127 var toggle_attr = ''; 128 if (mapButton_toggle) 129 toggle_attr = ' data-toggle="modal" data-target="' + mapButton_toggle + '" '; 130 strHTML += '<td><button id="choose_diler" data-standart-price="0" class="btn btn-danger go-to-action" ' + toggle_attr + ' onclick="ym(155501,\'reachGoal\',\'СеÑвиÑ_19_ÐеÑÐµÑ Ð¾Ð´_на_ÑайÑ_дилеÑа\');getToByDealer("' + dealerObj.id + '",' + dealerObj.sumworks + ',' + dealerObj.sumworks3 + ',' + dealerObj.price + ',' + dealerObj.plus3 + ',"' + dealerObj.dcCode + '"); return false;">ÐÑбÑаÑÑ Ð´Ð¸Ð»ÐµÑа</button></td>'; 131 strHTML += ' </tr>'; 132 } 133 strHTML += '</table>'; 134 return strHTML; 135} 136 137var semaphore = false; 138 139try { 140 function initMap(selector_id) { 141 142 if (semaphore) { 143 return 144 } 145 semaphore = true 146 147 let exception = [ 148 '/for-mitsubishi-owners/map/', 149 ] 150 if (exception.includes(window.location.pathname)) { 151 return 152 } 153 154 if (!selector_id) { 155 selector_id = 'map'; 156 } 157 158 ymaps.ready(function () { 159 //ÑÑандаÑÑное положение ÐоÑÐºÐ²Ñ 160 var new_lat = 55.75396, 161 new_lon = 37.620393; 162
163 // Флаг вÑноÑим ÑÑда, ÑÑÐ¾Ð±Ñ Ð¾Ð½ бÑл виден и внÑÑÑи getMapCoordinate(), и в .then() ÑнаÑÑжи 164 var geolocatedSuccessfully = false; 165 166 function getMapCoordinate() { 167 return new Promise((resolve) => { 168 if (!mapCoordinate) { 169 // СнаÑала пÑÑаемÑÑ Ð½Ð°Ð¹Ñи гоÑод из ÑелекÑа 170 let selectedCityElement = document.getElementById('delaerselect') || document.getElementById('delaerselectmap'); 171 let selectedCityName = null; 172 173 if (selectedCityElement && selectedCityElement.value) { 174 selectedCityName = selectedCityElement.value.trim(); 175 } 176 177 // ÐÑли еÑÑÑ Ð²ÑбÑаннÑй гоÑод, иÑем в нем дилеÑа 178 if (selectedCityName && selectedCityName !== '') { 179 const dealerInSelectedCity = placemarks.find(dealer => { 180 const dealerCity = dealer.address.split(',')[0].trim(); 181 return dealerCity === selectedCityName; 182 }); 183 184 if (dealerInSelectedCity) { 185 mapCoordinate = { 186 lat: parseFloat(dealerInSelectedCity.lat), 187 lon: parseFloat(dealerInSelectedCity.lon), 188 zoom: 10 189 }; 190 //console.log('Ðайден Ð´Ð¸Ð»ÐµÑ Ð² вÑбÑанном гоÑоде, кооÑдинаÑÑ:', mapCoordinate); 191 resolve(mapCoordinate); 192 return; 193 } 194 } 195 196 // ÐÑли гоÑод не вÑбÑан или Ð´Ð¸Ð»ÐµÑ Ð½Ðµ найден, пÑобÑем геолокаÑÐ¸Ñ 197 ymaps.geolocation.get({ 198 provider: 'browser', 199 mapStateAutoApply: false, 200 timeout: 9000 // ÑвелиÑен Ñ 3000: Chrome на деÑкÑопе без GPS ÑаÑÑо не ÑÑпевал за 3 Ñек 201 }).then(function (result) { 202 var geolocation = result.geoObjects.get(0); 203 if (geolocation) { 204 var coords = geolocation.geometry.getCoordinates(); 205 mapCoordinate = { 206 lat: coords[0], 207 lon: coords[1], 208 zoom: 10 209 }; 210 geolocatedSuccessfully = true; 211 //console.log('ÐооÑдинаÑÑ Ð¸Ð· геолокаÑии:', mapCoordinate); 212 } 213 resolve(mapCoordinate); 214 }).catch(function (error) { 215 // ÐеолокаÑÐ¸Ñ Ð½ÐµÐ´Ð¾ÑÑÑпна или иÑÑÑк ÑаймаÑÑ â иÑполÑзÑем ÐоÑквÑ. 216 // Ранее здеÑÑ Ð±ÑалÑÑ placemarks[0] (пеÑвÑй Ð´Ð¸Ð»ÐµÑ Ð² ÑпиÑке),
217 // коÑоÑÑй оказÑвалÑÑ Ð² ÐÑÑ Ð°Ð½Ð³ÐµÐ»ÑÑке (пеÑвÑй по алÑавиÑÑ), 218 // из-за Ñего вÑе полÑзоваÑели Ñ Ð¿Ñоблемной геолокаÑией 219 // полÑÑали ÑедиÑÐµÐºÑ Ð½Ð° ÑÑÑаниÑÑ Ð°ÑÑ Ð°Ð½Ð³ÐµÐ»ÑÑÐºÐ¸Ñ Ð´Ð¸Ð»ÐµÑов. 220 //console.log('ÐеолокаÑÐ¸Ñ Ð½ÐµÐ´Ð¾ÑÑÑпна, иÑполÑзÑем ÐоÑÐºÐ²Ñ Ð¿Ð¾ ÑмолÑаниÑ'); 221 mapCoordinate = {lat: new_lat, lon: new_lon, zoom: 10}; 222 resolve(mapCoordinate); 223 }); 224 } else { 225 resolve(mapCoordinate); 226 } 227 }); 228 } 229 230 getMapCoordinate().then(coords => { 231 // Ðогика поиÑка ближайÑего дилеÑа (оÑÑавлÑем как бÑло) 232 // ФÑнкÑÐ¸Ñ ÑаÑÑеÑа ÑаÑÑÑоÑÐ½Ð¸Ñ Ð¼ÐµÐ¶Ð´Ñ Ð´Ð²ÑÐ¼Ñ ÑоÑками (в км) 233 function getDistance(lat1, lon1, lat2, lon2) { 234 const R = 6371; 235 const dLat = (lat2 - lat1) * Math.PI / 180; 236 const dLon = (lon2 - lon1) * Math.PI / 180; 237 const a = 238 Math.sin(dLat / 2) * Math.sin(dLat / 2) + 239 Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * 240 Math.sin(dLon / 2) * Math.sin(dLon / 2); 241 const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 242 return R * c; 243 } 244 245 // ФÑнкÑÐ¸Ñ Ð¿Ð¾Ð¸Ñка ближайÑего дилеÑа 246 function findNearestDealer(point, dealers) { 247 let minDistance = Infinity; 248 let nearestDealer = null; 249 250 for (const dealer of dealers) { 251 const distance = getDistance( 252 parseFloat(dealer.lat), 253 parseFloat(dealer.lon), 254 point.lat, 255 point.lon 256 ); 257 258 if (distance < minDistance) { 259 minDistance = distance; 260 nearestDealer = dealer; 261 } 262 } 263 264 return { 265 dealer: nearestDealer, 266 distance: minDistance 267 }; 268 } 269 270 let result; 271 272 let selectedCity = document.getElementById('delaerselect') 273 if (selectedCity && selectedCity.value) { 274 // ÐÑем дилеÑа в вÑбÑанном гоÑоде 275 const selectedCityName = selectedCity.value; 276 const dealerInCity = placemarks.find(dealer => { 277 const dealerCity = dealer.address.split(',')[0].trim(); 278 return dealerCity === selectedCityName; 279 }); 280 281 if (dealerInCity) { 282 // Создаем ÑезÑлÑÑÐ°Ñ Ñ Ð½Ð°Ð¹Ð´ÐµÐ½Ð½Ñм дилеÑом 283 result = { 284 dealer: dealerInCity, 285 distance: 0 286 }; 287 //console.log("Ðайден Ð´Ð¸Ð»ÐµÑ Ð² вÑбÑанном гоÑоде: ", dealerInCity.name); 288 } else { 289 //console.log("РвÑбÑанном гоÑоде не найдено дилеÑов"); 290 result = findNearestDealer(mapCoordinate, placemarks); 291 } 292 293 //console.log('РезÑлÑÑÐ°Ñ Ð¿Ð¾Ð¸Ñка дилеÑа: ', result); 294 } else { 295 result = findNearestDealer(mapCoordinate, placemarks); 296 } 297 298 if (result.dealer) { 299 const city = result.dealer.address.split(',')[0].trim(); 300 //console.log(`ÐлижайÑий дилеÑ: ${result.dealer.name} (${result.dealer.lat}, ${result.dealer.lon})`); 301 //console.log(`ÐоÑод дилеÑа: ${city}`); 302 303 // ÐбновлÑем кооÑдинаÑÑ Ð´Ð»Ñ ÐºÐ°ÑÑÑ 304 mapCoordinate.lat = parseFloat(result.dealer.lat); 305 mapCoordinate.lon = parseFloat(result.dealer.lon); 306 307 // Ðогика пеÑенапÑÐ°Ð²Ð»ÐµÐ½Ð¸Ñ (оÑÑавлÑем как бÑло) 308 const currentUrl = window.location.href; 309 const targetUrls = [ 310 'https://www.mitsubishi-motors.ru/for-byers/dealers', 311 'https://www.mitsubishi-motors.ru/for-byers/dealers/', 312 'https://www.mitsubishi-motors.kz/for-byers/dealers', 313 'https://www.mitsubishi-motors.kz/for-byers/dealers/' 314 ]; 315 316 const isTargetUrl = targetUrls.some(url => 317 currentUrl.startsWith(url) && 318 currentUrl.length <= url.length + 1 319 ); 320 321 // РедиÑÐµÐºÑ ÑолÑко еÑли геолокаÑÐ¸Ñ Ð±ÑаÑзеÑа ÑеалÑно оÑÑабоÑала. 322 // Ðез ÑÑой пÑовеÑки пÑи лÑбом Ñбое геолокаÑии полÑзоваÑÐµÐ»Ñ 323 // ÑлеÑал в гоÑод из ÑолбÑка (Ñанее â ÐÑÑ Ð°Ð½Ð³ÐµÐ»ÑÑк). 324 if (isTargetUrl && city && geolocatedSuccessfully) { 325 if (sessionStorage.getItem('dealers_all_rf_selected')) { 326 sessionStorage.removeItem('dealers_all_rf_selected'); 327 //console.log('ÐеÑенапÑавление пÑопÑÑено: полÑзоваÑÐµÐ»Ñ Ð²ÑбÑал "ÐÑе дилеÑÑ Ð Ð¤"'); 328 } else { 329 const newUrl = `${window.location.origin}/for-byers/dealers/${city}`; 330 //console.log('ÐеÑенапÑавлÑем на:', newUrl); 331 window.location.href = newUrl; 332 } 333 } 334 } else { 335 console.log("ÐилеÑÑ Ð½Ðµ найденÑ"); 336 } 337 }); 338 339 setTimeout(function () { 340 // Создаем каÑÑÑ 341 if (mapCoordinate == false) { 342 // ÐÑли вÑе еÑе false, иÑполÑзÑем ÐоÑÐºÐ²Ñ 343 mapCoordinate = {lat: new_lat, lon: new_lon, zoom: 10}; 344 } 345 346 // pathname надÑжнее полного href â не завиÑÐ¸Ñ Ð¾Ñ Ð¿ÑоÑокола и домена. 347 var isAllDealersPage = ( 348 window.location.pathname === '/for-byers/dealers/' || 349 window.location.pathname === '/for-byers/dealers' 350 ); 351 352 myMap = new ymaps.Map(selector_id, { 353 center: [mapCoordinate.lat, mapCoordinate.lon], 354 behaviors: ['default'], 355 zoom: mapCoordinate.zoom || 10 356 }); 357 358 myMap.controls.add('zoomControl', {left: 5, top: 230}); 359 myMap.behaviors.disable('scrollZoom'); 360 361 if ($('body').width() <= 767 && $('#' + selector_id).attr('no-block-small-screen') == undefined) { 362 myMap.behaviors.disable('multiTouch'); 363 myMap.behaviors.disable('drag'); 364 } 365 366 // ÐÑÑалÑной код иниÑиализаÑии каÑÑÑ... 367 if (mapCoordinate.zoom == false) { 368 myGroup = new ymaps.GeoObjectCollection(); 369 for (var point in placemarks) { 370 myGroup.add(new ymaps.Placemark([placemarks[point].lat, placemarks[point].lon])); 371 } 372 myMap.geoObjects.add(myGroup); 373 myMap.setBounds(myGroup.getBounds()); 374 myGroup.removeAll(); 375 } 376 377 geoObjects = []; 378 drawPlacemarks(placemarks); 379 380 // Ðа ÑÑÑаниÑе "ÐÑе дилеÑÑ Ð Ð¤" каÑÑа изнаÑалÑно ÑкÑÑÑа (display:none), 381 // поÑÑÐ¾Ð¼Ñ setBounds даÑÑ zoom=0 â конÑÐµÐ¹Ð½ÐµÑ 0Ã0 и Yandex Maps не Ð¼Ð¾Ð¶ÐµÑ 382 // вÑÑиÑлиÑÑ Ð½ÑжнÑй zoom. ÐÑполÑзÑем setCenter Ñ ÑвнÑм zoom: он не завиÑÐ¸Ñ 383 // Ð¾Ñ ÑазмеÑов конÑейнеÑа и коÑÑекÑно пÑименÑеÑÑÑ Ðº ÑкÑÑÑÐ¾Ð¼Ñ ÑлеменÑÑ. 384 if (isAllDealersPage && placemarks && placemarks.length > 0) { 385 var _lats = [], _lons = []; 386 for (var _i = 0; _i < placemarks.length; _i++) { 387 var _lat = parseFloat(placemarks[_i].lat); 388 var _lon = parseFloat(placemarks[_i].lon);
389 if (!isNaN(_lat) && !isNaN(_lon) && _lat > 40 && _lat < 82 && _lon > 18 && _lon < 190) { 390 _lats.push(_lat); 391 _lons.push(_lon); 392 } 393 } 394 var _cLat = _lats.length > 0 395 ? (Math.min.apply(null, _lats) + Math.max.apply(null, _lats)) / 2 396 : 62; 397 var _cLon = _lons.length > 0 398 ? (Math.min.apply(null, _lons) + Math.max.apply(null, _lons)) / 2 399 : 94; 400 myMap.setCenter([_cLat, _cLon], 3); 401 } 402 403 // ÐбÑабоÑÑик Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑелекÑа delaerselectmap 404 $('#delaerselectmap').unbind().on('change', function () { 405 if (typeof ShowDealerList !== 'undefined') 406 ShowDealerList(); 407 408 // ÐÑем дилеÑа в вÑбÑанном гоÑоде 409 const selectedCityName = $(this).val(); 410 const dealerInCity = placemarks.find(dealer => { 411 const dealerCity = dealer.address.split(',')[0].trim(); 412 return dealerCity === selectedCityName; 413 }); 414 415 if (dealerInCity) { 416 myMap.setCenter([dealerInCity.lat, dealerInCity.lon]); 417 } 418 }); 419 420 if (placemarks != null && placemarks.length > 0) { 421 $(".select2.form-control.form-dealer.required").on('change', function () { 422 var selected_dealer_id = $(this).val(); 423 var current = placemarks.filter(function (item) { 424 return item.id == selected_dealer_id; 425 })[0]; 426 427 if (current != undefined) { 428 myMap.setCenter([current.lat, current.lon]); 429 } 430 }); 431 } 432 433 let exception = [ 434 '/for-byers/dealers/', 435 '/for-byers/test-drive/', 436 '/' 437 ] 438 439 if (mapCoordinate.zoom == false && !exception.includes(window.location.pathname)) { 440 myMap.setZoom(10, { 441 smooth: true, 442 duration: 2000 443 }) 444 } 445 446 }, 500); 447 }); 448 } 449} catch (e) { 450 console.log(e) 451} 452 453 454var getPointData = function (placemark) { 455 return { 456 balloonContentBody: prepareBallonData(placemark), 457 clusterCaption: placemark.name 458 }; 459};
460 461 462var getPointOptions = function (iconImageHref, service_partner) { 463 iconImageHref = iconImageHref || '/static/images/inner/map_icon.png'; 464 if (service_partner == '1') { 465 iconImageHref = '/static/images/inner/map_icon_service.png' 466 } 467 return { 468 iconLayout: 'default#image', 469 iconImageHref: iconImageHref, 470 iconImageSize: [37, 42], 471 iconImageOffset: [-11, -42] 472 }; 473} 474 475 476function ShowDealerList(_placemarks) { 477 dealer_list.html(''); 478 479 if (_placemarks !== undefined && _placemarks != null && dealer_list !== undefined) { 480 var current_city = cities.find("option:selected"); 481 var lat = parseFloat(current_city.attr("data-lat")), 482 lon = parseFloat(current_city.attr("data-lon")); 483 _placemarks.sort(function (a, b) { 484 var a_lon = parseFloat(a.lon), 485 a_lat = parseFloat(a.lat); 486 var b_lon = parseFloat(b.lon), 487 b_lat = parseFloat(b.lat); 488 return getDistance(lat, lon, a_lat, a_lon) - getDistance(lat, lon, b_lat, b_lon); 489 }
489).forEach(function (item) { 490 if (item.dcCode !== 'qqqq') { 491 var html = $('<div href="#" class="diler"></div>') 492 .attr('data-lon', item.lon) 493 .attr('data-lat', item.lat) 494 .attr('data-dccode', item.dcCode) 495 .append('<div class="diler-adres-btn"><p class="text text_500">' + item.name + '</p>') 496 .append('<p class="text-small">' + item.address + '</p>') 497 .append('<a class="text-small" href="tel:' + item.phone + '">' + item.phone + '</a></div>') 498 .append('<div><div class="text-small text_500 diler_price"><p>СÑандаÑÑÐ½Ð°Ñ ÑÑоимоÑÑÑ</p> <p class="text_500 text price">' + 499 (item.price > 0 ? number_format(item.price, 0, ' ', ' ') + currency : unknown_price) + 500 ' â½</p></div></div>') 501 .append('<div><div class="text-small text_500 diler_price3"><p>СÑоимоÑÑÑ Ð¿Ð¾ пÑогÑамме 3+</p> <p class="text_500 text price_3plus">' + 502 0 + ' â½</p></div></div>') 503 // (item.sumworks3 > 0 ? number_format(item.sumworks3, 0, ' ', ' ') + currency : unknown_price) 504 // ' data-toggle="modal" data-target="' + mapButton_toggle + '" '; 505 // .append('<p><a class="site" href="https://' + item.button_to + '#' + car_data[car_names.val()].url + '" data-toggle="modal" data-target="' + mapButton_toggle + '">ÐапиÑÑ Ð½Ð° ТÐ</a></p>') 506 .appendTo(dealer_list); 507 myMap.balloon.close(); 508 } 509 }); 510 dealer_list.animate({scrollTop: 0}, 500); 511 dealer_list.attr('style', ''); 512 } else { 513 console.log('__placemarks_is__undefined'); 514 } 515} 516 517 518function showPrice(v, dcCode) { 519 if (v.price > 0) { 520 $('#to-div-totprice').html('<h3 class="h3">' + number_format(v.price, 0, ' ', ' ') + ' <i class="fa fa-rub"></i></h3>'); 521 } else { 522 $('#to-div-totprice').html('<h3 class="h3">' + unknown_price + '</h3>'); 523 $('#to-div-totprice').html('<h3 class="h3">' + unknown_price + '</h3>'); 524 } 525 526 if (v.price3 > 0) { 527 $('#to-div-totprice3').html('<h3 class="h3">' + number_format(v.price3, 0, ' ', ' ') + ' <i class="fa fa-rub"></i></h3>'); 528 } else { 529 $('#to-div-totprice3').html('<h3 class="h3">' + unknown_price + '</h3>'); 530 } 531 532 if (typeof active_dealer_on_list === 'function') { 533 active_dealer_on_list(dcCode); 534 } 535 536 if (typeof to_types_set_value === 'function') { 537 to_types_set_value(dcCode); 538 } 539} 540 541 542function resetSearchInput() { 543 $("#delaerselect").prop('selectedIndex', 0); 544} 545 546 547function openBaloon(index) { 548 const geoObject = geoObjects[index]; 549 550 if (geoObject && typeof geoObject.balloon.open === "function") { 551 geoObject.balloon.open(); 552 } 553} 554 555 556function changeShowingBaloon(_placemarks, cityName) { 557 $.each(_placemarks, function (i, v) { 558 const address = v.address.split(",")[0]; 559 if (address && address === cityName) { 560 if (document.body.classList.contains('zoomCity')) { // добавлен ÑпеÑиалÑно клаÑÑ ÑÑо Ð±Ñ Ð½Ðµ на вÑÐµÑ ÐºÐ°ÑÑÐ°Ñ Ð±Ñло пÑиблежение пÑи вÑбоÑе гоÑода 561 myMap.setZoom(10) 562 myMap.setCenter([v.lat, v.lon]) 563 } 564 openBaloon(i); 565 } 566 }) 567} 568 569 570function drawPlacemarks(_placemarks) { 571 resetSearchInput(); 572 573 if (geoObjects.length) { 574 for (var i in geoObjects) { 575 myMap.geoObjects.remove(geoObjects[i]); 576 geoObjects[i] = {}; 577 } 578 } 579 580 geoObjects = []; 581 582 //myGroup.removeAll(); 583 //_placemarks =[]; 584 585 if (_placemarks != null && _placemarks.length > 0) { 586 $.each(_placemarks, function (i, v) { 587 var icon = $(this)[0].icon; 588 //var icon = '/static/images/inner/map_icon_gray.png'; 589 590 if (v.befText == '<div>УÑоÑнÑйÑе ÑÑоимоÑÑÑ Ñ Ð´Ð¸Ð»ÐµÑа</div>') { 591 icon = '/static/images/inner/map_icon_gray.png'; 592 } 593 594 var dcCode = $(this)[0].dcCode; 595 geoObjects[i] = new ymaps.Placemark([v.lat, v.lon], getPointData(v), getPointOptions(icon, v.service_partner)); 596 597 if (v.price !== false) { 598 geoObjects[i].events.add('click', function (e) { 599 showPrice(v, dcCode); 600 }); 601 } 602 }); 603 604 $(".select2").change(function () { 605 const value = $(this).val(); 606 changeShowingBaloon(_placemarks, value); 607 }); 608 } 609 610 clusterer = new ymaps.Clusterer({ 611 preset: 'islands#invertedRedClusterIcons', 612 groupByCoordinates: false, 613 clusterDisableClickZoom: false 614 });
615 616 617 clusterer.options.set({ 618 gridSize: 8, 619 }); 620 621 622 clusterer.add(geoObjects); 623 624 myMap.geoObjects.removeAll(); 625 myMap.geoObjects.add(clusterer); 626 627 if (mapButton) { 628 var button = new ymaps.control.Button({ 629 data: { 630 content: '<a target="_blank" href="' + mapButton.link + '">' + mapButton.name + '</a>' 631 } 632 }, { 633 selectOnClick: false, 634 layout: ymaps.templateLayoutFactory.createClass("<div class='mapLink'>" + "$[data.content]" + "</div>") 635 }); 636 637 myMap.controls.add(button, {bottom: 5, right: 5}); 638 } 639} 640 641function getToByDealer(dealer_id, sumworks_dealer, sumworks_dealer_3, price, plus3, dcCode) { 642 643 var dealer = placemarks.find(function (item) { 644 return item.id === dealer_id; 645 }); 646 647 $("#dc-select").html("<strong> ÐÑбÑан дилеÑ: " + dealer.name + "</strong>"); 648 $("#dc-select").attr("data-dccode", dealer.dcCode); 649 650 651 var amountDopWorks = 0; 652 $('#dopWorks').find('input:checked').each(function () { 653 amountDopWorks += dop_works_work[$(this).attr('extra-id')][dcCode].price; 654 }); 655 656 657 var priceCalc = dealer_list.find('[data-dccode=' + dcCode + '] .price').html(); 658 659 var priceCalc3 = dealer_list.find('[data-dccode=' + dcCode + '] .price_3plus').html(); 660 661 662 var amountWork3 = $('#amount-program-3-plus-table').find("#amount_work_3"), 663 //ÑÑоимоÑÑÑ ÑÐ°Ð±Ð¾Ñ (ÑÑандаÑÑÐ½Ð°Ñ ÑÑоимоÑÑÑ) 664 amountWork = $('#amount-standart-table').find("#amount_work"), 665 amount_totspart = $('#amount-standart-table').find("#amount_totspart").attr('data-item'), //Techservice.calculatormin.totspartssum 666 amount_totspart_witch_work = $('#amount-standart-table').find("#amount_totspart").text(), 667 allsumm = $('#amount-standart-table').find("#allsumm"), 668 amount_totspart_3 = $('#amount-program-3-plus-table').find("#amount_totspart_3").attr('data-item'), 669 table_select_work_to = $("#table-select-work-to"); 670 allsumm3 = $('#amount-program-3-plus-table').find("#allsumm3"); 671 672 amountWork.html(moneyFormat(sumworks_dealer + parseFloat(amountDopWorks)) + 'â½'); 673 amountWork.attr('data-val', sumworks_dealer); 674 675 amount_totspart_witch_work = amount_totspart_witch_work.replace(" ", ""); 676 amount_totspart_witch_work = amount_totspart_witch_work.replace(",", "."); 677 amount_totspart_witch_work = amount_totspart_witch_work.replace("â½", ""); 678 679 //ÑÑмма СÑоимоÑÑÑ Ð·Ð°Ð¿Ð°ÑнÑÑ ÑаÑÑей + ÑÑмма ÑÐ°Ð±Ð¾Ñ ÐºÐ¾Ð½ÐºÑеÑного дилеÑа 680 allsumm.html(moneyFormat(parseFloat(amount_totspart_witch_work) + parseFloat(sumworks_dealer) + parseFloat(amountDopWorks)) + 'â½'); 681 682 683 table_select_work_to.attr('data-diler-id', dealer_id); 684 685 /* Ðлок доп даннÑÑ Ð´Ð»Ñ ÑоÑÐ¼Ñ */ 686 687 688 document.querySelector("#select-work-to").removeAttribute("class"); 689 var car_names = $('.calc_settings select#car-name'); 690 var car_drives = $('.calc_settings select#car-drive'); 691 var car_kpps = $('.calc_settings select#car-kpp'); 692 var car_wds = $('.calc_settings select#car-wd'); 693 var ages = $('.calc_settings select#car-age'); 694 var periods = $('.calc_settings select#period-to'); 695 // var dealer_list = $('.container_map-diler #dealer_list'); 696 697 auto_url = car_data[car_names.val()].url; 698 $('.form_inner').find('[data-field="FormICar"]').val(auto_url); 699 $('.form-dealer').val(dealer_id).trigger("change"); 700 701 $('.form_inner').find('[placeholder="ÐÑÑÐ³Ð°Ñ Ð¼Ð¾Ð´ÐµÐ»Ñ"]').val(auto_url); 702 $('.form_inner').find('[placeholder="ÐÑÑÐ³Ð°Ñ Ð¼Ð¾Ð´ÐµÐ»Ñ"]').hide(); 703 $('.form_inner').find('[placeholder="ÐÑÑÐ³Ð°Ñ Ð¼Ð¾Ð´ÐµÐ»Ñ"]').closest('.form-group').hide(); 704 //$('.form_inner').find('[placeholder="ÐÑÑÐ³Ð°Ñ Ð¼Ð¾Ð´ÐµÐ»Ñ"]').hide(); 705 $('.form_inner').find('[placeholder="ÐÑобег"]').val(periods.find('option:selected').text()); 706 $('.form_inner').find('[placeholder="ÐÑобег"]').hide(); 707 $('.form_inner').find('[placeholder="ÐÑобег"]').closest('.form-group').hide(); 708 709 $('.form_inner').find('[placeholder="Ðод вÑпÑÑка"]').val(car_names.find('option:selected').attr('data-year')); 710 $('.form_inner').find('[placeholder="Ðод вÑпÑÑка"]').hide(); 711 $('.form_inner').find('[placeholder="Ðод вÑпÑÑка"]').closest('.form-group').hide(); 712 713 $('.form_inner').find('[placeholder="ÐÑбеÑиÑе дилеÑа"]').hide(); 714 $('.form_inner').find('[placeholder="ÐÑбеÑиÑе дилеÑа"]').closest('.form-group').hide(); 715 716 $("#calc_form").removeClass('d-none'); 717 718 var scrollDiv = document.getElementById("scroll-select-work").offsetTop; 719 window.scrollTo({top: scrollDiv, behavior: 'smooth'}); 720} 721 722 723function moneyFormat(n) { 724 return parseFloat(n).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1 ").replace('.', ','); 725} 726 727 728var vis_map = 0; 729 730$(document).ready(function () { 731 732 $('.btn-map').bind('click', function () { 733 if (vis_map == 0) { 734 $('#mob_block').css('display', 'none'); 735 myMap.behaviors.enable('multiTouch'); 736 myMap.behaviors.enable('drag'); 737 vis_map = 1; 738 return false; 739 } else { 740 $('#mob_block').css('display', 'block'); 741 myMap.behaviors.disable('multiTouch'); 742 myMap.behaviors.disable('drag'); 743 vis_map = 0; 744 return false; 745 } 746 }) 747})
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.