Merge branch 'master' into gh-pages

This commit is contained in:
Tor Hveem 2013-10-07 17:01:35 +02:00
commit cdb12bff43
3 changed files with 33 additions and 6 deletions

View File

@ -1,3 +1,5 @@
html {
}
body { body {
color: white; color: white;
background-color: #222; background-color: #222;
@ -6,10 +8,14 @@ body {
padding-bottom:70px; padding-bottom:70px;
padding-top: 70px; padding-top: 70px;
} }
.content {
height: 100%;
min-height: 100%;
display: block;
}
.bufferlines { .bufferlines {
font-family: monospace; font-family: monospace;
overflow: scroll-y; overflow-y: auto;
height: 100%;
} }
.navbar-fixed-bottom { .navbar-fixed-bottom {

View File

@ -69,7 +69,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
<button class="btn btn-lg btn-primary" ng-click="connect()">Connect!</button> <button class="btn btn-lg btn-primary" ng-click="connect()">Connect!</button>
</form> </form>
</div> </div>
<div ng-show="connected"> <div class="content" ng-show="connected">
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation"> <nav class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

View File

@ -270,7 +270,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
var handleLine = function(line, initial) { var handleLine = function(line, initial) {
var buffer_line = {} var buffer_line = {}
var date = line['date']; var date = line['date']*1000;
var prefix = colors.parse(line['prefix']); var prefix = colors.parse(line['prefix']);
var text = colors.parse(line['message']); var text = colors.parse(line['message']);
var buffer = line['buffer']; var buffer = line['buffer'];
@ -306,7 +306,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
} }
} }
$rootScope.buffers[buffer]['lines'].push(buffer_line); $rootScope.addLine(buffer, buffer_line);
buffer_line['date'] = date; buffer_line['date'] = date;
@ -553,8 +553,29 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', 'connection
$rootScope.buffers[key]['unread'] = ''; $rootScope.buffers[key]['unread'] = '';
$rootScope.activeBuffer = $rootScope.buffers[key]; $rootScope.activeBuffer = $rootScope.buffers[key];
$rootScope.pageTitle = $rootScope.activeBuffer['short_name'] + ' | ' + $rootScope.activeBuffer['title']; $rootScope.pageTitle = $rootScope.activeBuffer['short_name'] + ' | ' + $rootScope.activeBuffer['title'];
$rootScope.scrollToBottom();
}; };
$rootScope.$watch('activeBuffer', function(newVal, oldVal) {
if (newVal && newVal !== oldVal) {
$rootScope.scrollToBottom();
}
});
$rootScope.addLine = function(buffer, line) {
$rootScope.buffers[buffer]['lines'].push(line);
// Scroll if needed
if ($rootScope.activeBuffer['id'] == buffer) {
$rootScope.scrollToBottom();
}
}
$rootScope.scrollToBottom = function() {
setTimeout(function() {
window.scrollTo(0, window.scrollMaxY);
});
}
$scope.sendMessage = function() { $scope.sendMessage = function() {
connection.sendMessage($scope.command); connection.sendMessage($scope.command);
$scope.command = ""; $scope.command = "";
@ -565,7 +586,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', 'connection
} }
$rootScope.getLines = function() { $rootScope.getLines = function() {
var count = 20; var count = 20;
connection.getLines(20); connection.getLines(count);
} }
/* Function gets called from bufferLineAdded code if user should be notified */ /* Function gets called from bufferLineAdded code if user should be notified */