Skip to content

Commit

Permalink
Merge branch 'nick-color' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0629 committed May 11, 2012
2 parents d399ed7 + 23e1746 commit 13426cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions static/css/sirc.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,20 @@ div.message { word-wrap:break-word; }
ul#log li { padding:5px !important; font-weight:normal; border-color:#efefef; }
input#message.disabled { color:#cdcdcd; }

.c-0 { color:#7f0000; }
.c-1 { color:#7f2e00; }
.c-2 { color:#7f5d00; }
.c-3 { color:#727f00; }
.c-4 { color:#7f0000; }
.c-5 { color:#447f00; }
.c-6 { color:#157f00; }
.c-7 { color:#007f19; }
.c-8 { color:#007f48; }
.c-9 { color:#007f76; }
.c-10 { color:#00597f; }
.c-11 { color:#002a7f; }
.c-12 { color:#04007f; }
.c-13 { color:#33007f; }
.c-14 { color:#61007f; }
.c-15 { color:#7f006e; }

10 changes: 9 additions & 1 deletion static/js/sirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var add_process = function(xml, flag) {
};

var append_log = function(flag, datetime, source, message) {
var element = $('<li><div class="datetime">' + datetime_format(datetime) + '</div><div class="source">&lt;<span class="nick">' + html_encode(source) + '</span>&gt;</div><div class="message">' + url_detection(html_encode(message)) + '</div></li>');
var element = $('<li><div class="datetime">' + datetime_format(datetime) + '</div><div class="source">&lt;<span class="nick c-' + simple_hash(source) + '">' + html_encode(source) + '</span>&gt;</div><div class="message">' + url_detection(html_encode(message)) + '</div></li>');
if(flag == 'downdate') {
last_downdate = datetime;
element.prependTo($('ul#log'));
Expand Down Expand Up @@ -57,6 +57,14 @@ var scroll = function(pos, duration) {
$('body,html,document').animate({scrollTop: pos}, duration);
};

var simple_hash = function(s) {
var sum = 0;
for(var i = 0; i < s.length; i++) {
sum += s.charCodeAt(i);
}
return sum % 16;
};

var trim = function(str){
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
Expand Down

0 comments on commit 13426cf

Please sign in to comment.