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 class="title">
<h1>{{name}}</h1>
<button class="close">Close</button>
</div>
<div class="users">
{{partial "#users"}}

View File

@ -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();

View File

@ -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;

View File

@ -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",
],
}]
};

View File

@ -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;