Remember active window

This commit is contained in:
Mattias Erming 2014-06-19 01:21:20 +02:00
parent 164bf55e98
commit 06bd770c9b
2 changed files with 13 additions and 7 deletions

View File

@ -120,11 +120,17 @@ $(function() {
e.stopPropagation(); e.stopPropagation();
}); });
var networks = $("#networks") var networks = render("networks", {networks: data.networks});
.html(render("networks", {networks: data.networks})) var current = $("#networks")
.html(networks)
.find("a[href='" + $.cookie("current") + "']")
.trigger("click");
if (!current.length) {
$("#networks")
.find("a") .find("a")
.last() .last()
.trigger("click"); .trigger("click");
}
break; break;
case "part": case "part":
@ -197,6 +203,8 @@ $(function() {
.removeClass("highlight") .removeClass("highlight")
.empty(); .empty();
$.cookie("current", target);
if (sidebar.find(".highlight").length == 0) { if (sidebar.find(".highlight").length == 0) {
favicon.badge(""); favicon.badge("");
} }

View File

@ -29,9 +29,6 @@ Chan.prototype.addMsg = function(msg) {
fs.mkdir(dir); fs.mkdir(dir);
} }
var date = moment().format("YYYY-MM-DD");
var file = dir + this.name + ".log";
var line = "[" + msg.time + "] "; var line = "[" + msg.time + "] ";
if (msg.type == "normal") { if (msg.type == "normal") {
// Format: // Format:
@ -46,6 +43,7 @@ Chan.prototype.addMsg = function(msg) {
} }
} }
var file = dir + this.name + ".log";
fs.appendFile( fs.appendFile(
file, file,
line + "\n" line + "\n"