2 import { onMount, onDestroy } from 'svelte';
5 page, results_store, current_request_latlon
6 } from '../lib/stores.js';
7 import { get_config_value } from '../lib/config_reader.js';
8 import { fetch_from_api, update_html_title } from '../lib/api_utils.js';
10 import ReverseBar from '../components/ReverseBar.svelte';
11 import ResultsList from '../components/ResultsList.svelte';
12 import Map from '../components/Map.svelte';
14 let api_request_params;
15 let bStructuredSearch;
18 let search_params = new URLSearchParams(window.location.search);
22 api_request_params = {
23 lat: search_params.get('lat'),
24 lon: search_params.get('lon'),
25 zoom: (search_params.get('zoom') > 1
26 ? Number(search_params.get('zoom'))
27 : Number(get_config_value('Reverse_Default_Search_Zoom'))),
31 if (api_request_params.lat || api_request_params.lat) {
33 fetch_from_api('reverse', api_request_params, function (data) {
34 if (data && !data.error) {
35 current_request_latlon.set([api_request_params.lat, api_request_params.lon]);
36 results_store.set([data]);
38 results_store.set([]);
41 update_html_title('Reverse result for '
42 + api_request_params.lat
44 + api_request_params.lon);
45 document.querySelector('input[name=lat]').focus();
50 let page_subscription;
51 onMount(() => { page_subscription = page.subscribe(loaddata); });
52 onDestroy(() => { page_subscription(); });
55 <ReverseBar api_request_params={api_request_params} />
59 <ResultsList reverse_search={true} />
61 <div id="map-wrapper">
62 <Map display_minimap={true} />
72 display: inline-block;
79 height: calc(100vh - 250pt);
82 display: inline-block;
86 @media (max-width: 768px) {