|
|
@ -11,7 +11,7 @@ weechat.filter('toArray', function () { |
|
|
|
return Object.keys(obj).map(function (key) { |
|
|
|
return Object.keys(obj).map(function (key) { |
|
|
|
return Object.defineProperty(obj[key], '$key', {__proto__: null, value: key}); |
|
|
|
return Object.defineProperty(obj[key], '$key', {__proto__: null, value: key}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootScope, models, plugins) { |
|
|
|
weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootScope, models, plugins) { |
|
|
@ -20,7 +20,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
var bufferMessage = message['objects'][0]['content'][0]; |
|
|
|
var bufferMessage = message['objects'][0]['content'][0]; |
|
|
|
var buffer = new models.Buffer(bufferMessage); |
|
|
|
var buffer = new models.Buffer(bufferMessage); |
|
|
|
models.closeBuffer(buffer); |
|
|
|
models.closeBuffer(buffer); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var handleLine = function(line, initial) { |
|
|
|
var handleLine = function(line, initial) { |
|
|
|
var message = new models.BufferLine(line); |
|
|
|
var message = new models.BufferLine(line); |
|
|
@ -51,20 +51,20 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var handleBufferLineAdded = function(message) { |
|
|
|
var handleBufferLineAdded = function(message) { |
|
|
|
message['objects'][0]['content'].forEach(function(l) { |
|
|
|
message['objects'][0]['content'].forEach(function(l) { |
|
|
|
handleLine(l, false); |
|
|
|
handleLine(l, false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var handleBufferOpened = function(message) { |
|
|
|
var handleBufferOpened = function(message) { |
|
|
|
var bufferMessage = message['objects'][0]['content'][0]; |
|
|
|
var bufferMessage = message['objects'][0]['content'][0]; |
|
|
|
var buffer = new models.Buffer(bufferMessage); |
|
|
|
var buffer = new models.Buffer(bufferMessage); |
|
|
|
models.addBuffer(buffer); |
|
|
|
models.addBuffer(buffer); |
|
|
|
models.setActiveBuffer(buffer.id); |
|
|
|
models.setActiveBuffer(buffer.id); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var handleBufferTitleChanged = function(message) { |
|
|
|
var handleBufferTitleChanged = function(message) { |
|
|
|
var obj = message['objects'][0]['content'][0]; |
|
|
|
var obj = message['objects'][0]['content'][0]; |
|
|
@ -73,7 +73,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
old.fullName = obj['full_name']; |
|
|
|
old.fullName = obj['full_name']; |
|
|
|
old.title = obj['title']; |
|
|
|
old.title = obj['title']; |
|
|
|
old.number = obj['number']; |
|
|
|
old.number = obj['number']; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var handleBufferRenamed = function(message) { |
|
|
|
var handleBufferRenamed = function(message) { |
|
|
|
var obj = message['objects'][0]['content'][0]; |
|
|
|
var obj = message['objects'][0]['content'][0]; |
|
|
@ -81,7 +81,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
var old = models.getBuffer(buffer); |
|
|
|
var old = models.getBuffer(buffer); |
|
|
|
old.fullName = obj['full_name']; |
|
|
|
old.fullName = obj['full_name']; |
|
|
|
old.shortName = obj['short_name']; |
|
|
|
old.shortName = obj['short_name']; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Handle answers to (lineinfo) messages |
|
|
|
* Handle answers to (lineinfo) messages |
|
|
@ -93,7 +93,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
lines.forEach(function(l) { |
|
|
|
lines.forEach(function(l) { |
|
|
|
handleLine(l, true); |
|
|
|
handleLine(l, true); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Handle answers to hotlist request |
|
|
|
* Handle answers to hotlist request |
|
|
@ -117,7 +117,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
var unreadSum = _.reduce(l.count, function(memo, num){ return memo + num; }, 0); |
|
|
|
var unreadSum = _.reduce(l.count, function(memo, num){ return memo + num; }, 0); |
|
|
|
buffer.lastSeen = buffer.lines.length - 1 - unreadSum; |
|
|
|
buffer.lastSeen = buffer.lines.length - 1 - unreadSum; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Handle nicklist event |
|
|
|
* Handle nicklist event |
|
|
@ -136,7 +136,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
buffer.addNick(group, nick); |
|
|
|
buffer.addNick(group, nick); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Handle nicklist diff event |
|
|
|
* Handle nicklist diff event |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -165,7 +165,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var handleEvent = function(event) { |
|
|
|
var handleEvent = function(event) { |
|
|
|
|
|
|
|
|
|
|
@ -173,7 +173,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
eventHandlers[event['id']](event); |
|
|
|
eventHandlers[event['id']](event); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var eventHandlers = { |
|
|
|
var eventHandlers = { |
|
|
|
_buffer_closing: handleBufferClosing, |
|
|
|
_buffer_closing: handleBufferClosing, |
|
|
@ -183,14 +183,14 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc |
|
|
|
_buffer_renamed: handleBufferRenamed, |
|
|
|
_buffer_renamed: handleBufferRenamed, |
|
|
|
_nicklist: handleNicklist, |
|
|
|
_nicklist: handleNicklist, |
|
|
|
_nicklist_diff: handleNicklistDiff |
|
|
|
_nicklist_diff: handleNicklistDiff |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
handleEvent: handleEvent, |
|
|
|
handleEvent: handleEvent, |
|
|
|
handleLineInfo: handleLineInfo, |
|
|
|
handleLineInfo: handleLineInfo, |
|
|
|
handleHotlistInfo: handleHotlistInfo, |
|
|
|
handleHotlistInfo: handleHotlistInfo, |
|
|
|
handleNicklist: handleNicklist |
|
|
|
handleNicklist: handleNicklist |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
}]); |
|
|
|
}]); |
|
|
|
|
|
|
|
|
|
|
@ -198,7 +198,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
protocol = new weeChat.Protocol(); |
|
|
|
protocol = new weeChat.Protocol(); |
|
|
|
var websocket = null; |
|
|
|
var websocket = null; |
|
|
|
|
|
|
|
|
|
|
|
var callbacks = {} |
|
|
|
var callbacks = {}; |
|
|
|
var currentCallBackId = 0; |
|
|
|
var currentCallBackId = 0; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -213,7 +213,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return currentCallBackId; |
|
|
|
return currentCallBackId; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Create a callback, adds it to the callback list |
|
|
|
* Create a callback, adds it to the callback list |
|
|
@ -226,12 +226,12 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
callbacks[cbId] = { |
|
|
|
callbacks[cbId] = { |
|
|
|
time: new Date, |
|
|
|
time: new Date, |
|
|
|
cb: defer, |
|
|
|
cb: defer, |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
defer.id = cbId |
|
|
|
defer.id = cbId; |
|
|
|
|
|
|
|
|
|
|
|
return defer; |
|
|
|
return defer; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Fails every currently subscribed callback for the |
|
|
|
* Fails every currently subscribed callback for the |
|
|
@ -244,7 +244,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
callbacks[i].cb.reject(reason); |
|
|
|
callbacks[i].cb.reject(reason); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* Send a message to the websocket and returns a promise. |
|
|
|
/* Send a message to the websocket and returns a promise. |
|
|
|
* See: http://docs.angularjs.org/api/ng.$q
|
|
|
|
* See: http://docs.angularjs.org/api/ng.$q
|
|
|
@ -257,7 +257,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
var cb = createCallback(message); |
|
|
|
var cb = createCallback(message); |
|
|
|
websocket.send("(" + cb.id + ") " + message); |
|
|
|
websocket.send("(" + cb.id + ") " + message); |
|
|
|
return cb.promise; |
|
|
|
return cb.promise; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Send all messages to the websocket and returns a promise that is resolved |
|
|
|
* Send all messages to the websocket and returns a promise that is resolved |
|
|
@ -271,7 +271,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
for(i in messages) { |
|
|
|
for(i in messages) { |
|
|
|
var promise = send(messages[i]); |
|
|
|
var promise = send(messages[i]); |
|
|
|
promises.push(promise); |
|
|
|
promises.push(promise); |
|
|
|
}; |
|
|
|
} |
|
|
|
return $q.all(promises); |
|
|
|
return $q.all(promises); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -279,7 +279,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
var connect = function (host, port, passwd, ssl) { |
|
|
|
var connect = function (host, port, passwd, ssl) { |
|
|
|
var proto = ssl ? 'wss':'ws'; |
|
|
|
var proto = ssl ? 'wss':'ws'; |
|
|
|
websocket = new WebSocket(proto+"://" + host + ':' + port + "/weechat"); |
|
|
|
websocket = new WebSocket(proto+"://" + host + ':' + port + "/weechat"); |
|
|
|
websocket.binaryType = "arraybuffer" |
|
|
|
websocket.binaryType = "arraybuffer"; |
|
|
|
|
|
|
|
|
|
|
|
websocket.onopen = function (evt) { |
|
|
|
websocket.onopen = function (evt) { |
|
|
|
|
|
|
|
|
|
|
@ -347,26 +347,26 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
weeChat.Protocol.formatNicklist({ |
|
|
|
weeChat.Protocol.formatNicklist({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
).then(function(nicklist) { |
|
|
|
).then(function(nicklist) { |
|
|
|
handlers.handleNicklist(nicklist) |
|
|
|
handlers.handleNicklist(nicklist); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
send( |
|
|
|
send( |
|
|
|
weeChat.Protocol.formatSync({}) |
|
|
|
weeChat.Protocol.formatSync({}) |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.connected = true; |
|
|
|
$rootScope.connected = true; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
websocket.onclose = function (evt) { |
|
|
|
websocket.onclose = function (evt) { |
|
|
|
$log.info("Disconnected from relay"); |
|
|
|
$log.info("Disconnected from relay"); |
|
|
|
$rootScope.connected = false; |
|
|
|
$rootScope.connected = false; |
|
|
|
failCallbacks('disconnection'); |
|
|
|
failCallbacks('disconnection'); |
|
|
|
$rootScope.$apply(); |
|
|
|
$rootScope.$apply(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
websocket.onmessage = function (evt) { |
|
|
|
websocket.onmessage = function (evt) { |
|
|
|
message = protocol.parse(evt.data) |
|
|
|
message = protocol.parse(evt.data); |
|
|
|
if (_.has(callbacks, message['id'])) { |
|
|
|
if (_.has(callbacks, message['id'])) { |
|
|
|
var promise = callbacks[message['id']]; |
|
|
|
var promise = callbacks[message['id']]; |
|
|
|
promise.cb.resolve(message); |
|
|
|
promise.cb.resolve(message); |
|
|
@ -376,7 +376,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
} |
|
|
|
} |
|
|
|
$rootScope.commands.push("RECV: " + evt.data + " TYPE:" + evt.type) ; |
|
|
|
$rootScope.commands.push("RECV: " + evt.data + " TYPE:" + evt.type) ; |
|
|
|
$rootScope.$apply(); |
|
|
|
$rootScope.$apply(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
websocket.onerror = function (evt) { |
|
|
|
websocket.onerror = function (evt) { |
|
|
|
// on error it means the connection problem
|
|
|
|
// on error it means the connection problem
|
|
|
@ -387,15 +387,15 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
$rootScope.errorMessage = true; |
|
|
|
$rootScope.errorMessage = true; |
|
|
|
} |
|
|
|
} |
|
|
|
$log.error("Relay error " + evt.data); |
|
|
|
$log.error("Relay error " + evt.data); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.websocket = websocket; |
|
|
|
this.websocket = websocket; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var disconnect = function() { |
|
|
|
var disconnect = function() { |
|
|
|
/* TODO: Send protocol disconnect */ |
|
|
|
/* TODO: Send protocol disconnect */ |
|
|
|
this.websocket.close(); |
|
|
|
this.websocket.close(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Format and send a weechat message |
|
|
|
* Format and send a weechat message |
|
|
@ -407,14 +407,14 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
buffer: models.getActiveBuffer()['fullName'], |
|
|
|
buffer: models.getActiveBuffer()['fullName'], |
|
|
|
data: message |
|
|
|
data: message |
|
|
|
})); |
|
|
|
})); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var sendCoreCommand = function(command) { |
|
|
|
var sendCoreCommand = function(command) { |
|
|
|
send(weeChat.Protocol.formatInput({ |
|
|
|
send(weeChat.Protocol.formatInput({ |
|
|
|
buffer: 'core.weechat', |
|
|
|
buffer: 'core.weechat', |
|
|
|
data: command |
|
|
|
data: command |
|
|
|
})); |
|
|
|
})); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
@ -423,7 +423,7 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', |
|
|
|
disconnect: disconnect, |
|
|
|
disconnect: disconnect, |
|
|
|
sendMessage: sendMessage, |
|
|
|
sendMessage: sendMessage, |
|
|
|
sendCoreCommand: sendCoreCommand |
|
|
|
sendCoreCommand: sendCoreCommand |
|
|
|
} |
|
|
|
}; |
|
|
|
}]); |
|
|
|
}]); |
|
|
|
|
|
|
|
|
|
|
|
weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', '$log', 'models', 'connection', function ($rootScope, $scope, $store, $timeout, $log, models, connection, testService) { |
|
|
|
weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', '$log', 'models', 'connection', function ($rootScope, $scope, $store, $timeout, $log, models, connection, testService) { |
|
|
@ -473,7 +473,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
$scope.isinstalled = false; |
|
|
|
$scope.isinstalled = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}
|
|
|
|
}; |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
$scope.isinstalled = false; |
|
|
|
$scope.isinstalled = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -517,13 +517,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$scope.buffers = models.model.buffers; |
|
|
|
$scope.buffers = models.model.buffers; |
|
|
|
$scope.activeBuffer = models.getActiveBuffer |
|
|
|
$scope.activeBuffer = models.getActiveBuffer; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.commands = [] |
|
|
|
$rootScope.commands = []; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.models = models; |
|
|
|
$rootScope.models = models; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.buffer = [] |
|
|
|
$rootScope.buffer = []; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.iterCandidate = null; |
|
|
|
$rootScope.iterCandidate = null; |
|
|
|
|
|
|
|
|
|
|
@ -573,7 +573,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
if (!$scope.setActiveBuffer(buffName, 'fullName')) { |
|
|
|
if (!$scope.setActiveBuffer(buffName, 'fullName')) { |
|
|
|
connection.sendMessage('/query ' + nick); |
|
|
|
connection.sendMessage('/query ' + nick); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.scrollToBottom = function() { |
|
|
|
$rootScope.scrollToBottom = function() { |
|
|
|
// FIXME doesn't work if the settimeout runs without a short delay
|
|
|
|
// FIXME doesn't work if the settimeout runs without a short delay
|
|
|
@ -589,21 +589,21 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
bl.scrollTop = sVal; |
|
|
|
bl.scrollTop = sVal; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
// Here be scrolling dragons
|
|
|
|
// Here be scrolling dragons
|
|
|
|
$timeout(scroll); |
|
|
|
$timeout(scroll); |
|
|
|
$timeout(scroll, 100); |
|
|
|
$timeout(scroll, 100); |
|
|
|
$timeout(scroll, 300); |
|
|
|
$timeout(scroll, 300); |
|
|
|
$timeout(scroll, 500); |
|
|
|
$timeout(scroll, 500); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.connect = function() { |
|
|
|
$scope.connect = function() { |
|
|
|
connection.connect($scope.host, $scope.port, $scope.password, $scope.ssl); |
|
|
|
connection.connect($scope.host, $scope.port, $scope.password, $scope.ssl); |
|
|
|
} |
|
|
|
}; |
|
|
|
$scope.disconnect = function() { |
|
|
|
$scope.disconnect = function() { |
|
|
|
connection.disconnect(); |
|
|
|
connection.disconnect(); |
|
|
|
} |
|
|
|
}; |
|
|
|
$scope.install = function() { |
|
|
|
$scope.install = function() { |
|
|
|
if(navigator.mozApps != undefined) { |
|
|
|
if(navigator.mozApps != undefined) { |
|
|
|
var request = navigator.mozApps.install('http://torhve.github.io/glowing-bear/manifest.webapp'); |
|
|
|
var request = navigator.mozApps.install('http://torhve.github.io/glowing-bear/manifest.webapp'); |
|
|
@ -622,7 +622,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
alert('Sorry. Only supported in Firefox v26+'); |
|
|
|
alert('Sorry. Only supported in Firefox v26+'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Function gets called from bufferLineAdded code if user should be notified */ |
|
|
|
/* Function gets called from bufferLineAdded code if user should be notified */ |
|
|
@ -641,8 +641,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
var notification = new Notification(title, {body:content, icon:'img/favicon.png'}); |
|
|
|
var notification = new Notification(title, {body:content, icon:'img/favicon.png'}); |
|
|
|
// Cancel notification automatically
|
|
|
|
// Cancel notification automatically
|
|
|
|
notification.onshow = function() { |
|
|
|
notification.onshow = function() { |
|
|
|
setTimeout(function() { notification.close() }, timeout); |
|
|
|
setTimeout(function() {
|
|
|
|
} |
|
|
|
notification.close(); |
|
|
|
|
|
|
|
}, timeout); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.hasUnread = function(buffer) { |
|
|
|
$scope.hasUnread = function(buffer) { |
|
|
@ -682,7 +684,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.switchToActivityBuffer = function() { |
|
|
|
$rootScope.switchToActivityBuffer = function() { |
|
|
|
// Find next buffer with activity and switch to it
|
|
|
|
// Find next buffer with activity and switch to it
|
|
|
@ -696,7 +698,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.handleKeyPress = function($event) { |
|
|
|
$scope.handleKeyPress = function($event) { |
|
|
@ -714,7 +716,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
// TODO Switch to first matching buffer and reset query
|
|
|
|
// TODO Switch to first matching buffer and reset query
|
|
|
|
$scope.search = ''; |
|
|
|
$scope.search = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Prevent user from accidentally leaving the page
|
|
|
|
// Prevent user from accidentally leaving the page
|
|
|
|
window.onbeforeunload = function(event) { |
|
|
|
window.onbeforeunload = function(event) { |
|
|
@ -775,14 +777,14 @@ weechat.directive('inputBar', function() { |
|
|
|
// update current caret position
|
|
|
|
// update current caret position
|
|
|
|
inputNode.focus(); |
|
|
|
inputNode.focus(); |
|
|
|
inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos); |
|
|
|
inputNode.setSelectionRange(nickComp.caretPos, nickComp.caretPos); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Send the message to the websocket
|
|
|
|
// Send the message to the websocket
|
|
|
|
$scope.sendMessage = function() { |
|
|
|
$scope.sendMessage = function() { |
|
|
|
connection.sendMessage($scope.command); |
|
|
|
connection.sendMessage($scope.command); |
|
|
|
$scope.command = ""; |
|
|
|
$scope.command = ""; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Handle key presses in the input bar
|
|
|
|
// Handle key presses in the input bar
|
|
|
|
$scope.handleKeyPress = function($event) { |
|
|
|
$scope.handleKeyPress = function($event) { |
|
|
@ -857,9 +859,9 @@ weechat.directive('inputBar', function() { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|