X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/1a80a11c4c07726feae8640d3b21ff970e4fdb9c..0a52a4eb0776874607a321c05c65c656abb85b7e:/app/views/site/index.html.erb?ds=sidebyside
diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb
index a89212238..843d0d2de 100644
--- a/app/views/site/index.html.erb
+++ b/app/views/site/index.html.erb
@@ -19,6 +19,9 @@
<%= t 'site.index.permalink' %>
<%= t 'site.index.shortlink' %>
@@ -267,11 +270,41 @@ end
resizeMap();
}
+ function josmEditHandler() {
+ var extent = getMapExtent();
+ var loaded = false;
+
+ $("linkloader").onload = function () { loaded = true; };
+ $("linkloader").src = "http://127.0.0.1:8111/load_and_zoom?left=" + extent.left + "&top=" + extent.top + "&right=" + extent.right + "&bottom=" + extent.bottom;
+
+ setTimeout(function () {
+ if (!loaded) alert("<%= t('site.index.josm_failed') %>");
+ }, 1000);
+
+ return false;
+ }
+
+ function installEditHandler() {
+ $("josmanchor").onclick =josmEditHandler;
+
+ <% if preferred_editor == "josm" %>
+ $("editanchor").onclick =josmEditHandler;
+
+ <% if params[:action] == "edit" %>
+ josmEditHandler();
+ <% end %>
+ <% end %>
+ }
+
mapInit();
window.onload = handleResize;
window.onresize = handleResize;
+ Event.observe(window, 'load', installEditHandler);
+ Event.observe(window, 'load', handleResize);
+ Event.observe(window, 'resize', handleResize);
+
<% if params['action'] == 'export' %>
<%= remote_function :url => { :controller => 'export', :action => 'start' } %>
<% end %>