Merge pull request #390 from glowing-bear/inlinecolours
Display HTML colour codes inline
This commit is contained in:
commit
ace63454a7
|
@ -346,6 +346,15 @@ div.embed img.embed {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.colourbox {
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
margin-bottom: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
table.notimestamp td.time {
|
table.notimestamp td.time {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
|
|
|
@ -255,7 +255,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<td class="prefix"><a ng-click="addMention(bufferline.prefix)"><span ng-repeat="part in bufferline.prefix" bo-class="part.classes" bo-html="part.text"></span></a></td>
|
<td class="prefix"><a ng-click="addMention(bufferline.prefix)"><span ng-repeat="part in bufferline.prefix" bo-class="part.classes" bo-html="part.text"></span></a></td>
|
||||||
<td class="message">
|
<td class="message">
|
||||||
<div ng-repeat="metadata in bufferline.metadata" plugin data="metadata"></div>
|
<div ng-repeat="metadata in bufferline.metadata" plugin data="metadata"></div>
|
||||||
<span ng-repeat="part in bufferline.content" class="text" bo-class="part.classes" bo-html="part.text|irclinky:'_blank'"></span>
|
<span ng-repeat="part in bufferline.content" class="text" bo-class="part.classes" bo-html="part.text | irclinky:'_blank' | inlinecolour"></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="readmarker" ng-if="activeBuffer().lastSeen==$index">
|
<tr class="readmarker" ng-if="activeBuffer().lastSeen==$index">
|
||||||
|
|
|
@ -49,6 +49,22 @@ weechat.filter('irclinky', ['$filter', function($filter) {
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
weechat.filter('inlinecolour', function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
return function(text) {
|
||||||
|
if (!text) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only match 6-digit colour codes, 3-digit ones have too many false positives (issue numbers, etc)
|
||||||
|
var hexColourRegex = /(^|[^&])\#([0-9a-f]{6})($|[^\w'"])/gmi;
|
||||||
|
var substitute = '$1#$2 <div class="colourbox" style="background-color:#$2"></div> $3';
|
||||||
|
|
||||||
|
return text.replace(hexColourRegex, substitute);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', function($rootScope, $log, models, plugins) {
|
weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', function($rootScope, $log, models, plugins) {
|
||||||
|
|
||||||
var handleBufferClosing = function(message) {
|
var handleBufferClosing = function(message) {
|
||||||
|
|
Loading…
Reference in New Issue