diff --git a/client/css/style.css b/client/css/style.css index eb844068..ff61f110 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -95,11 +95,6 @@ button::-moz-focus-inner { background-color: #ebedef; color: #526476; } -#sidebar .badge { - color: #bdc3c7; - font: 12px sans-serif; - line-height: 21px; -} #menu, #networks { margin: 20px; @@ -110,7 +105,20 @@ button::-moz-focus-inner { padding-top: 14px; } #networks .badge { + background: #f7f9fa; + border-radius: 4px; + color: #aeb6bf; float: right; + font: 12px sans-serif; + line-height: 21px; + padding: 0 6px; +} +#networks .badge.highlight { + background: #f8f5f5; + color: #e74c3c; +} +#networks .badge:empty { + display: none; } #footer { bottom: 0; diff --git a/client/js/chat.js b/client/js/chat.js index 714c205a..6c442289 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -110,6 +110,7 @@ $(function() { sidebar.find(".active").removeClass("active"); button.addClass("active") .find(".badge") + .removeClass("highlight") .empty(); $(target).css("z-index", z++) .find("input") @@ -118,11 +119,14 @@ $(function() { chat.on("append", ".messages", function() { var messages = $(this); - var id = messages.closest(".window").find(".form").data("target"); + var id = messages.closest(".window").find(".input").parent().data("target"); var badge = $("#channel-" + id + ":not(.active) .badge"); if (badge.length != 0) { var i = (parseInt(badge.html()) || 0) + 1; badge.html(i); + if (messages.children().last().hasClass("highlight")) { + badge.addClass("highlight"); + } } }); @@ -134,7 +138,7 @@ $(function() { chat.on("click", ".user", function() { var user = $(this); - var id = user.closest(".window").find(".form").data("target"); + var id = user.closest(".window").find(".input").parent().data("target"); var name = user.html().replace(/[\s+@]/g, ""); if (name.match(/[#.]|-!-/) != null) { return; @@ -162,7 +166,6 @@ $(function() { text: text, }); }); - Handlebars.registerHelper( "partial", function(id) {