Merge pull request #68 from eepp/weechat-js-full-styling

Full styling
This commit is contained in:
David Cormier 2013-10-26 08:50:37 -07:00
commit c1612f4c46
6 changed files with 3169 additions and 858 deletions

View file

@ -49,6 +49,9 @@ table {
tr { tr {
line-height: 100%; line-height: 100%;
} }
tr:hover {
background-color: #222222;
}
td.time { td.time {
padding-right: 5px; padding-right: 5px;
vertical-align: top; vertical-align: top;
@ -59,6 +62,7 @@ td.prefix {
vertical-align: top; vertical-align: top;
padding-right: 5px; padding-right: 5px;
white-space: pre; white-space: pre;
border-right: 1px solid #444;
} }
td.message { td.message {
word-wrap: break-word; word-wrap: break-word;
@ -85,7 +89,7 @@ hr {
body { body {
color: #ddd; color: #ddd;
background-color: #222; background-color: #181818;
padding-left: 0; padding-left: 0;
padding-right: 5px; padding-right: 5px;
padding-bottom:70px; padding-bottom:70px;
@ -175,13 +179,14 @@ input[type=text], input[type=password], .badge {
} }
#bufferlines { #bufferlines {
font-family: 'Terminus', 'Inconsolata', 'Consolas', 'Monaco', 'Ubuntu Mono', monospace; font-family: 'Terminus', 'Consolas', 'Monaco', 'Inconsolata', 'Ubuntu Mono', monospace;
position: relative; position: relative;
height: 99%; height: 99%;
overflow-y: auto; overflow-y: auto;
margin-left: 14%; margin-left: 14%;
width: auto; width: auto;
top: 25px; /* topbar */ top: 25px; /* topbar */
padding-bottom: 10px;
} }
#bufferlines .btn { #bufferlines .btn {
font-family: sans-serif; font-family: sans-serif;
@ -190,6 +195,9 @@ input[type=text], input[type=password], .badge {
.navbar-fixed-bottom { .navbar-fixed-bottom {
margin: 0 5px 0 14%; margin: 0 5px 0 14%;
} }
.navbar-inverse {
background-color: #181818;
}
@media (max-width: 968px) { @media (max-width: 968px) {
#sidebar, #bufferlines { #sidebar, #bufferlines {
position: relative; position: relative;

1929
css/style.css Normal file

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@
<title ng-bind-template="WeeChat {{ pageTitle}}"></title> <title ng-bind-template="WeeChat {{ pageTitle}}"></title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" media="screen"> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link rel="shortcut icon" type="image/png" href="img/favicon.png" > <link rel="shortcut icon" type="image/png" href="img/favicon.png" >
<link href="css/style.css" rel="stylesheet" media="screen">
<link href="css/glowingbear.css" rel="stylesheet" media="screen"> <link href="css/glowingbear.css" rel="stylesheet" media="screen">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-sanitize.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-sanitize.min.js"></script>
@ -89,9 +90,10 @@
<div id="collapseTwo" class="panel-collapse collapse"> <div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<div>To start using, please enable relay in your WeeChat client: <div>To start using, please enable relay in your WeeChat client:
<pre> <pre>
/set relay.network.password yourpassword /set relay.network.password yourpassword
/relay add weechat 9001</pre> /relay add weechat 9001
</pre>
<span class="label label-warning">WeeChat version 0.4.2 or higher is required.</span><br> <span class="label label-warning">WeeChat version 0.4.2 or higher is required.</span><br>
The communication goes directly between your browser and your weechat in clear text. The communication goes directly between your browser and your weechat in clear text.
Connection settings are saved between sessions, including password, in your own browser. Connection settings are saved between sessions, including password, in your own browser.
@ -112,16 +114,16 @@
If you check the encryption box, communication between browser and WeeChat will be encrypted.<br> If you check the encryption box, communication between browser and WeeChat will be encrypted.<br>
<strong>Note</strong>: Due to a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=594502">bug</a> encryption will not work in Firefox. You must also first visit the URL https://weechathost:relayport/ to accept the certificate</p> <strong>Note</strong>: Due to a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=594502">bug</a> encryption will not work in Firefox. You must also first visit the URL https://weechathost:relayport/ to accept the certificate</p>
If you want to use encrypted session you first have to set up the relay using SSL like this: If you want to use encrypted session you first have to set up the relay using SSL like this:
<pre> <pre>
$ mkdir -p ~/.weechat/ssl $ mkdir -p ~/.weechat/ssl
$ cd ~/.weechat/ssl $ cd ~/.weechat/ssl
$ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out relay.pem $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out relay.pem
</pre> </pre>
If WeeChat is already running, you can reload the certificate and private key with command: If WeeChat is already running, you can reload the certificate and private key with command:
<pre> <pre>
/relay sslcertkey /relay sslcertkey
/relay add ssl.weechat 8000 /relay add ssl.weechat 8000
</pre> </pre>
</div> </div>
</div> </div>
</div> </div>
@ -217,12 +219,12 @@
<tr class="bufferline" ng-repeat-start="bufferline in activeBuffer().lines"> <tr class="bufferline" ng-repeat-start="bufferline in activeBuffer().lines">
<td ng-hide="notimestamp" class="time"> <td ng-hide="notimestamp" class="time">
<span class="date text-muted"> <span class="date text-muted">
{{ bufferline.date | date:'HH:mm' }} <span class="cof-chat_time cob-chat_time coa-chat_time">{{ bufferline.date | date:'HH' }}</span><span class="cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters">:</span><span class="cof-chat_time cob-chat_time coa-chat_time">{{ bufferline.date | date:'mm' }}</span>
</span> </span>
</td> </td>
<td class="prefix vertical-line"><span ng-repeat="part in bufferline.prefix" style="{{ part.fg }}">{{ part.text }}</span></td> <td class="prefix"><span ng-repeat="part in bufferline.prefix" ng-class="{{ part.classes }}">{{ part.text }}</span></td>
<td class="message"> <td class="message">
<span ng-repeat="part in bufferline.content" class="text" style="{{ part.fg }}" ng-bind-html="part.text"></span> <span ng-repeat="part in bufferline.content" class="text" ng-class="{{ part.classes }}" ng-bind-html="part.text"></span>
<div ng-repeat="metadata in bufferline.metadata"> <div ng-repeat="metadata in bufferline.metadata">
<div ng-show="metadata.visible"> <div ng-show="metadata.visible">

View file

@ -4,7 +4,7 @@
*/ */
var models = angular.module('weechatModels', []); var models = angular.module('weechatModels', []);
models.service('models', ['$rootScope', 'colors', function($rootScope, colors) { models.service('models', ['$rootScope', function($rootScope) {
/* /*
* Buffer class * Buffer class
*/ */
@ -59,36 +59,55 @@ models.service('models', ['$rootScope', 'colors', function($rootScope, colors) {
* BufferLine class * BufferLine class
*/ */
this.BufferLine = function(message) { this.BufferLine = function(message) {
/*
* Parse the text elements from the buffer line added
*
* @param message weechat message
*/
function parseLineAddedTextElements(message) {
var text = colors.parse(message);
text_elements =_.map(text, function(text_element) {
if (text_element && ('fg' in text_element)) {
text_element['fg'] = colors.prepareCss(text_element['fg']);
}
// TODO: parse background as well
return text_element;
});
return text_elements;
}
var buffer = message['buffer']; var buffer = message['buffer'];
var date = message['date']; var date = message['date'];
function addClasses(textElements) {
var typeToClassPrefixFg = {
'option': 'cof-',
'weechat': 'cwf-',
'ext': 'cef-'
};
var typeToClassPrefixBg = {
'option': 'cob-',
'weechat': 'cwb-',
'ext': 'ceb-'
};
textElements.forEach(function(textEl) {
textEl.classes = [];
var prefix = parseLineAddedTextElements(message['prefix']); // foreground color
var prefix = typeToClassPrefixFg[textEl.fgColor.type];
textEl.classes.push(prefix + textEl.fgColor.name);
// background color
prefix = typeToClassPrefixBg[textEl.bgColor.type];
textEl.classes.push(prefix + textEl.bgColor.name);
// attributes
if (textEl.attrs.name !== null) {
textEl.classes.push('coa-' + textEl.attrs.name);
}
for (var attr in textEl.attrs.override) {
val = textEl.attrs.override[attr];
if (val) {
textEl.classes.push('a-' + attr);
} else {
textEl.classes.push('a-no-' + attr);
}
}
});
}
var prefix = weeChat.Protocol.rawText2Rich(message['prefix']);
addClasses(prefix);
var tags_array = message['tags_array']; var tags_array = message['tags_array'];
var displayed = message['displayed']; var displayed = message['displayed'];
var highlight = message['highlight']; var highlight = message['highlight'];
var content = parseLineAddedTextElements(message['message']); var content = weeChat.Protocol.rawText2Rich(message['message']);
addClasses(content);
var rtext = ""; var rtext = "";
if(content[0] != undefined) { if(content[0] != undefined) {
@ -104,6 +123,7 @@ models.service('models', ['$rootScope', 'colors', function($rootScope, colors) {
highlight: highlight, highlight: highlight,
displayed: displayed, displayed: displayed,
text: rtext, text: rtext,
} }
} }

View file

@ -14,16 +14,7 @@ weechat.filter('toArray', function () {
} }
}); });
weechat.factory('colors', [function($scope) { weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootScope, models, plugins) {
return {
prepareCss: weeChat.color.prepareCss,
parse: weeChat.color.parse
};
}]);
weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'plugins', function($rootScope, colors, models, plugins) {
var handleBufferClosing = function(message) { var handleBufferClosing = function(message) {
var bufferMessage = message['objects'][0]['content'][0]; var bufferMessage = message['objects'][0]['content'][0];
@ -147,7 +138,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'plugins', functi
}]); }]);
weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', 'colors', 'models', function($q, $rootScope, $log, storage, handlers, colors, models) { weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', 'models', function($q, $rootScope, $log, storage, handlers, models) {
protocol = new weeChat.Protocol(); protocol = new weeChat.Protocol();
var websocket = null; var websocket = null;
@ -570,4 +561,4 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
} }
}] }]
); );

File diff suppressed because it is too large Load diff