From: Darren Date: Sun, 30 Nov 2014 03:43:34 +0000 (+0000) Subject: Keeping the .last_seen message marker in place until window blurs again X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8859068cd4c5845d872625bce6ee4cd1ae2f8cbd;p=KiwiIRC.git Keeping the .last_seen message marker in place until window blurs again --- diff --git a/client/src/views/application.js b/client/src/views/application.js index c13fea2..125430f 100644 --- a/client/src/views/application.js +++ b/client/src/views/application.js @@ -51,7 +51,7 @@ _kiwi.view.Application = Backbone.View.extend({ $(window).on('blur', function windowOnBlur() { var active_panel = that.model.panels().active; if (active_panel && active_panel.view.updateLastSeenMarker) { - _kiwi.global.connections.active.view.updateLastSeenMarker(); + active_panel.view.updateLastSeenMarker(); } that.has_focus = false; diff --git a/client/src/views/channel.js b/client/src/views/channel.js index 14630ab..f7a0655 100644 --- a/client/src/views/channel.js +++ b/client/src/views/channel.js @@ -81,8 +81,6 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ line_msg = '
<%- time_string %>
<%- nick %>
<%= msg %>
'; this.$messages.append($(_.template(line_msg, display_obj)).data('message', msg)); - this.updateLastSeenMarker(); - // Activity/alerts based on the type of new message if (msg.type.match(/^action /)) { this.alert('action'); @@ -404,19 +402,12 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ updateLastSeenMarker: function() { - var last_seen, last_message; - if (this.model.isActive() && _kiwi.app.view.has_focus) { + if (this.model.isActive()) { // Remove the previous last seen classes - last_seen = this.$(".last_seen"); - if (last_seen && last_seen.length) { - last_seen.removeClass("last_seen"); - } + this.$(".last_seen").removeClass("last_seen"); // Mark the last message the user saw - last_message = this.$messages.children().last(); - if (last_message) { - last_message.addClass("last_seen"); - } + this.$messages.children().last().addClass("last_seen"); } },