Improved close buttons
This commit is contained in:
parent
08a78d2879
commit
3eb3ef081f
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
<script type="text/html" class="channels">
|
<script type="text/html" class="channels">
|
||||||
{{#each 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="badge"></span>
|
||||||
<span class="close"></span>
|
<span class="close"></span>
|
||||||
{{name}}
|
{{name}}
|
||||||
|
|
|
@ -121,18 +121,25 @@ $(function() {
|
||||||
.removeClass("highlight")
|
.removeClass("highlight")
|
||||||
.empty();
|
.empty();
|
||||||
var window = $(target)
|
var window = $(target)
|
||||||
.css("z-index", z++)
|
.css("z-index", z++)
|
||||||
.find("input")
|
.find("input")
|
||||||
.focus();
|
.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
sidebar.on("click", ".close", function() {
|
sidebar.on("click", ".close", function() {
|
||||||
var link = $(this);
|
var channel = $(this).closest(".channel");
|
||||||
var channel = link.closest(".channel");
|
|
||||||
var id = parseInt(channel.attr("id").split("-")[1]);
|
var id = parseInt(channel.attr("id").split("-")[1]);
|
||||||
|
var cmd = "/close";
|
||||||
|
if (channel.hasClass("lobby")) {
|
||||||
|
cmd = "/quit";
|
||||||
|
}
|
||||||
socket.emit("input", {
|
socket.emit("input", {
|
||||||
id: id,
|
id: id,
|
||||||
text: "/close",
|
text: cmd,
|
||||||
|
});
|
||||||
|
channel.css({
|
||||||
|
transition: "none",
|
||||||
|
opacity: .4
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue