From 9f5d3807ecdaa0bb810fda6626bf92bdd84e9000 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Fri, 13 Jun 2014 12:16:47 +0200 Subject: [PATCH] Added support for ~ and % modes. Close #10 --- client/js/chat.js | 4 ++-- lib/models/chan.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/js/chat.js b/client/js/chat.js index 00ceec4..ba29c14 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -221,8 +221,8 @@ $(function() { .closest(".window") .data("id"); - // Remove modes - var name = user.html().replace(/[\s+@]/g, ""); + // Strip modes. + var name = user.html().trim().replace(/[+%@~]/, ""); if (name.match(/[#.]|-!-/) != null) { return; } diff --git a/lib/models/chan.js b/lib/models/chan.js index ea17f2f..907fd4b 100644 --- a/lib/models/chan.js +++ b/lib/models/chan.js @@ -19,7 +19,12 @@ Chan.prototype.sortUsers = function() { this.users, function(u) { return u.name.toLowerCase(); } ); - var modes = ["+", "@"]; + var modes = [ + "~", + "%", + "@", + "+", + ].reverse(); modes.forEach(function(mode) { this.users = _.remove( this.users,