1/* 2 * @copyright 2019-2022 Dicr http://dicr.org 3 * @author Igor A Tarasov <[email protected]> 4 * @license proprietary 5 * @version 19.02.22 23:09:23 6 */ 7 8"use strict"; 9 10((window, $) => { 11 12 /** 13 * ÐÐ¸Ð´Ð¶ÐµÑ ÐºÐ°ÑÑÑ Ñилиалов. 14 * 15 * @constructor 16 * @param {HTMLElement|jQuery<HTMLElement>} widget 17 * @param {Object} options 18 */ 19 function LocationsMapWidget(widget, options) 20 { 21 let map; 22 const $widget = $(widget); 23 24 // var Ð´Ð»Ñ IE 25 // noinspection JSUnresolvedFunction,JSUnresolvedVariable 26 const opts = window.ymaps.util.bounds.getCenterAndZoom(window.ymaps.util.bounds.fromPoints($.map(options.locations, loc => { 27 // noinspection JSUnresolvedVariable 28 return [loc.geo]; 29 })), [$widget.width(), $widget.height()]); 30 31 if (opts.zoom > 16) { 32 opts.zoom = 16; 33 } 34 35 // noinspection JSUnusedGlobalSymbols 36 opts.controls = ["smallMapDefaultSet"]; 37 opts.behaviors = ["drag", "dblClickZoom", "multiTouch", "rightMouseButtonMagnifier"]; 38 39 // noinspection JSUnresolvedFunction,JSUnresolvedVariable 40 map = new window.ymaps.Map($widget[0], opts); 41 42 // noinspection JSUnresolvedVariable 43 $.each(options.locations, (i, loc) => { 44 // noinspection JSUnresolvedFunction,JSUnresolvedVariable 45 const mark = new window.ymaps.Placemark(loc.geo, { 46 hintContent: loc.name 47 }); 48 49 // noinspection JSUnresolvedVariable 50 map.geoObjects.add(mark); 51 }); 52 53 // noinspection JSUnresolvedVariable 54 window.ymaps.borders.load("RU", {quality: 0}).then(geojson => { 55 // noinspection JSUnresolvedFunction,JSUnresolvedVariable 56 const regions = window.ymaps.geoQuery(geojson); 57 // noinspection JSUnresolvedFunction 58 regions.addToMap(map); 59 }); 60 } 61 62 // noinspection JSUnusedGlobalSymbols 63 /** 64 * Ðлагин jQuery. 65 * 66 * @param {Object} options 67 * @returns {jQuery} 68 */ 69 $.fn.locationsMap = function (options) { 70 const $widgets = $(this); 71 72 // оÑÐ»Ð¾Ð¶ÐµÐ½Ð½Ð°Ñ Ð¸Ð½Ð¸ÑиализаÑÐ¸Ñ Ð´Ð¾ загÑÑзки каÑÑ 73 // noinspection JSUnresolvedVariable 74 window.ymaps.ready(() => { 75 // noinspection JSUnresolvedVariable 76 if (options.locations && options.locations.length > 0) { 77 $widgets.each(function () { 78 $(this).data('widget', new LocationsMapWidget(this, options)); 79 }); 80 } 81 }); 82 83 return this; 84 }; 85})(window, jQuery);
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.