PageSourceSearch

https://lively-night-4437.nlouka.workers.dev/src/map/mapCore.js

js lively-night-4437.nlouka.workers.dev collected 2026-10-03 08:08:34 UTC 1,632 bytes, 55 lines download raw bytes

1// Leaflet map initialization and core map functionality
2
3let map;
4let markerClusterGroup;
5let lightTileLayer;
6let darkTileLayer;
7
8export function initMap() {
9    map = L.map('map').setView([38, 23.5], 6);
10
11    lightTileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
12        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
13        maxZoom: 19,
14        minZoom: 2
15    });
16
17    darkTileLayer = L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
18        attribution: '&copy; <a href="https://carto.com/">CARTO</a>',
19        maxZoom: 19,
20        minZoom: 2
21    });
22
23    // Check for dark mode preference and add appropriate layer
24    const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
25    const isDarkMode = document.body.classList.contains("dark-mode") || 
26                       (prefersDark && !document.body.classList.contains("light-mode"));
27    
28    if (isDarkMode) {
29        darkTileLayer.addTo(map);
30    } else {
31        lightTileLayer.addTo(map);
32    }
33
34    markerClusterGroup = L.markerClusterGroup({
35        spiderfyOnMaxZoom: true,
36        showCoverageOnHover: false,
37        zoomToBoundsOnClick: true
38    });
39    map.addLayer(markerClusterGroup);
40
41    return { map, markerClusterGroup, lightTileLayer, darkTileLayer };
42}
43
44export function getMap() {
45    return map;
46}
47
48export function getMarkerClusterGroup() {
49    return markerClusterGroup;
50}
51
52export function getTileLayers() {
53    return { lightTileLayer, darkTileLayer };
54}
55

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.