X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ef37ad8aaac510d34ccf7f14589c2584fc2b63ac..5e9ab5bc5edb63b7ab7719fa989a18f52e3637a2:/app/assets/javascripts/index/browse.js diff --git a/app/assets/javascripts/index/browse.js b/app/assets/javascripts/index/browse.js index 8681d8f56..e04a864f4 100644 --- a/app/assets/javascripts/index/browse.js +++ b/app/assets/javascripts/index/browse.js @@ -2,7 +2,7 @@ //= require templates/browse/feature_list //= require templates/browse/feature_history -$(document).ready(function () { +function initializeBrowse(map) { var browseBounds; var layersById; var selectedLayer; @@ -10,20 +10,20 @@ $(document).ready(function () { var areasHidden = false; var locationFilter; - var dataLayer = new L.OSM.DataLayer(null, { - styles: { - way: { - weight: 3, - color: "#000000", - opacity: 0.4 - }, - area: { - weight: 3, - color: "#ff0000" - }, - node: { - color: "#00ff00" - } + var dataLayer = map.dataLayer; + + dataLayer.setStyle({ + way: { + weight: 3, + color: "#000000", + opacity: 0.4 + }, + area: { + weight: 3, + color: "#ff0000" + }, + node: { + color: "#00ff00" } }); @@ -35,10 +35,6 @@ $(document).ready(function () { onSelect(e.layer); }); - if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') { -// map.layersControl.addOverlay(dataLayer, I18n.t("browse.start_rjs.data_layer_name")); - } - map.on('layeradd', function (e) { if (e.layer === dataLayer) { $.ajax({ url: "/browse/start", success: function (sidebarHtml) { @@ -327,4 +323,4 @@ $(document).ready(function () { $("#browse_status").html(""); $("#browse_status").hide(); } -}); +}