Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
datetime and alias
  • Loading branch information
Vrtak-CZ committed Sep 13, 2012
1 parent eeb4407 commit f3f4d1c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bot.coffee
Expand Up @@ -5,7 +5,7 @@ HTTP = require 'http'

Options =
adapter: "irc"
alias: false
alias: '!'
enableHttpd: true
name: "Hubot"
path: "."
Expand Down
38 changes: 37 additions & 1 deletion scripts/logs.coffee
Expand Up @@ -66,12 +66,48 @@ template = (data) ->

time = datetime.toLocaleTimeString()

messages += "[#{date} #{time}] #{message.user}: #{message.text}\n"
messages += "[<span date-datetime=\"#{datetime.toISOString()}\">#{date} #{time}</span>] #{message.user}: #{message.text}\n"

"""
<html>
<head>
<title>Nette FW - IRC - Logs</title>
<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script>
formatDate = function(date) {
var day, hours, minutes, month, seconds;
if (typeof date !== 'object') {
date = new Date(date);
}
date = new Date(date.toISOString());
month = date.getMonth() + 1;
if (("" + month).length < 2) {
month = "0" + month;
}
day = date.getDate();
if (("" + day).length < 2) {
day = "0" + day;
}
hours = date.getHours();
if (("" + hours).length < 2) {
hours = "0" + hours;
}
minutes = date.getMinutes();
if (("" + minutes).length < 2) {
minutes = "0" + minutes;
}
seconds = date.getSeconds();
if (("" + seconds).length < 2) {
seconds = "0" + seconds;
}
return "" + (date.getFullYear()) + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
};
$('date-datetime').each(function(i, el) {
$el = $(el);
datetime = $el.attr('date-datetime');
$el.attr('date-datetime', formatDate(datetime));
});
</script>
</head>
<body>
<h1>Nette FW - IRC - Logs</h1>
Expand Down

0 comments on commit f3f4d1c

Please sign in to comment.