From e8885df99f09f46b1a4a050bea8652a53f084a4c Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 3 Jul 2014 21:13:44 +0100 Subject: [PATCH] Text theming of the displayed nick #560 --- client/assets/text_themes/default.json | 3 ++- client/src/views/channel.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/assets/text_themes/default.json b/client/assets/text_themes/default.json index 0f6f658..5fdbb03 100644 --- a/client/assets/text_themes/default.json +++ b/client/assets/text_themes/default.json @@ -52,5 +52,6 @@ "set_setting": "ⓘ %text", "list_aliases": "ⓘ %text", "ignored_pattern": "ⓘ %text", - "wallops": "[WALLOPS] %text" + "wallops": "[WALLOPS] %text", + "message_nick": "%nick" } \ No newline at end of file diff --git a/client/src/views/channel.js b/client/src/views/channel.js index b38c66a..94ff7ab 100644 --- a/client/src/views/channel.js +++ b/client/src/views/channel.js @@ -169,8 +169,12 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ _kiwi.global.events.emit('message:display', {panel: this.model, message: msg}) .done(_.bind(function() { + // Format the nick to the config defined format + var display_obj = _.clone(msg); + display_obj.nick = styleText('message_nick', {nick: msg.nick, prefix: msg.nick_prefix || ''}); + line_msg = '
<%- time_string %>
<%- nick %>
<%= msg %>
'; - this.$messages.append(_.template(line_msg, msg)); + this.$messages.append($(_.template(line_msg, display_obj)).data('message', msg)); // Activity/alerts based on the type of new message if (msg.type.match(/^action /)) { @@ -265,7 +269,7 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ // Click on a nickname nickClick: function (event) { - var nick = $(event.currentTarget).text(), + var nick = $(event.currentTarget).parent('.msg').data('message').nick, members = this.model.get('members'), are_we_an_op = !!members.getByNick(_kiwi.app.connections.active_connection.get('nick')).get('is_op'), member, query, userbox, menubox; -- 2.25.1