Added close button again

This commit is contained in:
Mattias Erming 2014-04-24 00:03:35 +02:00
parent 568e1e0853
commit 91001cf102
5 changed files with 27 additions and 21 deletions

View File

@ -42,6 +42,7 @@
<div id="window-{{id}}" class="window {{type}}"> <div id="window-{{id}}" class="window {{type}}">
<div class="title"> <div class="title">
<h1>{{name}}</h1> <h1>{{name}}</h1>
<button class="close">Close</button>
</div> </div>
<div class="users"> <div class="users">
{{partial "#users"}} {{partial "#users"}}

View File

@ -44,9 +44,6 @@ $(function() {
} }
function event(e, data) { function event(e, data) {
// Debug
console.log(arguments);
switch (e) { switch (e) {
case "join": case "join":
chat.append(render("#windows", { chat.append(render("#windows", {
@ -130,10 +127,9 @@ $(function() {
var input = $(this).parents().eq(1).find(".messages").scrollToBottom(); var input = $(this).parents().eq(1).find(".messages").scrollToBottom();
}); });
chat.on("click", ".user", function(e) { chat.on("click", ".user", function() {
e.preventDefault();
var user = $(this); 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(); var name = user.text().trim();
if (name == "-!-" || name.indexOf(".") != -1) { if (name == "-!-" || name.indexOf(".") != -1) {
return; return;
@ -144,6 +140,14 @@ $(function() {
}); });
}); });
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) { sidebar.on("click", ".channel", function(e) {
e.preventDefault(); e.preventDefault();
$("#window-" + $(this).attr("id").replace("channel-", "")) $("#window-" + $(this).attr("id").replace("channel-", ""))

View File

@ -85,10 +85,14 @@ li {
padding: 0 10px; padding: 0 10px;
width: 100%; width: 100%;
} }
#chat .lobby .users { #chat .query .users,
#chat .lobby .users,
#chat .lobby .close {
display: none; display: none;
} }
#chat .query .title,
#chat .lobby .title, #chat .lobby .title,
#chat .query .messages,
#chat .lobby .messages { #chat .lobby .messages {
right: 0; right: 0;
} }
@ -98,12 +102,16 @@ li {
position: absolute; position: absolute;
width: 100%; width: 100%;
} }
#chat .close {
float: right;
margin-top: 10px;
}
#chat .title { #chat .title {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
height: 43px; height: 43px;
left: 0; left: 0;
overflow: hidden; overflow: hidden;
padding-left: 10px; padding: 0 10px;
position: absolute; position: absolute;
right: 160px; right: 160px;
top: 0; top: 0;
@ -130,7 +138,7 @@ li {
padding: 2px 8px; padding: 2px 8px;
} }
#chat .time { #chat .time {
color: #999; color: #aaa;
} }
#chat .user { #chat .user {
color: #f00; color: #f00;
@ -145,7 +153,7 @@ li {
#chat .quit, #chat .quit,
#chat .topic, #chat .topic,
#chat .whois { #chat .whois {
color: #999; color: #888;
} }
#chat .motd .type, #chat .motd .type,
#chat .notice .type, #chat .notice .type,
@ -165,7 +173,7 @@ li {
width: 160px; width: 160px;
} }
#chat .users .count { #chat .users .count {
color: #999; color: #888;
} }
#chat .users .user { #chat .users .user {
display: block; display: block;

View File

@ -1,13 +1,13 @@
module.exports = { module.exports = {
defaults: { defaults: {
nick: "j_doe", nick: "shout_user",
realname: "John Doe", realname: "http://github.com/erming/shout",
}, },
networks: [{ networks: [{
host: "irc.freenode.org", host: "irc.freenode.org",
port: 6667, port: 6667,
channels: [ channels: [
"#t_chan", "#shout-irc",
], ],
}] }]
}; };

View File

@ -98,9 +98,6 @@ function connect(params) {
} }
function input(data) { function input(data) {
// Debug
console.log(arguments);
var target = find(data.id); var target = find(data.id);
if (!target) { if (!target) {
return; return;
@ -123,7 +120,6 @@ function input(data) {
"msg", "msg",
chan.name chan.name
); );
console.log(args);
case "msg": case "msg":
var user; var user;
var text = _.tail(args, 2).join(" "); var text = _.tail(args, 2).join(" ");
@ -240,9 +236,6 @@ function input(data) {
} }
function event(e, data) { function event(e, data) {
// Debug
console.log(arguments);
var data = _.last(data); var data = _.last(data);
var channels = this.channels; var channels = this.channels;