]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/note.js.erb
Loading indicator for notes
[rails.git] / app / assets / javascripts / index / note.js.erb
index 9e92c9a1fb7c968e0790db391d3d1a103a41d931..a11f6a72c93a8dc8393aeea1c98be5d470082edf 100644 (file)
@@ -68,13 +68,26 @@ OSM.Note = function(map) {
     };
 
     page.load = function() {
+        var loadTimer = setTimeout(setLoading, 250);
         $('#sidebar_content').load(window.location.pathname + "?xhr=1", function(a, b, xhr) {
             if (xhr.getResponseHeader('X-Page-Title')) {
                 document.title = xhr.getResponseHeader('X-Page-Title');
             }
             bind();
+            clearTimeout(loadTimer);
+            clearLoading();
         });
     };
 
+    function setLoading() {
+      if($('#browse_status').is(':empty')) {
+        $('#browse_status').append($('<p></p>').text(I18n.t('browse.start_rjs.loading')));
+      }
+    }
+
+    function clearLoading() {
+      $('#browse_status').empty();
+    }
+
     return page;
 };