mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
work
This commit is contained in:
@@ -46,13 +46,20 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pt-5">
|
<div class="pt-5 flex gap-2">
|
||||||
|
|
||||||
<button
|
<button
|
||||||
id="shareBtn"
|
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"
|
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
|
Share
|
||||||
</button>
|
</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>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ map.on('load', () => {
|
|||||||
// Set defaults if no params present
|
// Set defaults if no params present
|
||||||
if (!params.has('line1') && !params.has('line2') && !params.has('lang')) {
|
if (!params.has('line1') && !params.has('line2') && !params.has('lang')) {
|
||||||
const url = new URL(window.location)
|
const url = new URL(window.location)
|
||||||
url.searchParams.set('line1', 'underscore,colon,name,latin')
|
url.searchParams.set('line1', 'colon,underscore,name,latin')
|
||||||
url.searchParams.set('line2', 'nonlatin')
|
url.searchParams.set('line2', 'nonlatin')
|
||||||
url.searchParams.set('lang', 'en')
|
url.searchParams.set('lang', 'en')
|
||||||
window.history.replaceState({}, '', url)
|
window.history.replaceState({}, '', url)
|
||||||
@@ -29,6 +29,7 @@ map.on('load', () => {
|
|||||||
applyConfiguration()
|
applyConfiguration()
|
||||||
initializeInputListeners()
|
initializeInputListeners()
|
||||||
initializeModal()
|
initializeModal()
|
||||||
|
initializeResetButton()
|
||||||
})
|
})
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
@@ -66,6 +67,13 @@ function initializeModal() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initializeResetButton() {
|
||||||
|
document.getElementById('resetBtn').addEventListener('click', () => {
|
||||||
|
const hash = window.location.hash
|
||||||
|
window.location.href = `${window.location.pathname}${hash}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// 3. CONFIGURATION & SYNC
|
// 3. CONFIGURATION & SYNC
|
||||||
// ============================================
|
// ============================================
|
||||||
@@ -175,16 +183,16 @@ function buildFieldAccessor(config, langCode) {
|
|||||||
parts.push(['get', `name_${langCode}`])
|
parts.push(['get', `name_${langCode}`])
|
||||||
} else if (field === 'colon') {
|
} else if (field === 'colon') {
|
||||||
parts.push(['get', `name:${langCode}`])
|
parts.push(['get', `name:${langCode}`])
|
||||||
} else if (field === 'name') {
|
|
||||||
parts.push(['get', 'name'])
|
|
||||||
} else if (field === 'latin') {
|
} else if (field === 'latin') {
|
||||||
parts.push(['get', 'name:latin'])
|
parts.push(['get', 'name:latin'])
|
||||||
} else if (field === 'nonlatin') {
|
} else if (field === 'nonlatin') {
|
||||||
parts.push(['get', 'name:nonlatin'])
|
parts.push(['get', 'name:nonlatin'])
|
||||||
|
} else if (field === 'name') {
|
||||||
|
parts.push(['get', 'name'])
|
||||||
} else {
|
} else {
|
||||||
parts.push(['get', field])
|
parts.push(['get', field])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts.length > 0 ? ['coalesce', ...parts] : null
|
return parts.length > 0 ? ['coalesce', ...parts] : null
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user