1jQuery( window ).on( 'load', function(){ 2 if( jQuery( '.wp_mapit_multipin_map' ).length > 0 ) { 3 jQuery( '.wp_mapit_multipin_map' ).each( function() { 4 var _this = jQuery(this); 5 6 var _id = _this.attr( 'id' ); 7 var _lat = _this.data( 'lat' ); 8 var _lng = _this.data( 'lng' ); 9 var _zoom = _this.data( 'zoom' ); 10 var _type = _this.data( 'type' ); 11 var _marker = _this.data( 'marker' ); 12 var _width = _this.data( 'width' ); 13 var _width_type = _this.data( 'width-type' ); 14 var _height = _this.data( 'height' ); 15 var _height_type = _this.data( 'height-type' ); 16 var _pins = _this.data( 'pins' ); 17 18 _this.css( { 'width' : _width + (_width_type == 'per' ? 'vw' : _width_type), 'height' : _height + (_height_type == 'per' ? 'vh' : _height_type), 'margin' : '0 auto', 'max-width' : '100%', 'min-width' : '300px', 'max-height' : '100%' } ); 19 20 var wp_mapit_multipin_map = L.map(_id, { fullscreenControl: true, gestureHandling: true } ).setView([ _lat, _lng], _zoom); 21 22 var _layerImage = '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; 23 var _attribution = 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'; 24 25 var _class = ''; 26 27 switch( _type ) { 28 case 'grayscale': 29 _class = 'grayscale'; 30 break; 31 case 'topographic': 32 _layerImage = '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png'; 33 _attribution = 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'; 34 break; 35 } 36 37 wp_mapit_multipin_base_layer = L.tileLayer(_layerImage, { 38 attribution: wp_mapit.plugin_attribution + _attribution, 39 className: _class 40 }).addTo(wp_mapit_multipin_map); 41 42 if( _pins.length > 0 ) { 43 44 _pins.forEach( function( _pin ) { 45 46 var _img = new Image(); 47 _img.src = ( jQuery.trim( _pin['marker_image'] ) != '' ? _pin['marker_image'] : _marker ); 48 _img.onload = function() { 49 50 _img_height = ( this.height > 100 ? 100 : this.height ); 51 _img_width = ( this.width > 100 ? 100 : this.width ); 52 53 _img_halfWidth = _img_width / 2; 54 55 var wp_mapit_map_marker = new L.Marker( [_pin['lat'], _pin['lng']], { 56 icon: L.icon( { iconUrl: this.src, iconSize: [ _img_width, _img_height ], iconAnchor: [ _img_halfWidth, _img_height ] } ) 57 } ).addTo( wp_mapit_multipin_map ); 58 59 wp_mapit_map_marker.closePopup(); 60 wp_mapit_map_marker.unbindPopup(); 61 62 wp_mapit_map_marker.off( 'click' ); 63 64 if( jQuery.trim( _pin['marker_url'] ) != '' ) { 65 wp_mapit_map_marker._url = _pin['marker_url']; 66 wp_mapit_map_marker.on( 'click', function() { 67 window.open( this._url ); 68 } ); 69 70 } else { 71 _html = ''; 72 73 if( jQuery.trim( _pin['marker_title'] ) != '' ) { 74 _html += '<h3>' + _pin['marker_title'] + '</h3>'; 75 } 76 77 if( jQuery.trim( _pin['marker_content'] ) != '' ) { 78 79 _content = _pin['marker_content'].split( '\n' ).join( '<br>' ); 80 81 _html += '<p>' + _content + '</p>'; 82 } 83 84 85 if ( _html != '' ) { 86 var popup = L.responsivePopup( { offset: [ 20, 20 ] } ).setContent( _html ); 87 wp_mapit_map_marker.bindPopup( popup ); 88 } 89 } 90 } 91 } ); 92 } 93 94 }); 95 } 96});
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.