Merge pull request #156 from lorenzhs/fixwhitespace

Whitespace fixes, some {} blocks
This commit is contained in:
David Cormier 2014-02-18 15:21:38 -05:00
commit ca6286064e
2 changed files with 13 additions and 16 deletions

View File

@ -114,7 +114,9 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc
*/ */
var handleLineInfo = function(message, initial, loadingMoreLines) { var handleLineInfo = function(message, initial, loadingMoreLines) {
var lines = message.objects[0].content.reverse(); var lines = message.objects[0].content.reverse();
if (initial === undefined) initial = true; if (initial === undefined) {
initial = true;
}
lines.forEach(function(l) { lines.forEach(function(l) {
handleLine(l, initial, loadingMoreLines); handleLine(l, initial, loadingMoreLines);
}); });
@ -202,9 +204,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc
}; };
$rootScope.$on('onMessage', function(event, message) { $rootScope.$on('onMessage', function(event, message) {
if (_.has(eventHandlers, message.id)) { if (_.has(eventHandlers, message.id)) {
eventHandlers[message.id](message); eventHandlers[message.id](message);
} }
}); });
@ -272,7 +272,6 @@ function($rootScope,
// Helper methods for initialization commands // Helper methods for initialization commands
var _initializeConnection = function(passwd) { var _initializeConnection = function(passwd) {
// This is not the proper way to do this. // This is not the proper way to do this.
// WeeChat does not send a confirmation for the init. // WeeChat does not send a confirmation for the init.
// Until it does, We need to "assume" that formatInit // Until it does, We need to "assume" that formatInit
@ -357,9 +356,10 @@ function($rootScope,
}, },
function() { function() {
// Connection got closed, lets check if we ever was connected successfully // Connection got closed, lets check if we ever was connected successfully
if(!$rootScope.waseverconnected) if (!$rootScope.waseverconnected) {
$rootScope.passwordError = true; $rootScope.passwordError = true;
} }
}
); );
}; };
@ -484,7 +484,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
Notification.permission = status; Notification.permission = status;
} }
}); });
} }
@ -552,7 +551,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Check if we should show nicklist or not // Check if we should show nicklist or not
$scope.showNicklist = $scope.updateShowNicklist(); $scope.showNicklist = $scope.updateShowNicklist();
}); });
$scope.favico = new Favico({animation: 'none'}); $scope.favico = new Favico({animation: 'none'});
$rootScope.$on('notificationChanged', function() { $rootScope.$on('notificationChanged', function() {
var notifications = _.reduce(models.model.buffers, function(memo, num) { return (parseInt(memo)||0) + num.notification;}); var notifications = _.reduce(models.model.buffers, function(memo, num) { return (parseInt(memo)||0) + num.notification;});
if (typeof notifications !== 'number') { if (typeof notifications !== 'number') {
@ -785,6 +786,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Find next buffer with activity and switch to it // Find next buffer with activity and switch to it
var sortedBuffers = _.sortBy($scope.buffers, 'number'); var sortedBuffers = _.sortBy($scope.buffers, 'number');
var i, buffer; var i, buffer;
// Try to find buffer with notification
for (i in sortedBuffers) { for (i in sortedBuffers) {
buffer = sortedBuffers[i]; buffer = sortedBuffers[i];
if (buffer.notification > 0) { if (buffer.notification > 0) {
@ -792,6 +794,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
break; break;
} }
} }
// No notifications, find first buffer with unread lines instead
for (i in sortedBuffers) { for (i in sortedBuffers) {
buffer = sortedBuffers[i]; buffer = sortedBuffers[i];
if (buffer.unread > 0) { if (buffer.unread > 0) {
@ -827,7 +830,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
); );
weechat.config(['$routeProvider', weechat.config(['$routeProvider',
function($routeProvider) { function($routeProvider) {
$routeProvider.when('/', { $routeProvider.when('/', {
templateUrl: 'index.html', templateUrl: 'index.html',
@ -876,11 +878,8 @@ weechat.directive('plugin', function() {
}; };
setTimeout(scroll, 100); setTimeout(scroll, 100);
}; };
} }
}; };
}); });
@ -1021,8 +1020,6 @@ weechat.directive('inputBar', function() {
return true; return true;
} }
}; };
} }
}; };
}); });