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

View file

@ -224,12 +224,29 @@ $(function() {
socket.on("part", function(data) { socket.on("part", function(data) {
var id = data.chan; var id = data.chan;
sidebar.find("[data-target=#chan-" + id + "]") console.log(id);
.remove() sidebar.find(".chan[data-id='" + id + "']").remove();
.end() $("#chan-" + id).remove();
.find(".chan")
.eq(0) var next = null;
.trigger("click"); 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) { socket.on("quit", function(data) {

View file

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