Fixed nicks with background colours breaking in nicklist

This commit is contained in:
Kasper Vaessen 2016-10-10 01:16:48 +03:00
parent f98dc97737
commit 55b4c6254b
1 changed files with 28 additions and 16 deletions

View File

@ -387,33 +387,45 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
}; };
function nickGetColorClasses(nickMsg, propName) { function nickGetColorClasses(nickMsg, propName) {
var colorClasses = [
'cwf-default'
];
if (propName in nickMsg && nickMsg[propName] && nickMsg[propName].length > 0) { if (propName in nickMsg && nickMsg[propName] && nickMsg[propName].length > 0) {
var color = nickMsg[propName]; var color = nickMsg[propName];
if (color.match(/^weechat/)) { if (color.match(/^weechat/)) {
// color option // color option
var colorName = color.match(/[a-zA-Z0-9_]+$/)[0]; var colorName = color.match(/[a-zA-Z0-9_]+$/)[0];
return [ colorClasses = [
'cof-' + colorName, 'cof-' + colorName,
'cob-' + colorName, 'cob-' + colorName,
'coa-' + colorName 'coa-' + colorName
]; ];
} else if (color.match(/^[a-zA-Z]+$/)) { } else {
// WeeChat color name if (color.match(/^[a-zA-Z]+[:$]/)) {
return [ // WeeChat color name (foreground)
'cwf-' + color var cwfcolor = color.match(/^[a-zA-Z]+/)[0];
colorClasses = [
'cwf-' + cwfcolor
]; ];
} else if (color.match(/^[0-9]+$/)) { } else if (color.match(/^[0-9]+[:$]/)) {
// extended color // extended color (foreground)
return [ var cefcolor = color.match(/^[0-9]+/)[0];
'cef-' + color colorClasses = [
'cef-' + cefcolor
]; ];
} }
if (color.match(/:[a-zA-Z]+$/)) {
// WeeChat color name (background)
var cwbcolor = color.match(/:[a-zA-Z]+$/)[0].substring(1);
colorClasses.push('cwb-' + cwbcolor);
} else if (color.match(/:[0-9]+$/)) {
// extended color (background)
var cebcolor = color.match(/:[0-9]+$/)[0].substring(1);
colorClasses.push('ceb-' + cebcolor);
} }
}
return [ }
'cwf-default' return colorClasses;
];
} }
function nickGetClasses(nickMsg) { function nickGetClasses(nickMsg) {