$(function () {\r
console.log('starting');\r
kiwi.init();\r
- kiwi.gateway.nick = "efhoerufre";\r
+ kiwi.gateway.nick = "mobwok"+Math.floor(Math.random()*500);\r
kiwi.gateway.start('/kiwi');\r
});\r
\r
<style type='text/css'> \r
* { margin:0px; padding:0px; }\r
\r
-body { font-family:arial; font-size:14px; color:rgb(233,242,237); background:rgb(138,150,143); }\r
+body { font-family:arial; font-size:14px; color:rgb(233,242,237); background:#EBEBEB; }\r
\r
-.fixed { position:fixed; width:100%; background:rgb(138,150,143); z-index:1; }\r
+.fixed { position:fixed; width:100%; background:#1B1B1B; top:0px; left:0px; z-index:1; }\r
#hover_top { top:0px; }\r
-#hover_bottom { bottom:0px; background:red; }\r
+#hover_bottom { bottom:0px; top:auto; padding-top:3px; background:#1B1B1B; }\r
\r
#nav { padding:10px 1em 0px 1em; }\r
#nav a { display:block; float:right; margin-right:1em; }\r
#msgs { position:absolute; width:100%; top:0px; z-index:0; }\r
#msgs > div { display:none; }\r
#msgs > div.active { display:block; }\r
-.msg { border-bottom:1px solid gray; padding:4px 3px; }\r
-.msg .time { color: gray; display:block; font-size:0.9em; display:none; }\r
+.msg { border-bottom:1px solid #CCC; padding:4px 3px; }\r
+.msg .time { color: gray; display:block; font-size:0.9em; color:#777; display:none; }\r
.msg .nick { color: rgb(199,199,199); }\r
-.msg .body { margin-left:2em; white-space:pre-wrap; word-wrap:break-word; }\r
-\r
+.msg .body { margin-left:2em; white-space:pre-wrap; word-wrap:break-word; color:#333; }\r
+.msg.motd .body { color:#666; }\r
+.msg.join .body { color: #009900; }\r
+.msg.part .body { color: #990000; }\r
#msginp { width:100%; border:0px; margin:0px; padding:5px 3px; }\r
</style> \r
</head> \r
}\r
tab = kiwi.objects.MessageView.getCurrent();\r
if (tab.title !== 'server') {\r
+ console.log(tab.title);\r
kiwi.gateway.privmsg(tab.title, msg);\r
tab.addMsg(kiwi.gateway.nick, msg);\r
}\r
}\r
tab.addMsg(data.nick, data.msg);\r
});\r
+ gateway.bind('onjoin', function (e, data) {\r
+ var tab = kiwi.objects.MessageView.get(data.channel);\r
+ if (!tab) {\r
+ tab = new kiwi.objects.MessageView(data.channel);\r
+ }\r
+ tab.addMsg('', '--> ' + data.nick + ' has joined', 'join');\r
+ });\r
+ gateway.bind('onpart', function (e, data) {\r
+ var tab = kiwi.objects.MessageView.get(data.channel);\r
+ if (!tab) {\r
+ tab = new kiwi.objects.MessageView(data.channel);\r
+ }\r
+ tab.addMsg('', '<-- ' + data.nick + ' has left (' + data.message + ')', 'part');\r
+ });\r
};\r
\r
\r
kiwi.ui.views[name.toLowerCase()] = this;\r
}\r
kiwi.objects.MessageView.prototype = new kiwi.objects.View();\r
-kiwi.objects.MessageView.prototype.addMsg = function (nick, text) {\r
+kiwi.objects.MessageView.prototype.msg_count = 0;\r
+kiwi.objects.MessageView.prototype.addMsg = function (nick, text, msg_class) {\r
var msg, d = new Date(),\r
time;\r
\r
- msg = $('<div class="msg"><span class="time"></span><span class="nick"></span><span class="body"></span></div>');\r
+ // The CSS class to use\r
+ msg_class = msg_class || '';\r
+\r
+ msg = $('<div class="msg ' + msg_class + '"><span class="time"></span><span class="nick"></span><span class="body"></span></div>');\r
time = d.getHours().toString().lpad(2, "0") + ":" + d.getMinutes().toString().lpad(2, "0") + ":" + d.getSeconds().toString().lpad(2, "0");\r
\r
$('.time', msg).text(time);\r
$('.body', msg).text(kiwi.ui.formatIRCMsg(text));\r
this.content.append(msg);\r
\r
+ this.msg_count++;\r
+ if (this.msg_count > 5) {\r
+ $('.msg:first', this.content).remove();\r
+ this.msg_count--;\r
+ }\r
+\r
this.scrollBottom();\r
}\r
// Static functions\r