Use location.hash to remember active window
This commit is contained in:
parent
53257ee2b2
commit
c7de3a897d
@ -79,14 +79,24 @@ $(function() {
|
|||||||
.prev(".show-more")
|
.prev(".show-more")
|
||||||
.show();
|
.show();
|
||||||
chat.find(".messages")
|
chat.find(".messages")
|
||||||
.scrollGlue({speed: 400});
|
.scrollGlue({speed: 400})
|
||||||
|
.end();
|
||||||
|
|
||||||
$("#networks")
|
var networks = $("#networks")
|
||||||
.html(render("networks", {networks: data.networks}))
|
.html(render("networks", {networks: data.networks}));
|
||||||
.parent()
|
|
||||||
|
var target = null;
|
||||||
|
if (location.hash) {
|
||||||
|
var id = location.hash;
|
||||||
|
target = sidebar
|
||||||
|
.find("button[data-target='" + id + "']");
|
||||||
|
} else {
|
||||||
|
target = sidebar
|
||||||
.find("button")
|
.find("button")
|
||||||
.first()
|
.first()
|
||||||
.trigger("click");
|
}
|
||||||
|
|
||||||
|
target.trigger("click");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "part":
|
case "part":
|
||||||
@ -107,12 +117,17 @@ $(function() {
|
|||||||
sidebar.on("click", "button", function() {
|
sidebar.on("click", "button", function() {
|
||||||
var button = $(this);
|
var button = $(this);
|
||||||
var target = button.data("target");
|
var target = button.data("target");
|
||||||
|
|
||||||
|
location.hash = target;
|
||||||
|
|
||||||
sidebar.find(".active").removeClass("active");
|
sidebar.find(".active").removeClass("active");
|
||||||
button.addClass("active")
|
button.addClass("active")
|
||||||
.find(".badge")
|
.find(".badge")
|
||||||
.removeClass("highlight")
|
.removeClass("highlight")
|
||||||
.empty();
|
.empty();
|
||||||
$(target).css("z-index", z++)
|
|
||||||
|
var window = $(target)
|
||||||
|
.css("z-index", z++)
|
||||||
.find("input")
|
.find("input")
|
||||||
.focus();
|
.focus();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user