Improved close buttons

This commit is contained in:
Mattias Erming 2014-05-25 21:39:17 +02:00
parent 08a78d2879
commit 3eb3ef081f
2 changed files with 12 additions and 5 deletions

View file

@ -38,7 +38,7 @@
<script type="text/html" class="channels">
{{#each channels}}
<button id="channel-{{id}}" class="channel" data-target="#window-{{id}}">
<button id="channel-{{id}}" class="channel {{type}}" data-target="#window-{{id}}">
<span class="badge"></span>
<span class="close"></span>
{{name}}

View file

@ -121,18 +121,25 @@ $(function() {
.removeClass("highlight")
.empty();
var window = $(target)
.css("z-index", z++)
.css("z-index", z++)
.find("input")
.focus();
});
sidebar.on("click", ".close", function() {
var link = $(this);
var channel = link.closest(".channel");
var channel = $(this).closest(".channel");
var id = parseInt(channel.attr("id").split("-")[1]);
var cmd = "/close";
if (channel.hasClass("lobby")) {
cmd = "/quit";
}
socket.emit("input", {
id: id,
text: "/close",
text: cmd,
});
channel.css({
transition: "none",
opacity: .4
});
return false;
});