Smaller event footprint

This commit is contained in:
Mattias Erming 2014-03-22 21:37:09 +01:00
parent dcd72b2345
commit f088b726fa
4 changed files with 20 additions and 14 deletions

View File

@ -194,10 +194,14 @@ h2 {
color: #f00; color: #f00;
} }
#chat .message .text { #chat .message .text {
color: #999; color: inherit;
} }
#chat .message.normal .text { #chat .message.join,
color: #000; #chat .message.part,
#chat .message.nick,
#chat .message.quit,
#chat .message.notice {
color: #999;
} }
@media screen and (max-width: 480px) { @media screen and (max-width: 480px) {

View File

@ -57,7 +57,7 @@
<script type="text/html" id="network"> <script type="text/html" id="network">
{{#networks}} {{#networks}}
<div class="network list-group" data-id="{{id}}"> <div class="network list-group" data-id="{{id}}" data-nick="{{nick}}">
{{> channels}} {{> channels}}
</div> </div>
{{/networks}} {{/networks}}
@ -110,7 +110,7 @@
<div class="message {{type}}"> <div class="message {{type}}">
<span class="time">{{time}}</span> <span class="time">{{time}}</span>
<a href="{{user}}" class="user">{{mode}}{{user}}</a> <a href="{{user}}" class="user">{{mode}}{{user}}</a>
<span class="text">{{text}}</span> <span class="text">{{type}} {{text}}</span>
</div> </div>
{{/messages}} {{/messages}}
</script> </script>

View File

@ -48,7 +48,7 @@ models.Message = Backbone.Model.extend({
time: "", time: "",
user: "", user: "",
text: "", text: "",
type: "normal" type: ""
}, },
initialize: function() { initialize: function() {
this.set("time", moment().format("HH:mm")); this.set("time", moment().format("HH:mm"));

View File

@ -24,8 +24,8 @@ Server.prototype.listen = function(port) {
this.sockets = io.listen(http, {log: false}).sockets; this.sockets = io.listen(http, {log: false}).sockets;
this.sockets.on("connection", function(socket) { this.sockets.on("connection", function(socket) {
socket.emit("NETWORKS", self.networks);
socket.on("input", function(input) { handleInput.call(self, input); }); socket.on("input", function(input) { handleInput.call(self, input); });
socket.emit("NETWORKS", self.networks);
}); });
if (config.autoConnect) { if (config.autoConnect) {
@ -278,7 +278,7 @@ function handleEvent(argv) {
var from = argv.nick ? argv.nick : "-!-"; var from = argv.nick ? argv.nick : "-!-";
channels.first().get("messages").add(new models.Message({ channels.first().get("messages").add(new models.Message({
user: from, user: from,
text: "notice: " + argv.args[1], text: argv.args[1],
type: "notice" type: "notice"
})); }));
break; break;
@ -308,7 +308,7 @@ function handleEvent(argv) {
messages.add( messages.add(
new models.Message({ new models.Message({
user: argv.nick, user: argv.nick,
text: "join", text: channel.get("name"),
type: "join" type: "join"
}) })
); );
@ -330,7 +330,7 @@ function handleEvent(argv) {
messages.add( messages.add(
new models.Message({ new models.Message({
user: argv.nick, user: argv.nick,
text: "part", text: channel.get("name"),
type: "part" type: "part"
}) })
); );
@ -356,7 +356,7 @@ function handleEvent(argv) {
messages.add(new models.Message({ messages.add(new models.Message({
user: argv.nick, user: argv.nick,
text: "changed name to " + argv.args[0], text: argv.args[0],
type: "nick" type: "nick"
})); }));
}); });
@ -396,7 +396,6 @@ function handleEvent(argv) {
case "QUIT": case "QUIT":
var message = new models.Message({ var message = new models.Message({
user: argv.nick, user: argv.nick,
text: "quit",
type: "quit" type: "quit"
}); });
@ -420,7 +419,7 @@ function handleEvent(argv) {
messages.add( messages.add(
new models.Message({ new models.Message({
user: argv.nick, user: argv.nick,
text: "sets mode: " + argv.args[1] + " " + target, text: argv.args[1] + " " + target,
type: "mode" type: "mode"
}) })
); );
@ -556,4 +555,7 @@ function handleEvent(argv) {
break; break;
} }
// Debug
console.log(argv);
} }