]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/export.js
Add clearer close action, refactor base layer code
[rails.git] / app / assets / javascripts / index / export.js
index 3715cbf9970a57a185dafe3c8f0ee1c68f832722..1f624f125f60c5a61471c6d59a8fe2b03a453a30 100644 (file)
@@ -1,4 +1,4 @@
-$(document).ready(function () {
+function initializeExport(map) {
   $("#exportanchor").click(function (e) {
     $.ajax({ url: $(this).data('url'), success: function (sidebarHtml) {
       startExport(sidebarHtml);
@@ -38,7 +38,7 @@ $(document).ready(function () {
 
     openSidebar();
 
-    if (getMapBaseLayerId() == "mapnik") {
+    if (map.getMapBaseLayerId() == "mapnik") {
       $("#format_mapnik").prop("checked", true);
     }
 
@@ -186,7 +186,7 @@ $(document).ready(function () {
 
     function htmlUrlChanged() {
       var bounds = getBounds();
-      var layerName = getMapBaseLayerId();
+      var layerName = map.getMapBaseLayerId();
 
       var url = "http://" + OSM.SERVER_URL + "/export/embed.html?bbox=" + bounds.toBBoxString() + "&layer=" + layerName;
       var markerUrl = "";
@@ -203,7 +203,7 @@ $(document).ready(function () {
 
       var zoom = map.getBoundsZoom(bounds);
 
-      var layers = getMapLayers();
+      var layers = getMapLayers(map);
 
       var text = I18n.t('export.start_rjs.view_larger_map');
       var escaped = [];
@@ -281,4 +281,4 @@ $(document).ready(function () {
       validateControls();
     }
   }
-});
+}