From f3a77b08006768e90b0e2d6f7797a610630f5cfd Mon Sep 17 00:00:00 2001 From: marc tobias Date: Sun, 23 Feb 2020 03:18:16 +0100 Subject: [PATCH] update /dist after eslint fixes --- TODO.md | 5 --- dist/assets/js/nominatim-ui.js | 11 +++++-- dist/details.html | 57 ++++++++++++++++++++++++++-------- dist/detailspage-index.hbs | 28 +++++++++++++---- dist/detailspage.hbs | 29 ++++++++++++----- dist/handlebar_helpers.js | 22 +++++++------ dist/reverse.html | 19 +++++++++--- dist/reversepage.hbs | 19 +++++++++--- dist/search.html | 36 ++++++++++++++------- dist/searchpage.hbs | 34 ++++++++++++++------ 10 files changed, 187 insertions(+), 73 deletions(-) diff --git a/TODO.md b/TODO.md index 5e2a295..0a07f67 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,5 @@ # TODO list -* check output of /dist into repository? - ## Might never work @@ -11,13 +9,10 @@ ## 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 * cache `update_data_date` result somehow? * a new search causes a new pageview * add tests with fixtures -* detailpage: make linkedplaces, childplaces optional (rarely used? second click to enable?) * set better alt tag for icons * print text "loading..." instead of an error (which the user sees for a split second) * concatenate/minify JS and CSS diff --git a/dist/assets/js/nominatim-ui.js b/dist/assets/js/nominatim-ui.js index 3e65156..4101705 100644 --- a/dist/assets/js/nominatim-ui.js +++ b/dist/assets/js/nominatim-ui.js @@ -62,9 +62,14 @@ function map_viewbox_as_string() { function fetch_from_api(endpoint_name, params, callback) { // `&a=&b=&c=1` => '&c=' - for (var k in params) { - if (typeof (params[k]) === 'undefined' || params[k] === '' || params[k] === null) { - delete params[k]; + // fetch_from_api + + // var c = ; + var keys = Object.keys(params); + for (var i = 0; i < keys.length; i += 1) { + var val = params[keys[i]]; + if (typeof (val) === 'undefined' || val === '' || val === null) { + delete params[keys[i]]; } } diff --git a/dist/details.html b/dist/details.html index 8aa00cd..d22be81 100644 --- a/dist/details.html +++ b/dist/details.html @@ -156,7 +156,10 @@
-

{{aPlace.localname}} {{detailsPermaLink aPlace 'link to this page'}}

+

+ {{aPlace.localname}} + {{detailsPermaLink aPlace 'link to this page'}} +

