Commit e8aa6662 authored by Kasalehlia's avatar Kasalehlia

Merge branch 'rohieb/s0infodisplay-feature/irc-dates'

parents 9b2c2320 1ff961e5
......@@ -14,6 +14,7 @@
"mustache": "^2.2.0",
"pixl-xml": "^1.0.4",
"socket.io": "^1.3.7",
"sprintf.js": "^0.1.4",
"time": "^0.11.4"
},
"devDependencies": {
......
......@@ -51,6 +51,17 @@ h3 {
content: ">";
color: #839496;
}
irc-date {
color: #2aa198;
}
irc-date::before {
content: "[";
color: #839496;
}
irc-date::after {
content: "]";
color: #839496;
}
#weather {
font-size: 120%;
}
......
import irc from 'irc';
require('sprintf.js');
const CHANNEL = '#stratum0';
const PW = 'Fagee9ie';
function datestring (date) {
days = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ];
return sprintf('%s, %02d:%02d', days[date.getDay()], date.getHours(), date.getMinutes());
}
module.exports = function(io) {
const client = new irc.Client('bouncer.ksal.de', 'infodisplay', {
channels: [CHANNEL],
......@@ -20,7 +27,8 @@ module.exports = function(io) {
}
// eslint-disable-next-line
message = message.replace(/</g, '&lt;').replace(/>/g, '&gt;');
content.push(`<p><span>${from}</span> ${message}</p>`);
date = datestring(new Date());
content.push(`<p><irc-date>${date}</irc-date> <span>${from}</span> ${message}</p>`);
if (content.length > 25) {
content.shift();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment