{"name":"additionalhtmlfooter","oldvalue":" <script>\r\n        \/\/ Initialize the map\r\n        const map = L.map('map').setView([48.58392, 7.74553], 6); \/\/ Centered near Strasbourg\r\n\r\n        \/\/ Add OpenStreetMap tiles\r\n        L.tileLayer('https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png', {\r\n            maxZoom: 19,\r\n            attribution: '\u00a9 OpenStreetMap contributors'\r\n        }).addTo(map);\r\n\r\n        \/\/ Custom airplane icon\r\n        const airplaneIcon = L.icon({\r\n            iconUrl: 'https:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/6f\/Airplane_silhouette_blue.svg', \/\/ Green airplane icon\r\n            iconSize: [32, 32], \/\/ Size of the icon\r\n            iconAnchor: [16, 16], \/\/ Anchor point of the icon (centered)\r\n            popupAnchor: [0, -16] \/\/ Position of the popup relative to the icon\r\n        });\r\n\r\n        \/\/ Store active markers\r\n        const activeMarkers = new Map();\r\n\r\n        \/\/ Function to fetch OpenSky data\r\n        async function fetchOpenSkyData() {\r\n            const username = 'bruno.bernard';\r\n            const password = 'emriHy22o%';\r\n            const url = 'https:\/\/opensky-network.org\/api\/states\/all';\r\n\r\n            try {\r\n                const response = await fetch(url, {\r\n                    headers: {\r\n                        'Authorization': 'Basic ' + btoa(username + ':' + password)\r\n                    }\r\n                });\r\n\r\n                if (!response.ok) {\r\n                    throw new Error('Failed to fetch data: ' + response.status);\r\n                }\r\n\r\n                const data = await response.json();\r\n                updatePlanes(data.states);\r\n            } catch (error) {\r\n                console.error('Error fetching OpenSky data:', error);\r\n            }\r\n        }\r\n\r\n        \/\/ Function to update planes on the map\r\n        function updatePlanes(states) {\r\n            const updatedMarkers = new Set();\r\n\r\n            states.forEach(state => {\r\n                const [icao24, callsign, originCountry, timePosition, lastContact, longitude, latitude, altitude, , velocity, heading, ...rest] = state;\r\n\r\n                \/\/ Only display planes with valid coordinates\r\n                if (latitude && longitude && heading !== null) {\r\n                    const planeId = icao24;\r\n\r\n                    \/\/ Check if the plane already exists on the map\r\n                    if (activeMarkers.has(planeId)) {\r\n                        const marker = activeMarkers.get(planeId);\r\n                        marker.setLatLng([latitude, longitude]);\r\n                        marker.setRotationAngle(heading);\r\n                    } else {\r\n                        \/\/ Create a new marker for the airplane\r\n                        const planeMarker = L.marker([latitude, longitude], {\r\n                            icon: airplaneIcon,\r\n                            rotationAngle: heading,\r\n                            rotationOrigin: 'center center'\r\n                        });\r\n\r\n                        planeMarker\r\n                            .addTo(map)\r\n                            .bindPopup(`\r\n                                <strong>Callsign:<\/strong> ${callsign || 'N\/A'}<br>\r\n                                <strong>Country:<\/strong> ${originCountry}<br>\r\n                                <strong>ICAO24:<\/strong> ${icao24}<br>\r\n                                <strong>Heading:<\/strong> ${heading.toFixed(1)}\u00b0<br>\r\n                            `);\r\n\r\n                        activeMarkers.set(planeId, planeMarker);\r\n                    }\r\n\r\n                    updatedMarkers.add(planeId);\r\n                }\r\n            });\r\n\r\n            \/\/ Remove markers for planes that are no longer active\r\n            activeMarkers.forEach((marker, planeId) => {\r\n                if (!updatedMarkers.has(planeId)) {\r\n                    map.removeLayer(marker);\r\n                    activeMarkers.delete(planeId);\r\n                }\r\n            });\r\n        }\r\n\r\n        \/\/ Fetch and update planes every 2 seconds\r\n        fetchOpenSkyData();\r\n        setInterval(fetchOpenSkyData, 4000);\r\n    <\/script>","value":" <script>\r\n        \/\/ Initialize the map\r\n        const map = L.map('map').setView([48.58392, 7.74553], 6); \/\/ Centered near Strasbourg\r\n\r\n        \/\/ Add OpenStreetMap tiles\r\n        L.tileLayer('https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png', {\r\n            maxZoom: 19,\r\n            attribution: '\u00a9 OpenStreetMap contributors'\r\n        }).addTo(map);\r\n\r\n        \/\/ Custom airplane icon\r\n        const airplaneIcon = L.icon({\r\n            iconUrl: 'https:\/\/bia-facile.fr\/images\/Airplane_silhouette_blue.svg, \/\/ Green airplane icon https:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/6f\/Airplane_silhouette_blue.svg'\r\n            iconSize: [32, 32], \/\/ Size of the icon\r\n            iconAnchor: [16, 16], \/\/ Anchor point of the icon (centered)\r\n            popupAnchor: [0, -16] \/\/ Position of the popup relative to the icon\r\n        });\r\n\r\n        \/\/ Store active markers\r\n        const activeMarkers = new Map();\r\n\r\n        \/\/ Function to fetch OpenSky data\r\n        async function fetchOpenSkyData() {\r\n            const username = 'bruno.bernard';\r\n            const password = 'emriHy22o%';\r\n            const url = 'https:\/\/opensky-network.org\/api\/states\/all';\r\n\r\n            try {\r\n                const response = await fetch(url, {\r\n                    headers: {\r\n                        'Authorization': 'Basic ' + btoa(username + ':' + password)\r\n                    }\r\n                });\r\n\r\n                if (!response.ok) {\r\n                    throw new Error('Failed to fetch data: ' + response.status);\r\n                }\r\n\r\n                const data = await response.json();\r\n                updatePlanes(data.states);\r\n            } catch (error) {\r\n                console.error('Error fetching OpenSky data:', error);\r\n            }\r\n        }\r\n\r\n        \/\/ Function to update planes on the map\r\n        function updatePlanes(states) {\r\n            const updatedMarkers = new Set();\r\n\r\n            states.forEach(state => {\r\n                const [icao24, callsign, originCountry, timePosition, lastContact, longitude, latitude, altitude, , velocity, heading, ...rest] = state;\r\n\r\n                \/\/ Only display planes with valid coordinates\r\n                if (latitude && longitude && heading !== null) {\r\n                    const planeId = icao24;\r\n\r\n                    \/\/ Check if the plane already exists on the map\r\n                    if (activeMarkers.has(planeId)) {\r\n                        const marker = activeMarkers.get(planeId);\r\n                        marker.setLatLng([latitude, longitude]);\r\n                        marker.setRotationAngle(heading);\r\n                    } else {\r\n                        \/\/ Create a new marker for the airplane\r\n                        const planeMarker = L.marker([latitude, longitude], {\r\n                            icon: airplaneIcon,\r\n                            rotationAngle: heading,\r\n                            rotationOrigin: 'center center'\r\n                        });\r\n\r\n                        planeMarker\r\n                            .addTo(map)\r\n                            .bindPopup(`\r\n                                <strong>Callsign:<\/strong> ${callsign || 'N\/A'}<br>\r\n                                <strong>Country:<\/strong> ${originCountry}<br>\r\n                                <strong>ICAO24:<\/strong> ${icao24}<br>\r\n                                <strong>Heading:<\/strong> ${heading.toFixed(1)}\u00b0<br>\r\n                            `);\r\n\r\n                        activeMarkers.set(planeId, planeMarker);\r\n                    }\r\n\r\n                    updatedMarkers.add(planeId);\r\n                }\r\n            });\r\n\r\n            \/\/ Remove markers for planes that are no longer active\r\n            activeMarkers.forEach((marker, planeId) => {\r\n                if (!updatedMarkers.has(planeId)) {\r\n                    map.removeLayer(marker);\r\n                    activeMarkers.delete(planeId);\r\n                }\r\n            });\r\n        }\r\n\r\n        \/\/ Fetch and update planes every 2 seconds\r\n        fetchOpenSkyData();\r\n        setInterval(fetchOpenSkyData, 4000);\r\n    <\/script>","plugin":null}