{{formatMapIcon aPlace.icon}} @@ -169,7 +172,9 @@ Name {{#each aPlace.names}} -
{{this}} ({{@key}})
+
+ {{this}} ({{@key}}) +
{{/each}} @@ -204,14 +209,19 @@ Centre Point (lat,lon) - {{aPlace.centroid.coordinates.[1]}},{{aPlace.centroid.coordinates.[0]}} + + {{aPlace.centroid.coordinates.[1]}},{{aPlace.centroid.coordinates.[0]}} + OSM {{osmLink aPlace}} - Place Id (on this server) + + Place Id + (on this server) + {{aPlace.place_id}} {{#if aPlace.calculated_wikipedia}} @@ -228,7 +238,9 @@ Address Tags {{#each aPlace.addresstags}} -
{{this}} ({{@key}})
+
+ {{this}} ({{@key}}) +
{{/each}} @@ -236,7 +248,9 @@ Extra Tags {{#each aPlace.extratags}} -
{{this}} ({{@key}})
+
+ {{this}} ({{@key}}) +
{{/each}} @@ -299,7 +313,8 @@ {{else}} - display child places + display child places {{/if}} @@ -322,16 +337,27 @@

Search by place id

- - + +

Search by OSM type and OSM id

-
- + + @@ -341,8 +367,13 @@

Search by openstreetmap.org URL

- - + + diff --git a/dist/detailspage-index.hbs b/dist/detailspage-index.hbs index b2ecf7d..c81d525 100644 --- a/dist/detailspage-index.hbs +++ b/dist/detailspage-index.hbs @@ -8,16 +8,27 @@

Search by place id

- - + +

Search by OSM type and OSM id

-
- + + @@ -27,8 +38,13 @@

Search by openstreetmap.org URL

- - + + diff --git a/dist/detailspage.hbs b/dist/detailspage.hbs index 8f9ff76..929cf71 100644 --- a/dist/detailspage.hbs +++ b/dist/detailspage.hbs @@ -38,7 +38,10 @@
-

{{aPlace.localname}} {{detailsPermaLink aPlace 'link to this page'}}

+

+ {{aPlace.localname}} + {{detailsPermaLink aPlace 'link to this page'}} +

{{formatMapIcon aPlace.icon}} @@ -51,7 +54,9 @@ Name {{#each aPlace.names}} -
{{this}} ({{@key}})
+
+ {{this}} ({{@key}}) +
{{/each}} @@ -86,14 +91,19 @@ Centre Point (lat,lon) - {{aPlace.centroid.coordinates.[1]}},{{aPlace.centroid.coordinates.[0]}} + + {{aPlace.centroid.coordinates.[1]}},{{aPlace.centroid.coordinates.[0]}} + OSM {{osmLink aPlace}} - Place Id (on this server) + + Place Id + (on this server) + {{aPlace.place_id}} {{#if aPlace.calculated_wikipedia}} @@ -110,7 +120,9 @@ Address Tags {{#each aPlace.addresstags}} -
{{this}} ({{@key}})
+
+ {{this}} ({{@key}}) +
{{/each}} @@ -118,7 +130,9 @@ Extra Tags {{#each aPlace.extratags}} -
{{this}} ({{@key}})
+
+ {{this}} ({{@key}}) +
{{/each}} @@ -181,7 +195,8 @@ {{else}} - display child places + display child places {{/if}} diff --git a/dist/handlebar_helpers.js b/dist/handlebar_helpers.js index 358ac36..e233eb9 100644 --- a/dist/handlebar_helpers.js +++ b/dist/handlebar_helpers.js @@ -1,3 +1,5 @@ +'use strict'; + function formatOSMType(sType, bExcludeExternal) { if (sType === 'N') return 'node'; if (sType === 'W') return 'way'; @@ -12,7 +14,7 @@ function formatOSMType(sType, bExcludeExternal) { } Handlebars.registerHelper({ - shortOSMType: function(sType) { + shortOSMType: function (sType) { if (sType === 'node') return 'N'; if (sType === 'way') return 'W'; if (sType === 'relation') return 'R'; @@ -99,7 +101,7 @@ Handlebars.registerHelper({ return (iLevel < 15 ? iLevel : ''); }, formatMapIcon: function (sIcon) { - if (!sIcon) return; + if (!sIcon) return ''; var url = sIcon; if (!url.match(/^http/)) url = get_config_value('Images_Base_Url') + url; @@ -117,7 +119,8 @@ Handlebars.registerHelper({ if (aPlace.type && aPlace.type === 'yes' && aPlace.class) { return capitalize(aPlace.class.replace(/_/g, ' ')); - } else if (aPlace.type) { + } + if (aPlace.type) { return capitalize(aPlace.type.replace(/_/g, ' ')); } return ''; @@ -146,13 +149,10 @@ Handlebars.registerHelper({ return 'other: ' + iRank; }, tooManyHierarchyLinesWarning: function (aPlace) { - if (!aPlace.hierarchy) return; + if (!aPlace.hierarchy) return ''; - var c = 0; - for (var type in aPlace.hierarchy) { - c = c + type.length + 1; - } - if (c < 500) return; + var c = Object.keys(aPlace.hierarchy); + if (c < 500) return ''; return new Handlebars.SafeString( '

There are more child objects which are not shown.

' @@ -186,7 +186,9 @@ Handlebars.registerHelper({ var select = $(' - + <> - + max zoom
- +
{{/inline}}
- + <> - + max zoom
- +
{{/inline}}
- +
@@ -143,7 +149,8 @@ {{/if}}
- +
@@ -163,7 +170,9 @@ {{#if aSearchResults}} {{#if sMoreURL}} {{/if}} {{else}} @@ -176,13 +185,18 @@ {{/if}} diff --git a/dist/searchpage.hbs b/dist/searchpage.hbs index 8516f08..a4c220d 100644 --- a/dist/searchpage.hbs +++ b/dist/searchpage.hbs @@ -9,14 +9,20 @@ ({{formatLabel aResult}})

{{aResult.lat}},{{aResult.lon}}

- details + details
{{/inline}}
- +
@@ -25,7 +31,8 @@ {{/if}}
- +
@@ -45,7 +52,9 @@ {{#if aSearchResults}} {{#if sMoreURL}} {{/if}} {{else}} @@ -58,13 +67,18 @@ {{/if}} -- 2.39.5