X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2b4f8e92c969a5508b73ae7af45811a118fda6b1..248d0b863cde44881574ef01b974afeb2cad12e9:/app/assets/javascripts/index/browse.js diff --git a/app/assets/javascripts/index/browse.js b/app/assets/javascripts/index/browse.js index 752c84fec..d196476f4 100644 --- a/app/assets/javascripts/index/browse.js +++ b/app/assets/javascripts/index/browse.js @@ -42,14 +42,15 @@ function initializeBrowse(map) { function updateData() { var bounds = map.getBounds(); - getData(!browseBounds || !browseBounds.contains(bounds)); - browseBounds = bounds; + if (!browseBounds || !browseBounds.contains(bounds)) { + getData(); + } } function displayFeatureWarning(count, limit, callback) { $('#browse_status').html( $("
") - .text(I18n.t("browse.start_rjs.loaded_an_area_with_num_features", { num_features: count, max_features: limit })) + .text(I18n.t("browse.start_rjs.feature_warning", { num_features: count, max_features: limit })) .append( $("") .val(I18n.t('browse.start_rjs.load_data')) @@ -58,7 +59,7 @@ function initializeBrowse(map) { var dataLoader; - function getData(inPrevious) { + function getData() { var bounds = map.getBounds(); var size = bounds.getSize(); @@ -69,8 +70,6 @@ function initializeBrowse(map) { return; } - if (inPrevious) return; - var url = "/api/" + OSM.API_VERSION + "/map?bbox=" + bounds.toBBoxString(); /* @@ -110,6 +109,7 @@ function initializeBrowse(map) { } dataLoader = null; + browseBounds = bounds; } }); } @@ -124,7 +124,7 @@ function initializeBrowse(map) { layer.originalStyle = layer.options; layer.setStyle({color: '#0000ff', weight: 8}); - OSM.route('/browse/' + layer.feature.type + '/' + layer.feature.id); + OSM.router.route('/' + layer.feature.type + '/' + layer.feature.id); // Stash the currently drawn feature selectedLayer = layer;