Merge pull request #1257 from torhve/buffercolor

Support for colors in buffer short name
This commit is contained in:
Lorenz Hübschle 2023-07-02 20:43:59 +02:00 committed by GitHub
commit 9e025b2e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -373,7 +373,7 @@ chown -R <strong>username</strong>:<strong>username</strong> ~<strong>username</
<span class="badge pull-right" ng-class="{'danger': buffer.notification}" ng-bind="buffer.notification || buffer.unread"></span>
<span class="buffer-quick-key">{{ buffer.$quickKey }}</span>
<span class="buffer-jump-key">{{ ("0" + buffer.$jumpKey).slice(-2) }}</span>
<span class="buffername">{{ buffer.trimmedName || buffer.fullName }}</span>
<span class="buffername" ng-class="::buffer.nameClasses">{{ buffer.trimmedName || buffer.fullName }}</span>
</a>
</li>
</ul>

View File

@ -229,6 +229,8 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
// weechat properties -- short name can be changed
buffer.shortName = message.short_name;
buffer.trimmedName = buffer.shortName.replace(/^[#&+]/, '');
// Use color from short name
buffer.nameClasses = models.parseRichText(message.short_name)[0].classes;
buffer.title = message.title;
buffer.number = message.number;
buffer.hidden = message.hidden;
@ -288,6 +290,8 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
var old = models.getBuffer(buffer);
old.fullName = obj.full_name;
old.shortName = obj.short_name;
// Use color from short name
old.nameClasses = models.parseRichText(obj.short_name)[0].classes;
// If it's a channel, trim away the prefix (#, &, or +). If that is empty and the buffer
// has a short name, use a space (because the prefix will be displayed separately, and we don't want
// prefix + fullname, which would happen otherwise). Else, use null so that full_name is used
@ -457,8 +461,8 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
//fill the nicklist
nicklist.forEach(function(n) {
var buffer = models.getBuffer(n.pointers[0]);
//buffer nicklist
//buffer nicklist
if (n.group === 1) {
var g = new models.NickGroup(n);
group = g.name;

View File

@ -73,6 +73,7 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
// weechat properties
var fullName = parseRichText(message.full_name)[0].text;
var shortName = parseRichText(message.short_name)[0].text;
var classes = parseRichText(message.short_name)[0].classes;
var hidden = message.hidden;
// If it's a channel, trim away the prefix (#, &, or +). If that is empty and the buffer
// has a short name, use a space (because the prefix will be displayed separately, and we don't want
@ -344,6 +345,7 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
shortName: shortName,
hidden: hidden,
trimmedName: trimmedName,
nameClasses: classes,
prefix: prefix,
number: number,
title: title,