Fix color parsing in prefix

This commit is contained in:
Tor Hveem 2013-10-12 11:54:19 +02:00
parent 9969c826b8
commit 2f1e7834a3
1 changed files with 3 additions and 16 deletions

View File

@ -47,24 +47,13 @@ models.service('models', ['colors', function(colors) {
*/ */
this.BufferLine = function(message) { this.BufferLine = function(message) {
function formatTextElement(textElement) {
textElement = colors.parse(textElement);
if (textElement && ('fg' in textElement)) {
textElement['fg'] = colors.prepareCss(textElement['fg']);
}
return textElement;
}
/* /*
* Parse the text elements from the buffer line added * Parse the text elements from the buffer line added
* *
* @param message weechat message * @param message weechat message
*/ */
function parseLineAddedTextElements(message) { function parseLineAddedTextElements(message) {
var text = colors.parse(message['message']); var text = colors.parse(message);
text_elements =_.map(text, function(text_element) { text_elements =_.map(text, function(text_element) {
if (text_element && ('fg' in text_element)) { if (text_element && ('fg' in text_element)) {
text_element['fg'] = colors.prepareCss(text_element['fg']); text_element['fg'] = colors.prepareCss(text_element['fg']);
@ -81,14 +70,12 @@ models.service('models', ['colors', function(colors) {
var date = message['date']; var date = message['date'];
var prefix = formatTextElement(message['prefix']); var prefix = parseLineAddedTextElements(message['prefix']);
console.log(message['prefix'])
console.log(prefix);
var tags_array = message['tags_array']; var tags_array = message['tags_array'];
var displayed = message['displayed']; var displayed = message['displayed'];
var highlight = message['highlight']; var highlight = message['highlight'];
var content = parseLineAddedTextElements(message); var content = parseLineAddedTextElements(message['message']);
var rtext = ""; var rtext = "";
if(content[0] != undefined) { if(content[0] != undefined) {