]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/browse.js
Refactor layer persistence
[rails.git] / app / assets / javascripts / browse.js
index 4edee5952664d3fd1ab6adef034275e2c568a5c2..9caaa3714516a9c38e7be80ca1b985e7d3a43035 100644 (file)
@@ -8,23 +8,17 @@ $(document).ready(function () {
 
     $("#linkloader").load(function () { loaded = true; });
 
-    if (select) {
-      $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?" +
-        querystring.stringify({
-            left: left,
-            top: top,
-            right: right,
-            bottom: bottom,
-            select: select
-        }));
-    } else {
-      $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?" + querystring.stringify({
-            left: left,
-            top: top,
-            right: right,
-            bottom: bottom
-        }));
-    }
+    var query = {
+        left: left,
+        top: top,
+        right: right,
+        bottom: bottom,
+        select: select
+    };
+
+    if (select) query.select = select;
+    $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?" +
+      querystring.stringify(query));
 
     setTimeout(function () {
       if (!loaded) alert(I18n.t('site.index.remote_failed'));