design improvements, and add time to each line

This commit is contained in:
Tor Hveem 2013-10-06 19:15:34 +02:00
parent 4db0a985c5
commit 6455256b9e
3 changed files with 33 additions and 10 deletions

View file

@ -1,7 +1,10 @@
body { body {
font-family: monospace;
background-color: black; background-color: black;
color: white; color: white;
padding: 5px;
}
.bufferlines {
font-family: sans-serif;
} }
.color-light-green { .color-light-green {

View file

@ -53,10 +53,15 @@
</div> </div>
<div ng-show="connected"> <div ng-show="connected">
<span class="label" ng-class="{'label-success': content.notification }" ng-repeat="(key, content) in buffers | toArray | orderBy:'content.number':true"> <ul class="nav nav-pills">
<a ng-click="setActiveBuffer(key)">{{ content.full_name }}</a> <li class="label" ng-class="{'label-success': content.notification }" ng-repeat="(key, content) in buffers | toArray | orderBy:'content.number':true">
</span> <a ng-click="setActiveBuffer(content.id)">{{ content.full_name }}</a>
<div ng-repeat="bufferline in activeBuffer.lines"> </li>
</ul>
<div class="bufferlines" ng-repeat="bufferline in activeBuffer.lines">
<span class="date muted">
{{ bufferline.date }}
</span>
<span ng-repeat="part in bufferline.message" class="text" style="{{ part.fg }}"> <span ng-repeat="part in bufferline.message" class="text" style="{{ part.fg }}">
{{ part.text }} {{ part.text }}
@ -77,10 +82,16 @@
</div> </div>
<form ng-submit="sendMessage()"> <div class="navbar navbar-inverse navbar-fixed-bottom">
<input type="text" ng-model="command"></input> <form class="form form-horizontal" ng-submit="sendMessage()">
<input type="submit" class="btn btn-primary"></button> <div class="input-group">
</form> <input type="text" class="form-control" ng-model="command"></input>
<span class="input-group-btn">
<button class="btn btn-default btn-primary">Send</button>
</span>
</div>
</form>
</div>
</div> </div>
</div> </div>
</body> </body>

View file

@ -1,3 +1,7 @@
Number.prototype.pad = function (len) {
return (new Array(len+1).join("0") + this).slice(-len);
}
var weechat = angular.module('weechat', ['localStorage']); var weechat = angular.module('weechat', ['localStorage']);
weechat.filter('toArray', function () { weechat.filter('toArray', function () {
'use strict'; 'use strict';
@ -270,6 +274,9 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
var handleBufferLineAdded = function(message) { var handleBufferLineAdded = function(message) {
var buffer_line = {} var buffer_line = {}
var date = message['objects'][0]['content'][0]['date'];
date = new Date(parseInt(date, 10) * 1000);
var datestring = date.getHours().pad(2) + ':' + date.getMinutes().pad(2);
var prefix = colors.parse(message['objects'][0]['content'][0]['prefix']); var prefix = colors.parse(message['objects'][0]['content'][0]['prefix']);
var text = colors.parse(message['objects'][0]['content'][0]['message']); var text = colors.parse(message['objects'][0]['content'][0]['message']);
var buffer = message['objects'][0]['content'][0]['buffer']; var buffer = message['objects'][0]['content'][0]['buffer'];
@ -300,6 +307,8 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
$rootScope.buffers[buffer]['lines'].push(buffer_line); $rootScope.buffers[buffer]['lines'].push(buffer_line);
buffer_line['date'] = datestring;
if(highlight || _.contains(tags_array, 'notify_private')) { if(highlight || _.contains(tags_array, 'notify_private')) {
$rootScope.createHighlight(prefix, text, message, buffer, additionalContent); $rootScope.createHighlight(prefix, text, message, buffer, additionalContent);