Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-focus on user's country #211

Open
Zaczero opened this issue Feb 18, 2024 · 0 comments
Open

Auto-focus on user's country #211

Zaczero opened this issue Feb 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Zaczero
Copy link
Member

Zaczero commented Feb 18, 2024

openstreetmap ma bardzo fajną funkcjonalność automatycznego fokusowania na kraj użytkownika, myślę że można to w miarę łatwo do nas dodać.

ten skrypt generuje w javascript mapowanie timezone => bbox: https://github.com/Zaczero/openstreetmap-ng/blob/main/scripts/timezone_bbox_update.py

a ten kawałek kodu wykrywa timezone przeglądarki i mapuje go do kraju. nie trzeba przeprowadzać detekcji ip, zerowy maintenance, reliable.

    const timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone
    const countryBounds = timezoneBoundsMap.get(timezoneName)

(albo można po prostu gotowy .js skopiować do nas (zamiast skryptu python), zmienia się on bardzo rzadko i nieznacznie): https://github.com/Zaczero/openstreetmap-ng/blob/e4c9df545ee55af4404d5aa79d9ab4aa6cabaae9/app/static/js/_timezone_bbox.js

@Zaczero Zaczero added the enhancement New feature or request label Feb 18, 2024
@Zaczero Zaczero changed the title Auto-focus on client's country Auto-focus on user's country Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant