// Main JavaScript for the travel blog document.addEventListener('DOMContentLoaded', function() { // Initialize map initMap(); // Load travel stories loadStories(); // Theme toggle functionality const themeToggle = document.getElementById('theme-toggle'); if (themeToggle) { themeToggle.addEventListener('click', toggleTheme); } }); function initMap() { const map = L.map('map').setView([20, 0], 2); // Add marker clusters const markers = L.markerClusterGroup(); // Sample visited locations const locations = [ { lat: 36.2048, lng: 138.2529, title: 'Japan', story: 'Explored ancient temples in Kyoto' }, { lat: 36.3932, lng: 25.4615, title: 'Santorini', story: 'Sunset views in Oia' }, { lat: 40.7128, lng: -74.0060, title: 'New York', story: 'Concrete jungle where dreams are made' }, { lat: -13.1631, lng: -72.5450, title: 'Machu Picchu', story: 'Hiked the Inca Trail to the lost city' }, { lat: -22.9519, lng: -43.2105, title: 'Rio de Janeiro', story: 'Christ the Redeemer and Copacabana' }, { lat: 51.5074, lng: -0.1278, title: 'London', story: 'Afternoon tea and Big Ben' }, { lat: 48.8566, lng: 2.3522, title: 'Paris', story: 'Croissants and the Eiffel Tower' }, { lat: -33.8688, lng: 151.2093, title: 'Sydney', story: 'Opera House and Bondi Beach' } ]; locations.forEach(loc => { const marker = L.marker([loc.lat, loc.lng]).bindPopup(`
`); markers.addLayer(marker); }); map.addLayer(markers); // Disable default map tiles since we're using a custom background map.attributionControl.setPrefix(''); } function loadStories() { const storiesContainer = document.getElementById('stories-container'); if (!storiesContainer) return; const stories = [ { title: "Hiking the Inca Trail", excerpt: "My 4-day journey to Machu Picchu through ancient paths and stunning scenery.", location: "Peru", date: "May 2023", image: "http://static.photos/travel/640x360/4" }, { title: "Island Hopping in Greece", excerpt: "Discovering the hidden gems of the Cyclades beyond Santorini and Mykonos.", location: "Greece", date: "August 2022", image: "http://static.photos/travel/640x360/5" }, { title: "Tokyo's Hidden Izakayas", excerpt: "An insider's guide to the best small bars and local drinking spots in Tokyo.", location: "Japan", date: "November 2022", image: "http://static.photos/travel/640x360/6" }, { title: "Road Tripping Iceland's Ring Road", excerpt: "8 days of waterfalls, glaciers, and midnight sun around Iceland's Route 1.", location: "Iceland", date: "June 2021", image: "http://static.photos/travel/640x360/7" }, { title: "Safari in the Serengeti", excerpt: "Witnessing the Great Migration and staying in luxury tented camps.", location: "Tanzania", date: "September 2021", image: "http://static.photos/travel/640x360/8" }, { title: "Culinary Tour of Vietnam", excerpt: "From pho in Hanoi to banh mi in Saigon - a food lover's paradise.", location: "Vietnam", date: "March 2022", image: "http://static.photos/travel/640x360/9" } ]; let html = ''; stories.forEach(story => { html += `