PageSourceSearch

https://playwaze.com/Scripts/application/Marketplace/map.js

js playwaze.com collected 2026-10-01 14:01:04 UTC 4,817 bytes, 137 lines download raw bytes

1
2var searchMap
3var initializedMapsSuccessfully = false;
4var bounds = [];
5var markers = [];
6var LeafIcon;
7var icons;
8var searchMap;
9function initMap() {
10    LeafIcon = L.Icon.extend({
11        options: {
12            iconSize: [25, 40]
13        }
14    });
15    icons = {
16        Me: {
17            icon: new LeafIcon({ iconUrl: 'https://playwaze.com/Images/application/Marketplace/routeIconPin.webp' })
18        },
19        Activities: {
20            icon: new LeafIcon({ iconUrl: 'https://playwaze.com/Images/application/Marketplace/activityIconPin.webp' })
21        },
22        Communities: {
23            icon: new LeafIcon({ iconUrl: 'https://playwaze.com/Images/application/Marketplace/communityIconPin.webp' })
24        },
25        Places: {
26            icon: new LeafIcon({ iconUrl: 'https://playwaze.com/Images/application/Marketplace/venueIconPin.webp' })
27        },
28        Routes: {
29            icon: new LeafIcon({ iconUrl: 'https://playwaze.com/Images/application/Marketplace/routeIconPin.webp' })
30        },
31    };
32    var lat = rawLocation ? parseFloat(rawLocation.split(" ")[0]) : (readCookie("Marketplace_Filter_location") ? parseFloat(readCookie("Marketplace_Filter_location").split(" ")[0]) : parseFloat("51.51437"));
33    var lng = rawLocation ? parseFloat(rawLocation.split(" ")[1]) : (readCookie("Marketplace_Filter_location") ? parseFloat(readCookie("Marketplace_Filter_location").split(" ")[1]) : parseFloat("-0.09229"));
34    searchMap.setView([lat, lng], 14);
35
36    L.tileLayer('https://bvg-gis-c.hafas.de/hafas-tiles/inno2017/2/{z}/{x}/{y}.png', {
37        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
38    }).addTo(searchMap);
39    initializedMapsSuccessfully = true;
40    updateMarkers();
41    
42}
43
44$(document).ready(function ($) {
45    searchMap = L.map('search-map', { gestureHandling: true })
46    $("#map-toggle").on("change", function () {
47        $(".map-container").toggle();
48        /*$("#search-map").toggle();*/
49        $(".show-map-txt").toggle();
50        $(".hide-map-txt").toggle();
51        if (initializedMapsSuccessfully) {
52            updateMarkers();
53        } else {
54            initMap();
55        }
56    });
57
58});
59
60function addMeMarker() {
61    if (initializedMapsSuccessfully) {
62        var tmpRawLocation = rawLocation.replaceAll("+", " ")
63        var lat = parseFloat(tmpRawLocation.split(" ")[0]);
64        var lng = parseFloat(tmpRawLocation.split(" ")[1]);
65        addMarker(lat, lng, null, "Me");
66    }
67}
68
69function updateMarkers() {
70    if (initializedMapsSuccessfully) {
71        
72        $(`.marketplace-result[data-pin="false"]`).each(function () {
73            let lat = parseFloat($(this).attr("data-lat"));
74            let lng = parseFloat($(this).attr("data-lng"));
75            let type = $(this).attr("data-type")
76            if (lat != 0 && lng != 0) {
77                addMarker(lat, lng, this, type);
78                $(this).attr("data-pin-id", markers.length - 1)
79                bounds.push({ lat, lng })
80            }
81            $(this).attr("data-pin", true)
82        });
83        if (bounds.length > 0) {
84            searchMap.fitBounds(bounds, 50);
85        }
86    }
87}
88
89function addMarker(lat, lng, result, type) {
90
91    if (initializedMapsSuccessfully) {
92
93        var LatLng = [lat, lng];
94        if (markers.length > 0) {
95            for (i = 0; i < markers.length; i++) {
96                var existingMarker = markers[i];
97                if (LatLng[0] == existingMarker[0] && LatLng[1] == existingMarker[1]) {
98                    var a = 345.0 / 10;
99                    var newLat = LatLng[0] + -.00005 * Math.cos((+a * i) / 180 * Math.PI);
100                    var newLng = LatLng[1] + -.00005 * Math.sin((+a * i) / 180 * Math.PI);
101                    LatLng = [newLat, newLng]
102                }
103            }
104        }
105
106        let marker = L.marker(LatLng, { icon: icons[type].icon, riseOnHover: true }).addTo(searchMap)
107        markers.push(LatLng);
108
109
110        if (result != null) {
111
112            if (embedded) {
113                marker.bindPopup(`${$(result).get(0).outerHTML}`, {
114                    maxWidth: 400
115                });
116            } else {
117                marker.bindPopup(`<div style=""><a target="_blank" href="${$(result).attr("href")}">${$(result).find(".marketplace-result-details-container").get(0).outerHTML}</a></div>`, {
118                    maxWidth: 400
119                });
120            }
121        }
122    }
123}
124
125function hideMarkers() {
126    if (initializedMapsSuccessfully) {
127        bounds = [];
128        searchMap.eachLayer((layer) => {
129            if (layer instanceof L.Marker) {
130                layer.remove();
131            }
132        });
133
134        markers = [];
135    }
136}
137

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.