* pagination. API returns an array without indication if more results exist
* API returns category, type, but without admin_level we can't derive e.g. state,country
-* seeting acceptlanguage whichout a server component https://github.com/dansingerman/jQuery-Browser-Language
+* setting accept-language without a server component https://github.com/dansingerman/jQuery-Browser-Language
## Nice-to-have
* support nearlat,nearlon parameters
* should images/mapicons/ be served from API server or this repo?
* different content for official OSM, e.g. github urls
-* set HTML title
* cache `update_data_date` result somehow?
* a new search causes a new pageview
* add tests with fixtures
el.html(html);
}
+function update_html_title(title) {
+ var prefix = '';
+ if (title && title.length > 1) {
+ prefix = title + ' | ';
+ }
+ $('head title').text(prefix + 'OpenStreetMap Nominatim');
+}
+
function show_error(html) {
$('#error-overlay').html(html).show();
}
var context = { aPlace: aFeature, base_url: location.search };
render_template($('main'), 'detailspage-template', context);
+ if (api_request_params.place_id) {
+ update_html_title('Details for ' + api_request_params.place_id);
+ } else {
+ update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
+ }
update_data_date();
iZoom: (search_params.get('zoom') > 1 ? api_request_params.zoom : get_config_value('Reverse_Default_Search_Zoom'))
};
-
+ update_html_title();
if (api_request_params.lat && api_request_params.lon) {
fetch_from_api('reverse', api_request_params, function (aPlace) {
context.aPlace = aPlace;
render_template($('main'), 'reversepage-template', context);
+ update_html_title('Reverse result for ' + api_request_params.lat + ',' + api_request_params.lon);
init_map_on_search_page(
is_reverse_search,
context.aSearchResults = aResults;
render_template($('main'), 'searchpage-template', context);
+ update_html_title('Result for ' + api_request_params.q);
init_map_on_search_page(is_reverse_search, aResults, get_config_value('Map_Default_Lat'), get_config_value('Map_Default_Lon'), get_config_value('Map_Default_Zoom'));
el.html(html);
}
+function update_html_title(title) {
+ var prefix = '';
+ if (title && title.length > 1) {
+ prefix = title + ' | ';
+ }
+ $('head title').text(prefix + 'OpenStreetMap Nominatim');
+}
+
function show_error(html) {
$('#error-overlay').html(html).show();
}
var context = { aPlace: aFeature, base_url: location.search };
render_template($('main'), 'detailspage-template', context);
+ if (api_request_params.place_id) {
+ update_html_title('Details for ' + api_request_params.place_id);
+ } else {
+ update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
+ }
update_data_date();
iZoom: (search_params.get('zoom') > 1 ? api_request_params.zoom : get_config_value('Reverse_Default_Search_Zoom'))
};
-
+ update_html_title();
if (api_request_params.lat && api_request_params.lon) {
fetch_from_api('reverse', api_request_params, function (aPlace) {
context.aPlace = aPlace;
render_template($('main'), 'reversepage-template', context);
+ update_html_title('Reverse result for ' + api_request_params.lat + ',' + api_request_params.lon);
init_map_on_search_page(
is_reverse_search,
context.aSearchResults = aResults;
render_template($('main'), 'searchpage-template', context);
+ update_html_title('Result for ' + api_request_params.q);
init_map_on_search_page(is_reverse_search, aResults, get_config_value('Map_Default_Lat'), get_config_value('Map_Default_Lon'), get_config_value('Map_Default_Zoom'));