From be8ca53b7b7161155062c209299ec3a244941444 Mon Sep 17 00:00:00 2001 From: Medet Date: Fri, 7 Aug 2026 06:38:11 +0000 Subject: [PATCH] =?UTF-8?q?PetMap:=20=D1=80=D0=B0=D0=B7=D0=BD=D1=8B=D0=B5?= =?UTF-8?q?=20=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D0=B8=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=82=D0=B8=D0=BF=D0=BE=D0=B2=20=D0=BC=D0=B0=D1=80=D0=BA=D0=B5?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=20(=D0=BF=D0=BE=D1=82=D0=B5=D1=80=D1=8F?= =?UTF-8?q?=D0=BD,=20=D0=BD=D0=B0=D0=B9=D0=B4=D0=B5=D0=BD,=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BC=D0=BE=D1=89=D1=8C,=20=D0=B4=D0=BE=D0=BC,=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=B8=D0=BA=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- petmap.html | 67 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/petmap.html b/petmap.html index 8b75a0e..b82ff0b 100644 --- a/petmap.html +++ b/petmap.html @@ -16,8 +16,25 @@ - - :root { --primary: #ff6b6b; --primary-dark: #ee5a5a; @@ -908,6 +925,45 @@ attribution: '© OpenStreetMap contributors' }).addTo(map); + // Иконки для разных типов маркеров + function getMarkerIcon(item) { + const itemType = item.type || item.cat; + let emoji = item.emoji || '📍'; + let className = 'custom-marker'; + + // Разные смайлики для разных типов + if (itemType === 'lost') { + emoji = '👀'; // Глаза — ищут, потерян + className += ' marker-lost'; + } else if (itemType === 'found' || itemType === 'sighting') { + emoji = '👁️'; // Глаз — видел на улице + className += ' marker-found'; + } else if (itemType === 'needs_help' || itemType === 'help') { + emoji = '🆘'; // SOS — нужна помощь + className += ' marker-help'; + } else if (itemType === 'seeking_home' || itemType === 'home') { + emoji = '🏠'; // Дом — ищет дом + className += ' marker-home'; + } else if (itemType === 'vet') { + emoji = '🏥'; // Больница — ветклиника + className += ' marker-vet'; + } else if (itemType === 'shelter') { + emoji = '🏡'; // Приют + className += ' marker-shelter'; + } else if (itemType === 'petshop') { + emoji = '🛒'; // Магазин + className += ' marker-petshop'; + } + + return L.divIcon({ + className: className, + html: `
${emoji}
`, + iconSize: [44, 44], + iconAnchor: [22, 22], + popupAnchor: [0, -22] + }); + } + const markers = []; function addMarkers(filter = 'all') { markers.forEach(m => map.removeLayer(m)); @@ -925,10 +981,11 @@ const lng = item.lng || CITIES[item.city]?.lng; if (!lat || !lng) return; - const marker = L.marker([lat, lng]).addTo(map); + const icon = getMarkerIcon(item); + const marker = L.marker([lat, lng], { icon: icon }).addTo(map); const popupContent = item.workHours - ? `${item.emoji} ${item.title}
${item.location}
🕒 ${item.workHours}
📞 ${item.contact}` - : `${item.emoji} ${item.title}
${item.location}
📞 ${item.contact}`; + ? `${item.emoji || '📍'} ${item.title}
${item.location}
🕒 ${item.workHours}
📞 ${item.contact}` + : `${item.emoji || '📍'} ${item.title}
${item.location}
📞 ${item.contact}`; marker.bindPopup(popupContent); marker.on('click', () => showPreview(item)); markers.push(marker);