From 25b16144c18f8080ad95c2edcdd1997205d1c28a Mon Sep 17 00:00:00 2001 From: Alfakhori <muhammad.alfakhori@hft-stuttgart.de> Date: Thu, 29 Aug 2024 09:57:08 +0000 Subject: [PATCH] Deleted public/css/styles.css, public/data/pins.csv, public/js/script.js --- public/css/styles.css | 16 ---------- public/data/pins.csv | 2 -- public/js/script.js | 68 ------------------------------------------- 3 files changed, 86 deletions(-) delete mode 100644 public/css/styles.css delete mode 100644 public/data/pins.csv delete mode 100644 public/js/script.js diff --git a/public/css/styles.css b/public/css/styles.css deleted file mode 100644 index 29b47e8..0000000 --- a/public/css/styles.css +++ /dev/null @@ -1,16 +0,0 @@ -html, body { - height: 100%; - margin: 0; - padding: 0; -} - -#map { - height: 100vh; - width: 100vw; -} - -.custom-pin .pin { - width: 15px; - height: 15px; - border-radius: 50%; -} diff --git a/public/data/pins.csv b/public/data/pins.csv deleted file mode 100644 index 50c482a..0000000 --- a/public/data/pins.csv +++ /dev/null @@ -1,2 +0,0 @@ -lat,lng,name,color -51.505,-0.09,Sample Pin,#ff0000 diff --git a/public/js/script.js b/public/js/script.js deleted file mode 100644 index 4d529d4..0000000 --- a/public/js/script.js +++ /dev/null @@ -1,68 +0,0 @@ -const map = L.map('map').setView([51.505, -0.09], 13); - -// Add OSM base map -L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 19, -}).addTo(map); - -// Function to load pins from CSV and add them to the map -function loadPins() { - Papa.parse('/data/pins.csv', { - download: true, - header: true, - complete: function(results) { - results.data.forEach(pin => { - if (pin.lat && pin.lng && pin.name && pin.color) { - const marker = L.marker([parseFloat(pin.lat), parseFloat(pin.lng)], { - title: pin.name, - icon: L.divIcon({ - className: 'custom-pin', - html: `<div style="background-color: ${pin.color};" class="pin"></div>` - }) - }).addTo(map); - - marker.bindPopup(`<b>${pin.name}</b>`); - } - }); - } - }); -} - -// Call the function to load pins from the CSV -loadPins(); - -// Add click event to the map to add new pins -map.on('click', function(e) { - const name = prompt("Enter pin name:"); - const color = prompt("Enter pin color (e.g., red, #ff0000):"); - - if (name && color) { - const newPin = { - lat: e.latlng.lat, - lng: e.latlng.lng, - name: name, - color: color - }; - - // Save the pin to the CSV file - addPinToCSV(newPin); - - // Add the new pin to the map - const marker = L.marker([newPin.lat, newPin.lng], { - title: newPin.name, - icon: L.divIcon({ - className: 'custom-pin', - html: `<div style="background-color: ${newPin.color};" class="pin"></div>` - }) - }).addTo(map); - - marker.bindPopup(`<b>${newPin.name}</b>`); - } -}); - -// Function to add a pin to the CSV (simulated by logging to the console) -function addPinToCSV(pin) { - const csvLine = `${pin.lat},${pin.lng},${pin.name},${pin.color}\n`; - console.log("Pin to add to CSV:", csvLine); - // Note: This will only log to the console since we cannot write to files on GitHub Pages -} -- GitLab