mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
work
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OpenFreeMap Debug</title>
|
<title>OpenFreeMap Debug</title>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||||
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map" class="w-full h-screen"></div>
|
<div id="map" class="w-full h-screen"></div>
|
||||||
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
||||||
<script src="colon.js"></script>
|
<script src="colon.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,106 +1,97 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OpenFreeMap Debug</title>
|
<title>OpenFreeMap Debug</title>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||||
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
<body class="flex flex-col h-screen">
|
<body class="flex flex-col h-screen">
|
||||||
<!-- UI Panel -->
|
<!-- UI Panel -->
|
||||||
<div class="bg-gray-900 border-b border-gray-700 shadow-md">
|
<div class="bg-gray-900 border-b border-gray-700 shadow-md">
|
||||||
<div class="max-w-7xl mx-auto px-4 py-2">
|
<div class="max-w-7xl mx-auto px-4 py-2">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<label for="line1" class="block text-xs font-medium text-gray-400 mb-1">
|
<label for="line1" class="block text-xs font-medium text-gray-400 mb-1"> Line 1 </label>
|
||||||
Line 1
|
<input
|
||||||
</label>
|
type="text"
|
||||||
<input
|
id="line1"
|
||||||
type="text"
|
class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono"
|
||||||
id="line1"
|
/>
|
||||||
class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono"
|
<input
|
||||||
/>
|
type="text"
|
||||||
<input
|
id="line1-expr"
|
||||||
type="text"
|
readonly
|
||||||
id="line1-expr"
|
class="w-full px-3 py-1 text-xs border border-gray-700 rounded bg-gray-900 text-gray-400 font-mono mt-1 cursor-default focus:outline-none focus:ring-0 focus:border-gray-700"
|
||||||
readonly
|
/>
|
||||||
class="w-full px-3 py-1 text-xs border border-gray-700 rounded bg-gray-950 text-gray-500 font-mono mt-1"
|
</div>
|
||||||
|
|
||||||
/>
|
<div class="flex-1">
|
||||||
</div>
|
<label for="line2" class="block text-xs font-medium text-gray-400 mb-1"> Line 2 </label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="line2"
|
||||||
|
class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="line2-expr"
|
||||||
|
readonly
|
||||||
|
class="w-full px-3 py-1 text-xs border border-gray-700 rounded bg-gray-900 text-gray-400 font-mono mt-1 cursor-default focus:outline-none focus:ring-0 focus:border-gray-700"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex-1">
|
<div class="w-24">
|
||||||
<label for="line2" class="block text-xs font-medium text-gray-400 mb-1">
|
<label for="lang" class="block text-xs font-medium text-gray-400 mb-1"> Lang </label>
|
||||||
Line 2
|
<input
|
||||||
</label>
|
type="text"
|
||||||
<input
|
id="lang"
|
||||||
type="text"
|
class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono text-center"
|
||||||
id="line2"
|
maxlength="5"
|
||||||
class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono"
|
/>
|
||||||
/>
|
</div>
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="line2-expr"
|
|
||||||
readonly
|
|
||||||
class="w-full px-3 py-1 text-xs border border-gray-700 rounded bg-gray-950 text-gray-500 font-mono mt-1"
|
|
||||||
|
|
||||||
/>
|
<div class="pt-5 flex gap-2">
|
||||||
</div>
|
<button
|
||||||
|
id="shareBtn"
|
||||||
<div class="w-24">
|
class="px-4 py-1.5 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 transition-all"
|
||||||
<label for="lang" class="block text-xs font-medium text-gray-400 mb-1">
|
>
|
||||||
Lang
|
Share
|
||||||
</label>
|
</button>
|
||||||
<input
|
<button
|
||||||
type="text"
|
id="resetBtn"
|
||||||
id="lang"
|
class="px-4 py-1.5 text-sm font-medium text-white bg-gray-700 rounded hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 focus:ring-offset-gray-900 transition-all"
|
||||||
class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono text-center"
|
>
|
||||||
maxlength="5"
|
Reset
|
||||||
/>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pt-5 flex gap-2">
|
|
||||||
|
|
||||||
<button
|
|
||||||
id="shareBtn"
|
|
||||||
class="px-4 py-1.5 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 transition-all"
|
|
||||||
>
|
|
||||||
Share
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
id="resetBtn"
|
|
||||||
class="px-4 py-1.5 text-sm font-medium text-white bg-gray-700 rounded hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 focus:ring-offset-gray-900 transition-all"
|
|
||||||
>
|
|
||||||
Reset
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="map" class="flex-1"></div>
|
<div id="map" class="flex-1"></div>
|
||||||
|
|
||||||
<!-- Modal Dialog -->
|
<!-- Modal Dialog -->
|
||||||
<div id="shareModal" class="hidden fixed inset-0 z-50">
|
<div id="shareModal" class="hidden fixed inset-0 z-50">
|
||||||
<div id="modalOverlay" class="fixed inset-0 bg-black/50"></div>
|
<div id="modalOverlay" class="fixed inset-0 bg-black/50"></div>
|
||||||
<div class="fixed inset-0 flex items-center justify-center p-4">
|
<div class="fixed inset-0 flex items-center justify-center p-4">
|
||||||
<div class="relative bg-gray-800 rounded-lg p-8 max-w-md shadow-2xl">
|
<div class="relative bg-gray-800 rounded-lg p-8 max-w-md shadow-2xl">
|
||||||
<p class="text-gray-300 text-center leading-relaxed mb-6">
|
<p class="text-gray-300 text-center leading-relaxed mb-6">
|
||||||
Your settings have been saved to the URL.<br>
|
Your settings have been saved to the URL.<br />
|
||||||
Copy the address bar to share this map.
|
Copy the address bar to share this map.
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
id="closeModalBtn"
|
id="closeModalBtn"
|
||||||
class="w-full py-2.5 text-sm text-white bg-gray-700 rounded hover:bg-gray-600 transition-all"
|
class="w-full py-2.5 text-sm text-white bg-gray-700 rounded hover:bg-gray-600 transition-all"
|
||||||
>
|
>
|
||||||
Close
|
Close
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
||||||
<script src="mix.js"></script>
|
<script src="mix.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ function initializeModal() {
|
|||||||
modal.classList.add('hidden')
|
modal.classList.add('hidden')
|
||||||
})
|
})
|
||||||
|
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', e => {
|
||||||
if (e.key === 'Escape' && !modal.classList.contains('hidden')) {
|
if (e.key === 'Escape' && !modal.classList.contains('hidden')) {
|
||||||
modal.classList.add('hidden')
|
modal.classList.add('hidden')
|
||||||
}
|
}
|
||||||
@@ -190,8 +190,8 @@ function buildFieldAccessor(config, langCode) {
|
|||||||
const parts = []
|
const parts = []
|
||||||
const fields = config
|
const fields = config
|
||||||
.split(',')
|
.split(',')
|
||||||
.map((f) => f.trim())
|
.map(f => f.trim())
|
||||||
.filter((f) => f)
|
.filter(f => f)
|
||||||
|
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
if (field === 'underscore') {
|
if (field === 'underscore') {
|
||||||
@@ -210,4 +210,4 @@ function buildFieldAccessor(config, langCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return parts.length > 0 ? ['coalesce', ...parts] : null
|
return parts.length > 0 ? ['coalesce', ...parts] : null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OpenFreeMap Debug</title>
|
<title>OpenFreeMap Debug</title>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||||
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map" class="w-full h-screen"></div>
|
<div id="map" class="w-full h-screen"></div>
|
||||||
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
||||||
<script src="params.js"></script>
|
<script src="params.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -52,23 +52,23 @@ function applyLanguage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
map.on('load', () => {
|
map.on('load', () => {
|
||||||
let langCode = getLanguageParam()
|
const langCode = getLanguageParam()
|
||||||
|
|
||||||
// Alert the URL param value on first load
|
// Alert the URL param value on first load
|
||||||
alert(
|
alert(
|
||||||
`Language parameter: ${langCode || 'not set (defaulting to en)'}\n\n` +
|
`Language parameter: ${langCode || 'not set (defaulting to en)'}\n\n` +
|
||||||
'To change the map language, modify the ?lang= parameter in the URL.\n' +
|
'To change the map language, modify the ?lang= parameter in the URL.\n' +
|
||||||
'Labels will be RED when different.\n' +
|
'Labels will be RED when different.\n' +
|
||||||
'name_xx on line 1, name:xx on line 2'
|
'name_xx on line 1, name:xx on line 2',
|
||||||
)
|
)
|
||||||
|
|
||||||
// Add default param if not present
|
// Add default param if not present
|
||||||
if (!langCode) {
|
if (!langCode) {
|
||||||
const url = new URL(window.location)
|
const url = new URL(window.location)
|
||||||
url.searchParams.set('lang', 'en')
|
url.searchParams.set('lang', 'en')
|
||||||
window.history.replaceState({}, '', url)
|
window.history.replaceState({}, '', url)
|
||||||
}
|
}
|
||||||
|
|
||||||
applyLanguage()
|
applyLanguage()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OpenFreeMap Debug</title>
|
<title>OpenFreeMap Debug</title>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||||
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map" class="w-full h-screen"></div>
|
<div id="map" class="w-full h-screen"></div>
|
||||||
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
|
||||||
<script src="switch.js"></script>
|
<script src="switch.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -23,4 +23,4 @@ const map = new maplibregl.Map({
|
|||||||
|
|
||||||
map.on('load', () => {
|
map.on('load', () => {
|
||||||
console.log('Terrain map loaded')
|
console.log('Terrain map loaded')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user