|
264 | 264 | overflow-x: hidden; |
265 | 265 | padding: 20px 0; |
266 | 266 | "> |
| 267 | + <!-- Close Button (shown only when manually opened) --> |
| 268 | + <button id="loading-overlay-close" style=" |
| 269 | + display: none; |
| 270 | + position: fixed; |
| 271 | + top: 20px; |
| 272 | + right: 20px; |
| 273 | + z-index: 10001; |
| 274 | + background: none; |
| 275 | + border: none; |
| 276 | + color: rgba(255, 255, 255, 0.6); |
| 277 | + font-size: 32px; |
| 278 | + line-height: 1; |
| 279 | + cursor: pointer; |
| 280 | + transition: all 0.2s ease; |
| 281 | + padding: 0; |
| 282 | + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; |
| 283 | + " onmouseover="this.style.color='rgba(239, 68, 68, 0.9)'; this.style.transform='scale(1.1)'" onmouseout="this.style.color='rgba(255, 255, 255, 0.6)'; this.style.transform='scale(1)'">×</button> |
| 284 | + |
267 | 285 | <!-- Animated Background --> |
268 | 286 | <div style=" |
269 | 287 | position: absolute; |
|
622 | 640 | proceedNormally: false, |
623 | 641 | mapReady: false, |
624 | 642 | manualOverlayControl: hasURLParams, |
625 | | - shouldShowAtlasPicker: !hasURLParams && !hashLocation |
| 643 | + shouldShowAtlasPicker: false // Will be set later based on conditions |
626 | 644 | }; |
627 | 645 |
|
628 | 646 | const atlasPickerContainer = document.getElementById('atlas-picker-container'); |
629 | 647 | const atlasPickerHeading = document.getElementById('atlas-picker-heading'); |
| 648 | + const loadingOverlayClose = document.getElementById('loading-overlay-close'); |
630 | 649 |
|
631 | 650 | /** |
632 | 651 | * Create an atlas card element |
|
904 | 923 | userInteracted = true; // Prevent auto-close when manually opened |
905 | 924 | autoProceedCancelled = true; |
906 | 925 |
|
| 926 | + // Show close button when manually opened |
| 927 | + if (loadingOverlayClose) { |
| 928 | + loadingOverlayClose.style.display = 'block'; |
| 929 | + } |
| 930 | + |
907 | 931 | // Always show atlas picker when manually opening |
908 | 932 | if (atlasPickerHeading) atlasPickerHeading.style.display = 'block'; |
909 | 933 | if (atlasPickerContainer) atlasPickerContainer.style.display = 'grid'; |
|
916 | 940 | } |
917 | 941 | } |
918 | 942 |
|
919 | | - // Expose openLoadingScreen globally |
| 943 | + function closeLoadingScreen() { |
| 944 | + if (loadingOverlay) { |
| 945 | + loadingOverlay.style.opacity = '0'; |
| 946 | + loadingOverlay.style.transition = 'opacity 0.3s ease'; |
| 947 | + setTimeout(() => { |
| 948 | + loadingOverlay.style.display = 'none'; |
| 949 | + }, 300); |
| 950 | + |
| 951 | + // Hide close button |
| 952 | + if (loadingOverlayClose) { |
| 953 | + loadingOverlayClose.style.display = 'none'; |
| 954 | + } |
| 955 | + } |
| 956 | + } |
| 957 | + |
| 958 | + // Close button click handler |
| 959 | + if (loadingOverlayClose) { |
| 960 | + loadingOverlayClose.addEventListener('click', closeLoadingScreen); |
| 961 | + } |
| 962 | + |
| 963 | + // Expose functions globally |
920 | 964 | window.openLoadingScreen = openLoadingScreen; |
| 965 | + window.closeLoadingScreen = closeLoadingScreen; |
921 | 966 |
|
922 | 967 |
|
923 | 968 | async function handleGeolocation(showStatusMessages = true) { |
|
1059 | 1104 | // Always show requested-map-section |
1060 | 1105 | requestedMapSection.style.display = 'block'; |
1061 | 1106 |
|
| 1107 | + // Always show atlas picker for quick access |
| 1108 | + if (atlasPickerHeading) atlasPickerHeading.style.display = 'block'; |
| 1109 | + if (atlasPickerContainer) atlasPickerContainer.style.display = 'grid'; |
| 1110 | + |
| 1111 | + // Load atlas cards immediately |
| 1112 | + loadFeaturedAtlases(); |
| 1113 | + |
1062 | 1114 | // Determine if we should show atlas picker |
1063 | 1115 | const shouldShowAtlasPicker = !hasURLParams && !hashLocation; |
| 1116 | + window.loadingStartupState.shouldShowAtlasPicker = shouldShowAtlasPicker; |
1064 | 1117 |
|
1065 | 1118 | if (hasURLParams) { |
1066 | | - // Hide atlas picker for URL params |
1067 | | - if (atlasPickerHeading) atlasPickerHeading.style.display = 'none'; |
1068 | | - if (atlasPickerContainer) atlasPickerContainer.style.display = 'none'; |
1069 | | - |
1070 | 1119 | // Show URL info and cancel button for URL params |
1071 | 1120 | const urlParams = new URLSearchParams(window.location.search); |
1072 | 1121 | const atlas = urlParams.get('atlas'); |
|
1101 | 1150 | cancelAutoProceedBtn.addEventListener('click', cancelAutoProceed); |
1102 | 1151 | } |
1103 | 1152 |
|
| 1153 | + // Update heading to indicate current and alternative options |
| 1154 | + if (atlasPickerHeading) { |
| 1155 | + atlasPickerHeading.textContent = 'Or explore other atlases:'; |
| 1156 | + } |
| 1157 | + |
1104 | 1158 | window.loadingStartupState.proceedNormally = true; |
1105 | 1159 | } else if (hashLocation) { |
1106 | | - // Hide atlas picker for hash location |
1107 | | - if (atlasPickerHeading) atlasPickerHeading.style.display = 'none'; |
1108 | | - if (atlasPickerContainer) atlasPickerContainer.style.display = 'none'; |
1109 | | - |
1110 | 1160 | // Location hash detected - use coordinates from URL |
1111 | 1161 | urlInfoContent.style.display = 'none'; |
1112 | 1162 | if (cancelAutoProceedBtn) { |
|
1115 | 1165 |
|
1116 | 1166 | requestedMapStatus.innerHTML = `Using location from URL: <a href="${window.location.href}" style="color: #60a5fa; text-decoration: underline;">${hashLocation.lat.toFixed(6)}, ${hashLocation.lng.toFixed(6)}</a>`; |
1117 | 1167 |
|
| 1168 | + // Update heading |
| 1169 | + if (atlasPickerHeading) { |
| 1170 | + atlasPickerHeading.textContent = 'Or explore other atlases:'; |
| 1171 | + } |
| 1172 | + |
1118 | 1173 | // Automatically proceed with hash location |
1119 | 1174 | setTimeout(() => { |
1120 | 1175 | requestedMapStatus.textContent = 'Loading map...'; |
|
1126 | 1181 | cancelAutoProceedBtn.style.display = 'none'; |
1127 | 1182 | } |
1128 | 1183 |
|
1129 | | - // Atlas picker is already visible by default, just load the data |
1130 | | - loadFeaturedAtlases(); |
1131 | | - |
1132 | 1184 | // Check for device geolocation first, then fall back to IP |
1133 | 1185 | (async () => { |
1134 | 1186 | const geolocationSuccess = await checkAndUseGeolocation(); |
|
0 commit comments