]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/osm.js.erb
Fix issues with bogus % encoded sequences in URLs
[rails.git] / app / assets / javascripts / osm.js.erb
index d933043b54298141ac41db1bee9c57115aa297c5..6a8b856bee2beaf155122cfcbb760a47e4931c64 100644 (file)
@@ -1,3 +1,5 @@
+//= depend_on application.yml
+
 OSM = {
 <% if defined?(PIWIK) %>
   PIWIK:                 <%= PIWIK.to_json %>,
@@ -11,11 +13,19 @@ OSM = {
   OVERPASS_URL:          <%= OVERPASS_URL.to_json %>,
   NOMINATIM_URL:         <%= NOMINATIM_URL.to_json %>,
 
+<% if defined?(MAPQUEST_KEY) %>
+  MAPQUEST_KEY:          <%= MAPQUEST_KEY.to_json %>,
+<% end %>
+<% if defined?(MAPZEN_VALHALLA_KEY) %>
+  MAPZEN_VALHALLA_KEY:   <%= MAPZEN_VALHALLA_KEY.to_json %>,
+<% end %>
+
   MARKER_GREEN:          <%= image_path("marker-green.png").to_json %>,
   MARKER_RED:            <%= image_path("marker-red.png").to_json %>,
-  MARKER_ICON:           <%= image_path("marker-icon.png").to_json %>,
-  MARKER_ICON_2X:        <%= image_path("marker-icon-2x.png").to_json %>,
-  MARKER_SHADOW:         <%= image_path("marker-shadow.png").to_json %>,
+
+  MARKER_ICON:           <%= image_path("images/marker-icon.png").to_json %>,
+  MARKER_ICON_2X:        <%= image_path("images/marker-icon-2x.png").to_json %>,
+  MARKER_SHADOW:         <%= image_path("images/marker-shadow.png").to_json %>,
 
   NEW_NOTE_MARKER:       <%= image_path("new_note_marker.png").to_json %>,
   OPEN_NOTE_MARKER:      <%= image_path("open_note_marker.png").to_json %>,
@@ -43,7 +53,12 @@ OSM = {
         j = pair.indexOf('='),
         key = pair.slice(0, j),
         val = pair.slice(++j);
-      params[key] = decodeURIComponent(val);
+
+      try {
+        params[key] = decodeURIComponent(val);
+      } catch (e) {
+        // Ignore parse exceptions
+      }
     }
 
     return params;