mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 22:10:22 +00:00
Merge pull request #661 from thelounge/xpaw/no-dom-event
Do not trigger a DOM event on every message
This commit is contained in:
commit
e9d7d77cbd
1 changed files with 5 additions and 12 deletions
|
@ -352,17 +352,14 @@ $(function() {
|
|||
var target = "#chan-" + data.chan;
|
||||
var container = chat.find(target + " .messages");
|
||||
|
||||
container
|
||||
.append(msg)
|
||||
.trigger("msg", [
|
||||
target,
|
||||
data.msg
|
||||
]);
|
||||
container.append(msg);
|
||||
|
||||
if (data.msg.self) {
|
||||
container
|
||||
.find(".unread-marker")
|
||||
.appendTo(container);
|
||||
} else {
|
||||
chatMessageShown(target, data.msg);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -951,11 +948,7 @@ $(function() {
|
|||
});
|
||||
});
|
||||
|
||||
chat.on("msg", ".messages", function(e, target, msg) {
|
||||
if (msg.self) {
|
||||
return;
|
||||
}
|
||||
|
||||
function chatMessageShown(target, msg) {
|
||||
var button = sidebar.find(".chan[data-target='" + target + "']");
|
||||
if (msg.highlight || (options.notifyAllMessages && msg.type === "message")) {
|
||||
if (!document.hasFocus() || !$(target).hasClass("active")) {
|
||||
|
@ -1019,7 +1012,7 @@ $(function() {
|
|||
badge.addClass("highlight");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
chat.on("click", ".show-more-button", function() {
|
||||
var self = $(this);
|
||||
|
|
Loading…
Reference in a new issue