1jQuery(window).load(function($) { 2 if (jQuery(".lp_home").is("#homeMap")) { 3 jQuery('#homeMap').empty(); 4 $defLat = jQuery('body').data('defaultmaplat'); 5 $defLong = jQuery('body').data('defaultmaplot'); 6 7 L.Google = L.Class.extend({ 8 includes: L.Mixin.Events, 9 options: { 10 minZoom: 0, 11 maxZoom: 18, 12 tileSize: 256, 13 subdomains: 'abc', 14 errorTileUrl: '', 15 attribution: '', 16 opacity: 1, 17 continuousWorld: false, 18 noWrap: false, 19 }, 20 initialize: function(type, options) { 21 L.Util.setOptions(this, options); 22 this._type = google.maps.MapTypeId[type || 'SATELLITE']; 23 }, 24 onAdd: function(map, insertAtTheBottom) { 25 this._map = map; 26 this._insertAtTheBottom = insertAtTheBottom; 27 this._initContainer(); 28 this._initMapObject(); 29 map.on('viewreset', this._resetCallback, this); 30 this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this); 31 map.on('move', this._update, this); 32 this._reset(); 33 this._update(); 34 }, 35 onRemove: function(map) { 36 this._map._container.removeChild(this._container); 37 this._map.off('viewreset', this._resetCallback, this); 38 this._map.off('move', this._update, this); 39 }, 40 getAttribution: function() { 41 return this.options.attribution; 42 }, 43 setOpacity: function(opacity) { 44 this.options.opacity = opacity; 45 if (opacity < 1) { 46 L.DomUtil.setOpacity(this._container, opacity); 47 } 48 }, 49 _initContainer: function() { 50 var tilePane = this._map._container, 51 first = tilePane.firstChild; 52 if (!this._container) { 53 this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left'); 54 this._container.id = "_GMapContainer"; 55 } 56 if (true) { 57 tilePane.insertBefore(this._container, first); 58 this.setOpacity(this.options.opacity); 59 var size = this._map.getSize(); 60 this._container.style.width = size.x + 'px'; 61 this._container.style.height = size.y + 'px'; 62 } 63 }, 64 _initMapObject: function() { 65 this._google_center = new google.maps.LatLng(0, 0); 66 var map = new google.maps.Map(this._container, { 67 center: this._google_center, 68 zoom: 0, 69 mapTypeId: this._type, 70 disableDefaultUI: true, 71 keyboardShortcuts: false, 72 draggable: false, 73 disableDoubleClickZoom: true, 74 scrollwheel: false, 75 streetViewControl: false 76 }); 77 var _this = this; 78 this._reposition = google.maps.event.addListenerOnce(map, "center_changed", 79 function() { _this.onReposition(); }); 80 this._google = map; 81 }, 82 _resetCallback: function(e) { 83 this._reset(e.hard); 84 }, 85 _reset: function(clearOldContainer) { 86 this._initContainer(); 87 }, 88 _update: function() { 89 this._resize(); 90 var bounds = this._map.getBounds(); 91 var ne = bounds.getNorthEast();
92 var sw = bounds.getSouthWest(); 93 var google_bounds = new google.maps.LatLngBounds( 94 new google.maps.LatLng(sw.lat, sw.lng), 95 new google.maps.LatLng(ne.lat, ne.lng) 96 ); 97 var center = this._map.getCenter(); 98 var _center = new google.maps.LatLng(center.lat, center.lng); 99 this._google.setCenter(_center); 100 this._google.setZoom(this._map.getZoom()); 101 this._google.fitBounds(google_bounds); 102 }, 103 _resize: function() { 104 var size = this._map.getSize(); 105 if (this._container.style.width == size.x && 106 this._container.style.height == size.y) 107 return; 108 this._container.style.width = size.x + 'px'; 109 this._container.style.height = size.y + 'px'; 110 google.maps.event.trigger(this._google, "resize"); 111 }, 112 onReposition: function() {} 113 }); 114 115 L.HtmlIcon = L.Icon.extend({ 116 options: {}, 117 initialize: function(options) { 118 L.Util.setOptions(this, options); 119 }, 120 createIcon: function() { 121 var div = document.createElement('div'); 122 div.innerHTML = this.options.html; 123 if (div.classList) 124 div.classList.add('leaflet-marker-icon'); 125 else 126 div.className += ' ' + 'leaflet-marker-icon'; 127 return div; 128 }, 129 createShadow: function() { 130 return null; 131 } 132 }); 133 134 var maplistingby = jQuery('body').data('maplistingby'); 135 if (maplistingby == null || maplistingby == "" || maplistingby == "geolocaion") { 136 lpGetGpsLocName(function(lpgetcurrentcityvalue) { 137 lpgpsclocation = lpgetcurrentcityvalue; 138 callhomemapajax(lpgpsclocation, maplistingby); 139 }); 140 } else { 141 callhomemapajax('', maplistingby); 142 } 143 144 function callhomemapajax(lpcity, maplistingby) { 145 jQuery('#homeMap').addClass('loading'); 146 jQuery.ajax({ 147 type: 'POST', 148 dataType: 'json', 149 url: listingpro_home_map_object.ajaxurl, 150 data: { 151 'action': 'listingpro_home_map_content', 152 'listingby': maplistingby, 153 'lpcity': lpcity, 154 'trig': 'home_map', 155 }, 156 success: function(data) { 157 if (data) { 158 jQuery('#homeMap').removeClass('loading'); 159 var map = null; 160 $mtoken = jQuery('#page').data("mtoken"); 161 $mtype = jQuery('#page').data("mtype"); 162 $mapboxDesign = jQuery('#page').data("mstyle"); 163 164 if ($mtoken != '' && $mtype == 'mapbox') { 165 // MAPBOX 166 L.mapbox.accessToken = $mtoken; 167 map = L.mapbox.map('homeMap'); 168 L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { 169 id: $mapboxDesign, 170 accessToken: $mtoken 171 }).addTo(map); 172 173 var markers = new L.MarkerClusterGroup(); 174 hasgetbouts = false; 175 176 jQuery.each(data, function(i, v) { 177 $vlatitude = v.latitude; 178 $vlongitude = v.longitude; 179 180 var $pinicon = ""; 181 if (v.icon && typeof v.icon === "string") { 182 if (v.icon.startsWith("data:image/png")) { 183 $pinicon = "<img alt='image' src='" + v.icon + "' />"; 184 } else { 185 $pinicon = "<i class='" + v.icon + "'></i>"; 186 } 187 } 188 189 if ($vlatitude && $vlongitude && v.noresult == null) { 190 hasgetbouts = true; 191 var markerLocation = new L.LatLng($vlatitude, $vlongitude); 192 var CustomHtmlIcon = L.HtmlIcon.extend({ 193 options: { 194 html: "<div class='lpmap-icon-shape pin card" + i + "'><div class='lpmap-icon-contianer'>" + $pinicon + "</div></div>", 195 } 196 }); 197 var customHtmlIcon = new CustomHtmlIcon(); 198 var marker = new L.Marker(markerLocation, { icon: customHtmlIcon }) 199 .bindPopup('<div class="map-post"><div class="map-post-thumb"><a target="_blank" href="' + v.url + '">' + v.image + '</a></div><div class="map-post-des"><div class="map-post-title"><h5><a target="_blank" href="' + v.url + '">' + v.title + '</a></h5></div><div class="map-post-address"><p><i class="fa fa-map-marker"></i> ' + v.address + '</p></div></div></div>') 200 .addTo(map); 201 markers.addLayer(marker); 202 map.addLayer(markers); 203 } 204 }); 205 206 if (hasgetbouts) { 207 map.fitBounds(markers.getBounds()); 208 } else { 209 map.fitBounds([[$defLat, $defLong], [$defLat, $defLong]]); 210 } 211 map.scrollWheelZoom.disable(); 212 213 } else { 214 // GOOGLE or OSM 215 var map = new L.Map('homeMap', { 216 dragging: true, 217 tap: false 218 }); 219 if ($mtype == 'google') { 220 var googleLayer = new L.Google('ROADMAP'); 221 map.addLayer(googleLayer); 222 } else { 223 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); 224 } 225 226 var markers = new L.MarkerClusterGroup(); 227 hasgetbouts = false;
228 229 jQuery.each(data, function(i, v) { 230 $vlatitude = v.latitude; 231 $vlongitude = v.longitude; 232 233 var $pinicon = ""; 234 if (v.icon && typeof v.icon === "string") { 235 if (v.icon.startsWith("data:image/png")) { 236 $pinicon = "<img alt='image' src='" + v.icon + "' />"; 237 } else { 238 $pinicon = "<i class='" + v.icon + "'></i>"; 239 } 240 } 241 242 if ($vlatitude && $vlongitude && v.noresult == null) { 243 hasgetbouts = true; 244 var markerLocation = new L.LatLng($vlatitude, $vlongitude); 245 var CustomHtmlIcon = L.HtmlIcon.extend({ 246 options: { 247 html: "<div class='lpmap-icon-shape pin card" + i + "'><div class='lpmap-icon-contianer'>" + $pinicon + "</div></div>", 248 } 249 }); 250 var customHtmlIcon = new CustomHtmlIcon(); 251 var marker = new L.Marker(markerLocation, { icon: customHtmlIcon }) 252 .bindPopup('<div class="map-post"><div class="map-post-thumb"><a target="_blank" href="' + v.url + '">' + v.image + '</a></div><div class="map-post-des"><div class="map-post-title"><h5><a target="_blank" href="' + v.url + '">' + v.title + '</a></h5></div><div class="map-post-address"><p><i class="fa fa-map-marker"></i> ' + v.address + '</p></div></div></div>') 253 .addTo(map); 254 markers.addLayer(marker); 255 map.addLayer(markers); 256 } 257 }); 258 259 if (hasgetbouts) { 260 map.fitBounds(markers.getBounds()); 261 } else { 262 map.fitBounds([[$defLat, $defLong], [$defLat, $defLong]]); 263 } 264 map.scrollWheelZoom.disable(); 265 map.invalidateSize(); 266 } 267 } 268 }, 269 error: function(request, status, error) { 270 jQuery('#homeMap').removeClass('loading'); 271 console.log(request.responseText); 272 } 273 }); 274 } 275 } 276});
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.