diff --git a/oedb/resources/demo/demo_main.py b/oedb/resources/demo/demo_main.py
index 1a971dc..8eb84e4 100644
--- a/oedb/resources/demo/demo_main.py
+++ b/oedb/resources/demo/demo_main.py
@@ -228,26 +228,28 @@ class DemoMainResource:
#
-->
+ document.addEventListener('DOMContentLoaded', function() {
+ fetchEvents();
+
+ if (window.osmAuth) {
+ const clientId = document.getElementById('osmClientId').value;
+ const redirectUri = document.getElementById('osmRedirectUri').value;
+ const authSection = document.getElementById('auth-section');
+
+ // Only replace if osmAuth is loaded and has renderAuthSection method
+ if (osmAuth.renderAuthSection) {
+ authSection.innerHTML = osmAuth.renderAuthSection(clientId, redirectUri);
+ }
+ }
+ });
+
+ -->
@@ -276,7 +278,7 @@ class DemoMainResource:
// Fonction pour gérer les listes dépliantes
document.addEventListener('DOMContentLoaded', function() {
- fetchEvents();
+
const endpointsHeader = document.getElementById('endpoints_list_header');
const endpointsList = document.getElementById('endpoints_list');
@@ -352,63 +354,8 @@ class DemoMainResource:
// Style switcher functionality
let currentStyle = 'default';
let eventsData = null;
-
- document.getElementById('style-default').addEventListener('click', () => {
- if (currentStyle !== 'default') {
- switchMapStyle('default');
- }
- });
-
- document.getElementById('style-osm-vector').addEventListener('click', () => {
- if (currentStyle !== 'osmVector') {
- switchMapStyle('osmVector');
- }
- });
-
- document.getElementById('style-osm-raster').addEventListener('click', () => {
- if (currentStyle !== 'osmRaster') {
- switchMapStyle('osmRaster');
- }
- });
-
- function switchMapStyle(styleName) {
- // Update active button
- document.querySelectorAll('.map-style-control button').forEach(button => {
- button.classList.remove('active');
- });
- document.getElementById(`style-${styleName.replace('osm', 'osm-')}`).classList.add('active');
-
- // Save current center and zoom
- const center = map.getCenter();
- const zoom = map.getZoom();
-
- // Save events data if already loaded
- if (map.getSource('events')) {
- try {
- eventsData = map.getSource('events')._data;
- } catch (e) {
- console.error('Error saving events data:', e);
- }
- }
-
- // Apply new style
- map.setStyle(mapStyles[styleName]);
-
- // Restore center and zoom after style is loaded
- map.once('style.load', () => {
- map.setCenter(center);
- map.setZoom(zoom);
-
- // Restore events data if available
- if (eventsData) {
- addEventsToMap(eventsData);
- } else {
- fetchEvents();
- }
- });
-
- currentStyle = styleName;
- }
+
+
// Fetch events when the map is loaded
map.on('load', function() {
@@ -870,6 +817,8 @@ class DemoMainResource:
errorToast.classList.remove('show');
}, 6000);
}
+
+