X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/78f608b114c05f1147936a57b930831e28000c1a..d0ed118ee24401a7e6117efa74522e67a9babba6:/app/assets/javascripts/index/browse.js?ds=sidebyside diff --git a/app/assets/javascripts/index/browse.js b/app/assets/javascripts/index/browse.js index 5ca29e568..8681d8f56 100644 --- a/app/assets/javascripts/index/browse.js +++ b/app/assets/javascripts/index/browse.js @@ -36,7 +36,7 @@ $(document).ready(function () { }); if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') { - map.layersControl.addOverlay(dataLayer, I18n.t("browse.start_rjs.data_layer_name")); +// map.layersControl.addOverlay(dataLayer, I18n.t("browse.start_rjs.data_layer_name")); } map.on('layeradd', function (e) { @@ -69,10 +69,10 @@ $(document).ready(function () { map.on("moveend", updateData); updateData(); - $("#browse_filter_toggle").toggle(enableFilter, disableFilter); + $("#browse_filter_toggle").click(toggleFilter); $("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.hide_areas')); - $("#browse_hide_areas_box").toggle(hideAreas, showAreas); + $("#browse_hide_areas_box").click(toggleAreas); $("#sidebar").one("closed", function () { map.removeLayer(dataLayer); @@ -96,28 +96,28 @@ $(document).ready(function () { } } - function enableFilter() { - $("#browse_filter_toggle").html(I18n.t('browse.start_rjs.view_data')); - locationFilter.setBounds(map.getBounds().pad(-0.2)); - locationFilter.enable(); - getData(); - } + function toggleFilter() { + if (locationFilter.isEnabled()) { + $("#browse_filter_toggle").html(I18n.t('browse.start_rjs.manually_select')); + locationFilter.disable(); + } else { + $("#browse_filter_toggle").html(I18n.t('browse.start_rjs.view_data')); + locationFilter.setBounds(map.getBounds().pad(-0.2)); + locationFilter.enable(); + } - function disableFilter() { - $("#browse_filter_toggle").html(I18n.t('browse.start_rjs.manually_select')); - locationFilter.disable(); getData(); } - function hideAreas() { - $("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.show_areas')); - areasHidden = true; - getData(); - } + function toggleAreas() { + if (areasHidden) { + $("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.hide_areas')); + areasHidden = false; + } else { + $("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.show_areas')); + areasHidden = true; + } - function showAreas() { - $("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.hide_areas')); - areasHidden = false; getData(); } @@ -151,7 +151,7 @@ $(document).ready(function () { setStatus(I18n.t('browse.start_rjs.loading')); - var url = "/api/" + OSM.API_VERSION + "/map?bbox=" + bounds.toBBOX(); + var url = "/api/" + OSM.API_VERSION + "/map?bbox=" + bounds.toBBoxString(); /* * Modern browsers are quite happy showing far more than 100 features in