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