Sort by z-index on close

This commit is contained in:
Mattias Erming 2014-09-19 16:56:38 -07:00
parent e9a8f86819
commit a837ed270b
3 changed files with 29 additions and 12 deletions

View File

@ -124,7 +124,7 @@ button {
margin: 6px -12px 0 12px;
}
#sidebar {
bottom: 64px;
bottom: 52px;
left: 0;
overflow: hidden;
overflow-y: auto;
@ -219,7 +219,7 @@ button {
margin-top: 1px;
padding: 3px 6px;
position: absolute;
right: 10px;
right: 5px;
transition: all .2s;
}
#sidebar .badge.highlight {
@ -236,7 +236,7 @@ button {
border-radius: 3px;
height: 18px;
margin-top: 1px;
margin-right: 10px;
margin-right: 5px;
opacity: 0;
position: absolute;
right: 0;
@ -255,9 +255,9 @@ button {
background: rgba(0, 0, 0, .06);
border-radius: 2px;
bottom: 4px;
height: 60px;
height: 48px;
left: 5px;
line-height: 60px;
line-height: 48px;
position: absolute;
text-align: center;
width: 210px;

View File

@ -224,12 +224,29 @@ $(function() {
socket.on("part", function(data) {
var id = data.chan;
sidebar.find("[data-target=#chan-" + id + "]")
.remove()
.end()
.find(".chan")
.eq(0)
.trigger("click");
console.log(id);
sidebar.find(".chan[data-id='" + id + "']").remove();
$("#chan-" + id).remove();
var next = null;
var highest = -1;
chat.find(".chan").each(function() {
var self = $(this);
var z = parseInt(self.css("z-index"));
if (z > highest) {
highest = z;
next = self;
}
});
if (next !== null) {
var id = next.data("id");
sidebar.find("[data-id=" + id + "]").click();
} else {
sidebar.find(".chan")
.eq(0)
.click();
}
});
socket.on("quit", function(data) {

View File

@ -1,7 +1,7 @@
{
"name": "shout",
"description": "A web IRC client",
"version": "0.31.5",
"version": "0.31.6",
"author": "Mattias Erming",
"preferGlobal": true,
"bin": {