
Drupal.heartbeat = Drupal.heartbeat || {};

Drupal.heartbeat.getOlderMessages = function(element) {
  $.post(element.href, {block: 1, ajax: 1}, Drupal.heartbeat.appendMessages);
}

Drupal.heartbeat.appendMessages = function(data) {
  var result = Drupal.parseJson(data);
  $('.heartbeat-older-messages').each(function(d){ $(this).remove(); });
  $('.heartbeat-messages-wrapper').append(result['data']);
  
  Drupal.attachBehaviors($('block-heartbeat-siteactivity'));
}