Merge pull request #830 from Vaesper/nicklistcolors

Fixed nicks with background colours breaking in nicklist
This commit is contained in:
Lorenz Hübschle-Schneider 2016-10-10 11:04:09 +02:00 committed by GitHub
commit 8914bbc167
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) {
var colorClasses = [
'cwf-default'
];
if (propName in nickMsg && nickMsg[propName] && nickMsg[propName].length > 0) {
var color = nickMsg[propName];
if (color.match(/^weechat/)) {
// color option
var colorName = color.match(/[a-zA-Z0-9_]+$/)[0];
return [
colorClasses = [
'cof-' + colorName,
'cob-' + colorName,
'coa-' + colorName
];
} else if (color.match(/^[a-zA-Z]+$/)) {
// WeeChat color name
return [
'cwf-' + color
} else {
if (color.match(/^[a-zA-Z]+[:$]/)) {
// WeeChat color name (foreground)
var cwfcolor = color.match(/^[a-zA-Z]+/)[0];
colorClasses = [
'cwf-' + cwfcolor
];
} else if (color.match(/^[0-9]+$/)) {
// extended color
return [
'cef-' + color
} else if (color.match(/^[0-9]+[:$]/)) {
// extended color (foreground)
var cefcolor = color.match(/^[0-9]+/)[0];
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) {