Merge pull request #252 from thelounge/xpaw/setnick

Do not display incorrect nick when switching to a non connected network
This commit is contained in:
Jérémie Astori 2016-04-30 19:40:27 -04:00
commit d73c6d0440
2 changed files with 13 additions and 12 deletions

View File

@ -1167,6 +1167,7 @@ button,
font: inherit; font: inherit;
font-size: 11px; font-size: 11px;
margin: 5px; margin: 5px;
margin-right: 10px;
line-height: 26px; line-height: 26px;
height: 24px; height: 24px;
padding: 0 9px; padding: 0 9px;
@ -1177,6 +1178,14 @@ button,
user-select: none; user-select: none;
} }
#form #nick:empty {
visibility: hidden;
}
#form #nick:after {
content: ":";
}
#form #input { #form #input {
border: 1px solid #ddd; border: 1px solid #ddd;
font: inherit; font: inherit;

View File

@ -678,12 +678,7 @@ $(function() {
document.title = title; document.title = title;
if (self.hasClass("chan")) { if (self.hasClass("chan")) {
var nick = self setNick(self.closest(".network").data("nick"));
.closest(".network")
.data("nick");
if (nick) {
setNick(nick);
}
} }
if (chan.data("needsNamesRefresh") === true) { if (chan.data("needsNamesRefresh") === true) {
@ -1081,12 +1076,9 @@ $(function() {
function setNick(nick) { function setNick(nick) {
var width = $("#nick") var width = $("#nick")
.html(nick + ":") .html(nick)
.width(); .outerWidth(true);
if (width) { input.css("padding-left", width);
width += 31;
input.css("padding-left", width);
}
} }
function move(array, old_index, new_index) { function move(array, old_index, new_index) {