Add notification support
This commit is contained in:
parent
236a82ec4e
commit
c0f22c4ec8
14
js/models.js
14
js/models.js
|
@ -20,14 +20,19 @@ models.service('models', ['colors', function(colors) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setActiveBuffer = function(bufferId) {
|
this.setActiveBuffer = function(bufferId) {
|
||||||
|
|
||||||
|
if (this.getActiveBuffer()) {
|
||||||
|
this.getActiveBuffer().active = false;
|
||||||
|
}
|
||||||
|
|
||||||
activeBuffer = _.find(this.model['buffers'], function(buffer) {
|
activeBuffer = _.find(this.model['buffers'], function(buffer) {
|
||||||
if (buffer['id'] == bufferId) {
|
if (buffer['id'] == bufferId) {
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
activeBuffer.notification = false;
|
||||||
|
activeBuffer.active = true;
|
||||||
|
|
||||||
console.log(this.activeBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getBuffers = function() {
|
this.getBuffers = function() {
|
||||||
|
@ -37,7 +42,6 @@ models.service('models', ['colors', function(colors) {
|
||||||
this.getBuffer = function(bufferId) {
|
this.getBuffer = function(bufferId) {
|
||||||
return _.find(this.model['buffers'], function(buffer) {
|
return _.find(this.model['buffers'], function(buffer) {
|
||||||
if (buffer['id'] == bufferId) {
|
if (buffer['id'] == bufferId) {
|
||||||
console.log('yé');
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -54,6 +58,12 @@ models.service('models', ['colors', function(colors) {
|
||||||
var fullName = message['full_name']
|
var fullName = message['full_name']
|
||||||
var pointer = message['pointers'][0]
|
var pointer = message['pointers'][0]
|
||||||
var lines = []
|
var lines = []
|
||||||
|
var active = false;
|
||||||
|
var notification = false;
|
||||||
|
|
||||||
|
var notify = function() {
|
||||||
|
notification = true;
|
||||||
|
}
|
||||||
|
|
||||||
var addLine = function(line) {
|
var addLine = function(line) {
|
||||||
lines.push(line);
|
lines.push(line);
|
||||||
|
|
|
@ -202,21 +202,15 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'pluginManager',
|
||||||
var handleBufferLineAdded = function(message) {
|
var handleBufferLineAdded = function(message) {
|
||||||
var buffer_line = {}
|
var buffer_line = {}
|
||||||
|
|
||||||
message = new models.BufferLine(message);
|
|
||||||
|
var message = new models.BufferLine(message);
|
||||||
|
var buffer = models.getBuffer(message.buffer);
|
||||||
message.metadata = pluginManager.contentForMessage(message.text);
|
message.metadata = pluginManager.contentForMessage(message.text);
|
||||||
|
buffer.addLine(message);
|
||||||
|
|
||||||
console.log(message);
|
if (!buffer.active) {
|
||||||
console.log(message.buffer);
|
buffer.notification = true;
|
||||||
console.log(models.getBuffer(message.buffer));
|
}
|
||||||
models.getBuffer(message.buffer).addLine(message);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (!_isActiveBuffer(message.buffer)) {
|
|
||||||
// $rootScope.buffers[message.buffer]['notification'] = true;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//$rootScope.buffers[message.buffer]['lines'].push(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue