diff options
author | Jochen Topf <jochen@topf.org> | 2015-03-16 20:29:12 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2015-03-16 20:29:12 +0100 |
commit | 6a60e51477ae17a1306c307c7550664ec181ef85 (patch) | |
tree | c1329491c2957f151510c29ba4f1eb9e1271ec02 | |
parent | 4446feaa389a7221cf9ff12e207ca06fff710281 (diff) | |
download | taginfo-6a60e51477ae17a1306c307c7550664ec181ef85.tar taginfo-6a60e51477ae17a1306c307c7550664ec181ef85.tar.gz |
Change the way Level0 editor is called.
We used to call the Overpass API and get all object IDs and then send those
object IDs to Level0. But Level0 can directly use an Overpass URL. This
removes an extra step and makes everything faster. Fixes #118.
-rw-r--r-- | web/public/js/taginfo.js | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index 8a5894e..22cb324 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -573,15 +573,9 @@ function level0_editor(overpass_url_prefix, level0_url_prefix, filter, key, valu query = '(node' + query + 'way' + query + 'rel' + query + ');'; } - var overpass_url = overpass_url_prefix + 'data=[out:json];' + query + 'out body;'; - - jQuery.getJSON(overpass_url, function(data) { - var objects = jQuery.map(data.elements, function(el) { - return el.type.substr(0,1) + el.id + (el.type == 'way' ? '!' : ''); - }); - var level0_url = level0_url_prefix + 'url=' + objects.join(','); - window.open(level0_url, '_blank'); - }); + var overpass_url = overpass_url_prefix + 'data=' + encodeURIComponent('[out:xml];' + query + 'out meta;'); + var level0_url = level0_url_prefix + 'url=' + encodeURIComponent(overpass_url); + window.open(level0_url, '_blank'); return false; } |