1(function($) 2{ 3 $.fn.opMap = function(options) 4 { 5 var opts = $.extend({}, $.fn.opMap.defaults, options); 6 var appData = $.parseJSON($('body').attr('data-jsdata')); 7 var master = $(this); 8 var mapsInit = false; 9 10 var init = function () { 11 if(!mapsInit) { 12 mapsInit = true; 13 master.each(function () { 14 var t = $(this); 15 16 var mode = t.attr('data-mode'); 17 18 var gMap = t.gMap({ 19 lang: appData.lang, 20 callback: function (gMap) { 21 // --- styles --- 22 23 gMap.setOptions({ 24 fullscreenControl: false, 25 streetViewControl: false, 26 mapTypeControl: false 27 }); 28 29 var styles = [{ 30 "elementType": "geometry", 31 "stylers": [{"color": "#f5f5f5"}] 32 }, { 33 "elementType": "labels.icon", 34 "stylers": [{"visibility": "off"}] 35 }, { 36 "elementType": "labels.text.fill", 37 "stylers": [{"color": "#616161"}] 38 }, { 39 "elementType": "labels.text.stroke", 40 "stylers": [{"color": "#f5f5f5"}] 41 }, { 42 "featureType": "administrative.land_parcel", 43 "elementType": "labels.text.fill", 44 "stylers": [{"color": "#bdbdbd"}] 45 }, { 46 "featureType": "poi", 47 "elementType": "geometry", 48 "stylers": [{"color": "#eeeeee"}] 49 }, { 50 "featureType": "poi", 51 "elementType": "labels.text.fill", 52 "stylers": [{"color": "#757575"}] 53 }, { 54 "featureType": "poi.park", 55 "elementType": "geometry", 56 "stylers": [{"color": "#e5e5e5"}] 57 }, { 58 "featureType": "poi.park", 59 "elementType": "labels.text.fill", 60 "stylers": [{"color": "#9e9e9e"}] 61 }, { 62 "featureType": "road", 63 "elementType": "geometry", 64 "stylers": [{"color": "#ffffff"}] 65 }, { 66 "featureType": "road.arterial", 67 "elementType": "labels.text.fill", 68 "stylers": [{"color": "#757575"}] 69 }, { 70 "featureType": "road.highway", 71 "elementType": "geometry", 72 "stylers": [{"color": "#dadada"}] 73 }, { 74 "featureType": "road.highway", 75 "elementType": "labels.text.fill", 76 "stylers": [{"color": "#616161"}] 77 }, { 78 "featureType": "road.local", 79 "elementType": "labels.text.fill", 80 "stylers": [{"color": "#9e9e9e"}] 81 }, { 82 "featureType": "transit.line", 83 "elementType": "geometry", 84 "stylers": [{"color": "#e5e5e5"}] 85 }, { 86 "featureType": "transit.station", 87 "elementType": "geometry", 88 "stylers": [{"color": "#eeeeee"}] 89 }, { 90 "featureType": "water", 91 "elementType": "geometry", 92 "stylers": [{"color": "#c9c9c9"}] 93 }, { 94 "featureType": "water", 95 "elementType": "labels.text.fill", 96 "stylers": [{"color": "#9e9e9e"}] 97 }]; 98 var styledMapType = new google.maps.StyledMapType(styles, {name: 'Kolkovna'}); 99 100 gMap.mapTypes.set('styled_map', styledMapType); 101 gMap.setMapTypeId('styled_map'); 102 103 // --- custom marker --- 104 105 CustomMarker.prototype = new google.maps.OverlayView(); 106 107 CustomMarker.svgIcon = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="211px" height="277px" viewBox="0 0 211 277" enable-background="new 0 0 211 277" xml:space="preserve"><g><path fill="%fill%" d="M180.519,179.547c18.279-18.525,29.791-43.793,30.369-71.857 C212.125,49.448,165.913,1.254,107.679,0.035C106.933,0.009,106.189,0,105.453,0C48.22-0.017,1.227,45.757,0.024,103.244 c-0.622,29.152,10.661,55.796,29.38,75.278l76.056,98.369L180.519,179.547z"/></g></svg>'; 108 109 function CustomMarker(opts) { 110 this.setValues(opts); 111 } 112 113 CustomMarker.prototype.colorSvg = function (color) { 114 if (typeof color === 'undefined') { 115 color = '#000000'; 116 } 117 return CustomMarker.svgIcon.replace('%fill%', color); 118 } 119 120 CustomMarker.prototype.draw = function () { 121 var self = this; 122 var div = this.div; 123 124 if (!div) { 125 var useColor = self.eleColor; 126 if (useColor === self.color) { 127 useColor = '#ffffff'; 128 } 129 130 if (mode === 'logo') { 131 var useImage = self.logo; 132 var useIcon = ''; 133 var offset = 250; 134 } else { 135 var useImage = self.letter; 136 var useIcon = self.colorSvg(self.color); 137 var offset = 70; 138 } 139 140 div = this.div = $( 141 '<div class="marker-outter marker-' + mode + '">' + 142 '<div class="marker-wrapper ' + self.cssClass + '">' + 143 useIcon + 144 '<div class="letter"><img src="' + useImage + '" alt="" style="-webkit-filter: drop-shadow(' + offset + 'px 0px ' + useColor + ');filter: drop-shadow(' + offset + ' 0px ' + useColor + ';" /></div>' + 145 '</div>' + 146 '<div class="tab tab-' + mode + '">' + self.tab + '</div>' + 147 '</div>' + 148 '')[0] 149 ; 150 151 div.style.position = 'absolute'; 152 div.style.cursor = 'pointer'; 153 div.style.zIndex = 1; 154 155 var panes = this.getPanes(); 156 157 panes.overlayImage.appendChild(div); 158 159 div.addEventListener('click', function (event) { 160 var target = $(event.target); 161 162 if (target.prop('nodeName') !== 'A' && target.parent().prop('nodeName') !== 'A') { 163 event.preventDefault(); 164 event.stopPropagation(); 165 event.stopImmediatePropagation(); 166 167 var ele = $(div); 168 var tab = ele.find('.tab'); 169 var isActive = tab.hasClass('active'); 170 171 t.find('.tab').removeClass('active'); 172 173 t.find('.marker-outter').css({'z-index': 1}); 174 175 t.find('.marker-wrapper').removeClass('active'); 176 t.find('.concept-' + self.concept).addClass('active'); 177 178 if (isActive) { 179 tab.removeClass('active'); 180 } else { 181 tab.addClass('active'); 182 ele.css({'z-index': 2}); 183 } 184 185 $('.concept-logo').removeClass('active'); 186 $('.concept-logo-' + self.concept).addClass('active'); 187 188 return false; 189 } 190 });
191 } 192 193 var point = this.getProjection().fromLatLngToDivPixel(this.position); 194 195 if (point) { 196 div.style.left = point.x + 'px'; 197 div.style.top = point.y + 'px'; 198 } 199 }; 200 201 // --- points --- 202 203 var jsonData = t.attr('data-operations'); 204 205 var mapCenter = false; 206 207 var fitMap = function (gMap, positions) { 208 if (typeof mapCenter !== 'undefined' && mapCenter !== false) { 209 gMap.setCenter(mapCenter); 210 gMap.setZoom(14); 211 } else if (positions && positions.length) { 212 var bounds = new google.maps.LatLngBounds(); 213 214 $.each(positions, function (i, position) { 215 if (typeof position !== 'undefined') { 216 bounds.extend(position); 217 } 218 }); 219 220 gMap.fitBounds(bounds, 100); 221 gMap.setCenter(bounds.getCenter()); 222 } 223 }; 224 225 if (jsonData !== '') { 226 var data = $.parseJSON(jsonData); 227 228 var mapMarkers = []; 229 var positions = []; 230 231 $.each(data, function (i, op) { 232 var coords = op.gps.split(','); 233 234 var position = new google.maps.LatLng(coords[0], coords[1]); 235 236 if (op.mainMap) { 237 positions[i] = position; 238 } 239 240 var cssClass = 'concept-' + op.concept + ' op-' + i + ' ' + op.cssClass; 241 242 if (op.cssClass.search('current') !== -1) { 243 mapCenter = position; 244 } 245 246 mapMarkers[i] = new CustomMarker({ 247 position: position, 248 map: gMap, 249 color: op.color, 250 eleColor: op.eleColor, 251 letter: op.icon, 252 logo: op.logo, 253 tab: op.tab, 254 cssClass: cssClass, 255 concept: op.concept 256 }); 257 258 /* 259 var marker = new google.maps.Marker({ 260 position: position, 261 map: gMap 262 }); 263 /**/ 264 });
265 266 fitMap(gMap, positions); 267 268 $(window).resize($.debounce(250, function () { 269 fitMap(gMap, positions); 270 })); 271 } 272 } 273 }); 274 }); 275 } 276 } 277 278 var observer = new MutationObserver(function (mutations) { 279 mutations.forEach(function (mutation) { 280 const el = mutation.target; 281 if ( 282 (!mutation.oldValue || !mutation.oldValue.match(/\aos-animate\b/)) 283 && mutation.target.classList 284 && mutation.target.classList.contains('aos-animate') 285 ) { 286 init(); 287 } 288 }); 289 }); 290 291 $('.op-map').each( function() { 292 observer.observe (this, { 293 attributes: true, 294 attributeOldValue: true, 295 attributeFilter: ['class'] 296 }); 297 }); 298 299 return master; 300 }; 301 302 $.fn.opMap.defaults = 303 { 304 305 }; 306}(jQuery)); 307 308$(document).ready(function($) { 309 $('.op-map').opMap(); 310});
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.