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