PageSourceSearch

https://salons.nl/wp-content/themes/listingpro/assets/js/home-map.js?ver=7.1.3

js salons.nl collected 2026-10-08 21:43:23 UTC 13,313 bytes, 263 lines download raw bytes

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

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.