diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 5ba3416..756f1fb 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1093,4 +1093,12 @@ function notifyMe(title, options) { // want to be respectful there is no need to bother them any more. } +function start_fetching(element){ + jQuery(element).append('
'); +} + +function stop_fetching(element){ + jQuery('.fetching-overlay', element).remove(); +} + window.isHidden = function isHidden() { return (typeof(document.hidden) != 'undefined') ? document.hidden : !document.hasFocus() }; diff --git a/public/javascripts/chat.js b/public/javascripts/chat.js index 1fd15c2..a2c7688 100644 --- a/public/javascripts/chat.js +++ b/public/javascripts/chat.js @@ -596,18 +596,20 @@ jQuery(function($) { } function recent_messages(jid, offset) { - if(!offset) offset = 0; - $.getJSON('/chat/recent_messages', {identifier: getIdentifier(jid), offset: offset}, function(data) { - $.each(data, function(i, message) { - var body = message['body']; - var from = message['from']; - var to = message['to']; - var date = message['created_at']; - var who = from['id']==getCurrentIdentifier() ? 'self' : from['id'] - - Jabber.show_message(jid, from['name'], body, who, from['id'], date, offset); - }); - }); + if(!offset) offset = 0; + start_fetching('.history'); + $.getJSON('/chat/recent_messages', {identifier: getIdentifier(jid), offset: offset}, function(data) { + $.each(data, function(i, message) { + var body = message['body']; + var from = message['from']; + var to = message['to']; + var date = message['created_at']; + var who = from['id']==getCurrentIdentifier() ? 'self' : from['id'] + + Jabber.show_message(jid, from['name'], body, who, from['id'], date, offset); + }); + stop_fetching('.history'); + }); } function count_unread_messages(jid_id, hide) { diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 024d2fa..0f12b6a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -6533,3 +6533,17 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img { .fetching { opacity: 0.3; } + +.fetching-overlay { + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background: rgba(0, 0, 0, 0.5); + padding: 10%; + text-align: center; + font-size: 200%; + color: rgb(255, 255, 255); + text-shadow: 0px 0px 10px #FFF; +} -- libgit2 0.21.2