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) { 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 = [
} else if (color.match(/^[0-9]+$/)) { 'cwf-' + cwfcolor
// extended color ];
return [ } else if (color.match(/^[0-9]+[:$]/)) {
'cef-' + color // 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 colorClasses;
return [
'cwf-default'
];
} }
function nickGetClasses(nickMsg) { function nickGetClasses(nickMsg) {