Enoder commited on
Commit
c259992
·
verified ·
1 Parent(s): 0fc2bb0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +85 -3
index.html CHANGED
@@ -111,6 +111,38 @@
111
  font-size: 1.4rem;
112
  font-weight: 600;
113
  letter-spacing: 0.02em;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
 
116
  #map {
@@ -431,7 +463,12 @@
431
  <div class="game-container">
432
  <div class="map-panel">
433
  <div class="map-header">
434
- Distribution Mondiale des Occurrences
 
 
 
 
 
435
  </div>
436
  <div id="map"></div>
437
  </div>
@@ -1186,19 +1223,64 @@
1186
  let answered = false;
1187
  let map = null;
1188
  let tileLayer = null;
 
1189
  let selectedIndex = -1;
1190
  let filteredSpecies = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1191
 
1192
  // Initialize map
1193
  function initMap() {
1194
  map = L.map('map').setView([20, 0], 2);
1195
 
1196
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
1197
- attribution: '© OpenStreetMap contributors',
1198
  maxZoom: 18
1199
  }).addTo(map);
1200
  }
1201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1202
  // Load species occurrences on map
1203
  function loadSpeciesOnMap(taxonKey) {
1204
  if (tileLayer) {
 
111
  font-size: 1.4rem;
112
  font-weight: 600;
113
  letter-spacing: 0.02em;
114
+ display: flex;
115
+ justify-content: space-between;
116
+ align-items: center;
117
+ }
118
+
119
+ .map-controls {
120
+ display: flex;
121
+ gap: 0.5rem;
122
+ }
123
+
124
+ .map-type-btn {
125
+ background: rgba(255, 255, 255, 0.2);
126
+ border: 2px solid rgba(255, 255, 255, 0.3);
127
+ color: white;
128
+ padding: 0.5rem 1rem;
129
+ border-radius: 6px;
130
+ font-family: 'Source Sans 3', sans-serif;
131
+ font-size: 0.85rem;
132
+ font-weight: 600;
133
+ cursor: pointer;
134
+ transition: all 0.3s ease;
135
+ }
136
+
137
+ .map-type-btn:hover {
138
+ background: rgba(255, 255, 255, 0.3);
139
+ border-color: rgba(255, 255, 255, 0.5);
140
+ }
141
+
142
+ .map-type-btn.active {
143
+ background: white;
144
+ color: var(--accent-green);
145
+ border-color: white;
146
  }
147
 
148
  #map {
 
463
  <div class="game-container">
464
  <div class="map-panel">
465
  <div class="map-header">
466
+ <span>Distribution Mondiale des Occurrences</span>
467
+ <div class="map-controls">
468
+ <button class="map-type-btn active" data-map="standard">Standard</button>
469
+ <button class="map-type-btn" data-map="dark">Sombre</button>
470
+ <button class="map-type-btn" data-map="satellite">Satellite</button>
471
+ </div>
472
  </div>
473
  <div id="map"></div>
474
  </div>
 
1223
  let answered = false;
1224
  let map = null;
1225
  let tileLayer = null;
1226
+ let baseLayer = null;
1227
  let selectedIndex = -1;
1228
  let filteredSpecies = [];
1229
+ let currentMapType = 'standard';
1230
+
1231
+ // Map configurations
1232
+ const mapLayers = {
1233
+ standard: {
1234
+ url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
1235
+ attribution: '© OpenStreetMap contributors'
1236
+ },
1237
+ dark: {
1238
+ url: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png',
1239
+ attribution: '© OpenStreetMap contributors, © CARTO'
1240
+ },
1241
+ satellite: {
1242
+ url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
1243
+ attribution: 'Tiles © Esri'
1244
+ }
1245
+ };
1246
 
1247
  // Initialize map
1248
  function initMap() {
1249
  map = L.map('map').setView([20, 0], 2);
1250
 
1251
+ baseLayer = L.tileLayer(mapLayers.standard.url, {
1252
+ attribution: mapLayers.standard.attribution,
1253
  maxZoom: 18
1254
  }).addTo(map);
1255
  }
1256
 
1257
+ // Change map type
1258
+ function changeMapType(type) {
1259
+ if (baseLayer) {
1260
+ map.removeLayer(baseLayer);
1261
+ }
1262
+
1263
+ currentMapType = type;
1264
+ const config = mapLayers[type];
1265
+
1266
+ baseLayer = L.tileLayer(config.url, {
1267
+ attribution: config.attribution,
1268
+ maxZoom: 18
1269
+ }).addTo(map);
1270
+
1271
+ // Update active button
1272
+ document.querySelectorAll('.map-type-btn').forEach(btn => {
1273
+ btn.classList.toggle('active', btn.dataset.map === type);
1274
+ });
1275
+ }
1276
+
1277
+ // Add event listeners for map type buttons
1278
+ document.querySelectorAll('.map-type-btn').forEach(btn => {
1279
+ btn.addEventListener('click', () => {
1280
+ changeMapType(btn.dataset.map);
1281
+ });
1282
+ });
1283
+
1284
  // Load species occurrences on map
1285
  function loadSpeciesOnMap(taxonKey) {
1286
  if (tileLayer) {