var floating_recipient_bar = (function () {

var exports = {};


var is_floating_recipient_bar_showing = false;

exports.frb_bottom = function () {
    var bar = $("#floating_recipient_bar");
    var bar_top = bar.offset().top;
    var bar_bottom = bar_top + bar.safeOuterHeight();

    return bar_bottom;
};

exports.obscured_recipient_bar = function () {
    // Find the recipient bar that is closed to being onscreen
    // but above the "top".

    // Start with the pointer's current location.
    var selected_row = current_msg_list.selected_row();

    if (selected_row === undefined || selected_row.length === 0) {
        return;
    }

    var candidate = rows.get_message_recipient_row(selected_row);
    if (candidate === undefined) {
        return;
    }

    var floating_recipient_bar_bottom = exports.frb_bottom();

    while (candidate.length) {
        if (candidate.is(".recipient_row")) {
            if (candidate.offset().top < floating_recipient_bar_bottom) {
                return candidate;
            }
        }
        candidate = candidate.prev();
    }
};

function show_floating_recipient_bar() {
    if (!is_floating_recipient_bar_showing) {
        $("#floating_recipient_bar").css('visibility', 'visible');
        is_floating_recipient_bar_showing = true;
    }
}

var old_label;
function replace_floating_recipient_bar(desired_label) {
    var new_label;
    var other_label;
    var header;
    if (desired_label !== old_label) {
        if (desired_label.children(".message_header_stream").length !== 0) {
            new_label = $("#current_label_stream");
            other_label = $("#current_label_private_message");
            header = desired_label.children(".message_header_stream");
        } else {
            new_label = $("#current_label_private_message");
            other_label = $("#current_label_stream");
            header = desired_label.children(".message_header_private_message");
        }
        new_label.find(".message_header").replaceWith(header.clone());
        other_label.css('display', 'none');
        new_label.css('display', 'block');
        new_label.attr("zid", rows.id(rows.first_message_in_group(desired_label)));

        new_label.toggleClass('message-fade', desired_label.hasClass('message-fade'));
        old_label = desired_label;
    }
    show_floating_recipient_bar();
}

exports.hide = function () {
    if (is_floating_recipient_bar_showing) {
        $("#floating_recipient_bar").css('visibility', 'hidden');
        is_floating_recipient_bar_showing = false;
    }
};

exports.update = function () {
    // .temp-show-date might be forcing the display of a recipient_row_date if
    // the floating_recipient_bar is just beginning to overlap the
    // top-most recipient_bar. remove all instances of .temp-show-date and
    // re-apply it if we continue to detect overlap
    $('.temp-show-date').removeClass('temp-show-date');

    var floating_recipient_bar_bottom = exports.frb_bottom();

    var current_label = exports.obscured_recipient_bar();

    if (!current_label) {
        exports.hide();
        return;
    }

    // We now know what the floating stream/topic bar should say.
    // Do we show it?

    // Hide if the bottom of our floating stream/topic label is not
    // lower than the bottom of current_label (since that means we're
    // covering up a label that already exists).
    var header_height = $(current_label).find('.message_header').safeOuterHeight();
    if (floating_recipient_bar_bottom <=
        current_label.offset().top + header_height) {
        // hide floating_recipient_bar and use .temp-show-date to force display
        // of the recipient_row_date belonging to the current recipient_bar
        $('.recipient_row_date', current_label).addClass('temp-show-date');
        exports.hide();
        return;
    }

    replace_floating_recipient_bar(current_label);
};


return exports;
}());

if (typeof module !== 'undefined') {
    module.exports = floating_recipient_bar;
}
window.floating_recipient_bar = floating_recipient_bar;

@@ -1304,21 +1304,22 @@
 var old_
-label
+source
 ;%0Afuncti
@@ -1352,29 +1352,36 @@
 ent_bar(
-desired_label
+source_recipient_bar
 ) %7B%0A    
@@ -1440,29 +1440,36 @@
     if (
-desired_label
+source_recipient_bar
  !== old
@@ -1469,21 +1469,22 @@
 !== old_
-label
+source
 ) %7B%0A    
@@ -1491,29 +1491,36 @@
     if (
-desired_label
+source_recipient_bar
 .childre
@@ -1695,37 +1695,44 @@
    header = 
-desired_label
+source_recipient_bar
 .children(%22.
@@ -1909,29 +1909,36 @@
 eader = 
-desired_label
+source_recipient_bar
 .childre
@@ -2209,29 +2209,36 @@
 n_group(
-desired_label
+source_recipient_bar
 )));%0A%0A  
@@ -2281,29 +2281,36 @@
 -fade', 
-desired_label
+source_recipient_bar
 .hasClas
@@ -2345,29 +2345,37 @@
 old_
-label = desired_label
+source = source_recipient_bar
 ;%0A  
@@ -3049,29 +3049,36 @@
     var 
-current_label
+source_recipient_bar
  = expor
@@ -3116,29 +3116,36 @@
    if (!
-current_label
+source_recipient_bar
 ) %7B%0A    
@@ -3376,29 +3376,36 @@
 ttom of 
-current_label
+source_recipient_bar
  (since 
@@ -3496,29 +3496,36 @@
 ght = $(
-current_label
+source_recipient_bar
 ).find('
@@ -3610,29 +3610,36 @@
         
-current_label
+source_recipient_bar
 .offset(
@@ -3852,29 +3852,36 @@
 _date', 
-current_label
+source_recipient_bar
 ).addCla
@@ -3984,29 +3984,36 @@
 ent_bar(
-current_label
+source_recipient_bar
 );%0A%7D;%0A%0A%0A

Rename vars in floating_recipient_bar.js.