]> git.openstreetmap.org Git - rails.git/commitdiff
Create linkloader iframe in script
authorJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 5 Aug 2013 23:30:45 +0000 (16:30 -0700)
committerTom Hughes <tom@compton.nu>
Tue, 6 Aug 2013 07:32:06 +0000 (08:32 +0100)
app/assets/javascripts/application.js
app/views/browse/_map.html.erb
app/views/site/index.html.erb

index cbea58cc17628bc6f4daf90c432c635f8546df67..b257f7fedfd575f65a881dc213a9d88112cb8786 100644 (file)
@@ -44,12 +44,21 @@ function remoteEditHandler(bbox, select) {
       };
 
   if (select) query.select = select;
       };
 
   if (select) query.select = select;
-  $("#linkloader")
+
+  var iframe = $('<iframe>')
+    .hide()
+    .appendTo('body')
     .attr("src", "http://127.0.0.1:8111/load_and_zoom?" + querystring.stringify(query))
     .attr("src", "http://127.0.0.1:8111/load_and_zoom?" + querystring.stringify(query))
-    .load(function() { loaded = true; });
+    .on('load', function() {
+      $(this).remove();
+      loaded = true;
+    });
 
   setTimeout(function () {
 
   setTimeout(function () {
-    if (!loaded) alert(I18n.t('site.index.remote_failed'));
+    if (!loaded) {
+      alert(I18n.t('site.index.remote_failed'));
+      iframe.remove();
+    }
   }, 1000);
 
   return false;
   }, 1000);
 
   return false;
index ed3cc0faf169b829b828caab84b00ad67a1bce1d..9b82753fb237fe3febc990f695e51403d9282b17 100644 (file)
@@ -1,6 +1,3 @@
-<iframe id="linkloader" style="display: none">
-</iframe>
-
 <div id="browse_map" class='clearfix content_map'>
   <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible? %>
 
 <div id="browse_map" class='clearfix content_map'>
   <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible? %>
 
index 721fd18edc988154efc7c9a6ea658d72369a112e..73e1382d301231490a690437ae48d30c6cdcdf14 100644 (file)
@@ -19,9 +19,6 @@
 <div id="map" tabindex="2">
 </div>
 
 <div id="map" tabindex="2">
 </div>
 
-<iframe id="linkloader" style="display: none">
-</iframe>
-
 <div id="attribution">
   <table width="100%">
     <tr>
 <div id="attribution">
   <table width="100%">
     <tr>