]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.rhtml
Use defer="defer" rather than onload to try and speed up page loading.
[rails.git] / app / views / site / index.rhtml
index 878720efc7888b62abfe9654c21f490778f399f3..97eeda5a88ca6171a327e172ddbf05a688b017b3 100644 (file)
@@ -77,13 +77,13 @@ by the OpenStreetMap project and it's contributors.
 <%= javascript_include_tag 'map.js' %>
 
 
-<script type="text/javascript">
+<script type="text/javascript" defer="defer">
   <!--
   var brokenContentSize = $("content").offsetWidth == 0;
   var marker;
   var map;
 
-  function init(){
+  function mapInit(){
     map = createMap("map");
 
     <% if bbox %>
@@ -115,20 +115,11 @@ by the OpenStreetMap project and it's contributors.
 
     map.events.register("moveend", map, updateLocation);
     map.events.register("changelayer", map, updateLocation);
-    map.events.register("click", map, mapClick);
     updateLocation();
 
     handleResize();
   }
 
-  // Map click results in feature lookup
-  function mapClick(e) {
-      var pos = lonLatToNonSphericalMercator
-                (mercatorToLonLat
-                    (map.getLonLatFromViewPortPx 
-                        ( map.events.getMousePosition(e))));
-  }
-
   function getPosition() {
     return mercatorToLonLat(map.getCenter());
   }
@@ -188,6 +179,7 @@ by the OpenStreetMap project and it's contributors.
   }
 
   window.onresize = handleResize;
-  window.onload = init;
+  
+  mapInit();
 // -->
 </script>