Displays notifications in buffer title
This commit is contained in:
parent
bc95f1346f
commit
c80dc34770
|
@ -39,9 +39,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="connected">
|
<div ng-show="connected">
|
||||||
|
|
||||||
<div ng-repeat="(key, content) in buffers">
|
<span class="label" ng-class="{'label-success': content.notification }" ng-repeat="(key, content) in buffers">
|
||||||
<a ng-click="setActiveBuffer(key)">{{ content.full_name }}</a>
|
<a ng-click="setActiveBuffer(key)">{{ content.full_name }}</a>
|
||||||
</div>
|
</span>
|
||||||
<div ng-repeat="bufferline in activeBuffer.lines">
|
<div ng-repeat="bufferline in activeBuffer.lines">
|
||||||
|
|
||||||
<span ng-repeat="part in bufferline.message" class="text">
|
<span ng-repeat="part in bufferline.message" class="text">
|
||||||
|
|
|
@ -112,13 +112,29 @@ weechat.factory('handlers', ['$rootScope', 'colors', function($rootScope, colors
|
||||||
var message = _.union(prefix, text);
|
var message = _.union(prefix, text);
|
||||||
buffer_line['message'] = message;
|
buffer_line['message'] = message;
|
||||||
buffer_line['metadata'] = findMetaData(text[0]['text']);
|
buffer_line['metadata'] = findMetaData(text[0]['text']);
|
||||||
|
if (!_isActiveBuffer(buffer)) {
|
||||||
|
$rootScope.buffers[buffer]['notification'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
$rootScope.buffers[buffer]['lines'].push(buffer_line);
|
$rootScope.buffers[buffer]['lines'].push(buffer_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns whether or not this buffer is the active buffer
|
||||||
|
*/
|
||||||
|
var _isActiveBuffer = function(buffer) {
|
||||||
|
if ($rootScope.activeBuffer['id'] == buffer) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var handleBufferOpened = function(message) {
|
var handleBufferOpened = function(message) {
|
||||||
var fullName = message['objects'][0]['content'][0]['full_name']
|
var fullName = message['objects'][0]['content'][0]['full_name']
|
||||||
var buffer = message['objects'][0]['content'][0]['pointers'][0]
|
var buffer = message['objects'][0]['content'][0]['pointers'][0]
|
||||||
$rootScope.buffers[buffer] = { 'lines':[], 'full_name':fullName }
|
$rootScope.buffers[buffer] = { 'id': buffer, 'lines':[], 'full_name':fullName }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -135,7 +151,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', function($rootScope, colors
|
||||||
for (var i = 0; i < bufferInfos.length ; i++) {
|
for (var i = 0; i < bufferInfos.length ; i++) {
|
||||||
var bufferInfo = bufferInfos[i];
|
var bufferInfo = bufferInfos[i];
|
||||||
var pointer = bufferInfo['pointers'][0];
|
var pointer = bufferInfo['pointers'][0];
|
||||||
|
bufferInfo['id'] = pointer;
|
||||||
bufferInfo['lines'] = [];
|
bufferInfo['lines'] = [];
|
||||||
buffers[pointer] = bufferInfo
|
buffers[pointer] = bufferInfo
|
||||||
}
|
}
|
||||||
|
@ -251,6 +267,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', 'connection', functio
|
||||||
$scope.password = ""
|
$scope.password = ""
|
||||||
|
|
||||||
$scope.setActiveBuffer = function(key) {
|
$scope.setActiveBuffer = function(key) {
|
||||||
|
$rootScope.buffers[key]['notification'] = false;
|
||||||
$rootScope.activeBuffer = $rootScope.buffers[key];
|
$rootScope.activeBuffer = $rootScope.buffers[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue