From 91001cf102743a18c6c42025c414d15f0e517d93 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Thu, 24 Apr 2014 00:03:35 +0200 Subject: [PATCH] Added close button again --- client/index.html | 1 + client/js/chat.js | 16 ++++++++++------ client/style.css | 18 +++++++++++++----- config.js | 6 +++--- lib/server.js | 7 ------- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/client/index.html b/client/index.html index d988314..60e67b1 100644 --- a/client/index.html +++ b/client/index.html @@ -42,6 +42,7 @@

{{name}}

+
{{partial "#users"}} diff --git a/client/js/chat.js b/client/js/chat.js index 4fc110b..12fd4c4 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -44,9 +44,6 @@ $(function() { } function event(e, data) { - // Debug - console.log(arguments); - switch (e) { case "join": chat.append(render("#windows", { @@ -130,10 +127,9 @@ $(function() { var input = $(this).parents().eq(1).find(".messages").scrollToBottom(); }); - chat.on("click", ".user", function(e) { - e.preventDefault(); + chat.on("click", ".user", function() { var user = $(this); - var id = parseInt(user.closest(".window").attr("id").replace("window-", "")); + var id = user.closest(".window").find(".input").data("target"); var name = user.text().trim(); if (name == "-!-" || name.indexOf(".") != -1) { return; @@ -143,6 +139,14 @@ $(function() { text: "/whois " + name, }); }); + + chat.on("click", ".close", function() { + var id = $(this).closest(".window").find(".input").data("target"); + socket.emit("input", { + id: id, + text: "/part", + }); + }); sidebar.on("click", ".channel", function(e) { e.preventDefault(); diff --git a/client/style.css b/client/style.css index 20647e1..b900a79 100644 --- a/client/style.css +++ b/client/style.css @@ -85,10 +85,14 @@ li { padding: 0 10px; width: 100%; } -#chat .lobby .users { +#chat .query .users, +#chat .lobby .users, +#chat .lobby .close { display: none; } +#chat .query .title, #chat .lobby .title, +#chat .query .messages, #chat .lobby .messages { right: 0; } @@ -98,12 +102,16 @@ li { position: absolute; width: 100%; } +#chat .close { + float: right; + margin-top: 10px; +} #chat .title { border-bottom: 1px solid #ddd; height: 43px; left: 0; overflow: hidden; - padding-left: 10px; + padding: 0 10px; position: absolute; right: 160px; top: 0; @@ -130,7 +138,7 @@ li { padding: 2px 8px; } #chat .time { - color: #999; + color: #aaa; } #chat .user { color: #f00; @@ -145,7 +153,7 @@ li { #chat .quit, #chat .topic, #chat .whois { - color: #999; + color: #888; } #chat .motd .type, #chat .notice .type, @@ -165,7 +173,7 @@ li { width: 160px; } #chat .users .count { - color: #999; + color: #888; } #chat .users .user { display: block; diff --git a/config.js b/config.js index 053b2df..e46aea3 100644 --- a/config.js +++ b/config.js @@ -1,13 +1,13 @@ module.exports = { defaults: { - nick: "j_doe", - realname: "John Doe", + nick: "shout_user", + realname: "http://github.com/erming/shout", }, networks: [{ host: "irc.freenode.org", port: 6667, channels: [ - "#t_chan", + "#shout-irc", ], }] }; diff --git a/lib/server.js b/lib/server.js index 6a3321c..7a1a8ad 100644 --- a/lib/server.js +++ b/lib/server.js @@ -98,9 +98,6 @@ function connect(params) { } function input(data) { - // Debug - console.log(arguments); - var target = find(data.id); if (!target) { return; @@ -123,7 +120,6 @@ function input(data) { "msg", chan.name ); - console.log(args); case "msg": var user; var text = _.tail(args, 2).join(" "); @@ -240,9 +236,6 @@ function input(data) { } function event(e, data) { - // Debug - console.log(arguments); - var data = _.last(data); var channels = this.channels;