Merge pull request #820 from thelounge/xpaw/fix-unread-disappear
Fix unread marker being removed from DOM
This commit is contained in:
commit
6887b66f67
@ -1318,26 +1318,14 @@ $(function() {
|
|||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
chat.find(".chan:not(.active)").each(function() {
|
chat.find(".chan:not(.active)").each(function() {
|
||||||
var chan = $(this);
|
var chan = $(this);
|
||||||
if (chan.find(".messages .msg:not(.unread-marker)").slice(0, -100).remove().length) {
|
if (chan.find(".messages .msg").slice(0, -100).remove().length) {
|
||||||
chan.find(".show-more").addClass("show");
|
chan.find(".show-more").addClass("show");
|
||||||
|
|
||||||
// Remove date-seperators that would otherwise be "stuck" at the top
|
// Remove date-seperators that would otherwise be "stuck" at the top
|
||||||
// of the channel
|
// of the channel
|
||||||
var prev;
|
chan.find(".date-marker").each(function() {
|
||||||
$(chan.find(".messages").children()).each(function() {
|
if ($(this).next().hasClass("date-marker")) {
|
||||||
if (!prev) {
|
$(this).remove();
|
||||||
// Should always be a date-seperator, because it's always added
|
|
||||||
prev = $(this);
|
|
||||||
} else {
|
|
||||||
var current = $(this);
|
|
||||||
|
|
||||||
if (current.attr("class") === "date-marker") {
|
|
||||||
prev.remove();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
prev = current;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1345,9 +1333,9 @@ $(function() {
|
|||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
chat.find(".active .messages .msg:not(.unread-marker)").remove();
|
chat.find(".active")
|
||||||
chat.find(".active .show-more").addClass("show");
|
.find(".show-more").addClass("show").end()
|
||||||
chat.find(".active .date-marker").remove();
|
.find(".messages .msg, .date-marker").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function complete(word) {
|
function complete(word) {
|
||||||
|
Loading…
Reference in New Issue
Block a user