Remove jquery from msg event

This commit is contained in:
Pavel Djundik 2019-11-04 12:46:18 +02:00
parent 6b8fea8afc
commit 8972242863

View File

@ -1,6 +1,5 @@
"use strict";
const $ = require("jquery");
const socket = require("../socket");
const cleanIrcMessage = require("../libs/handlebars/ircmessageparser/cleanIrcMessage");
const webpush = require("../webpush");
@ -14,7 +13,7 @@ try {
pop.src = "audio/pop.wav";
} catch (e) {
pop = {
play: $.noop,
play() {},
};
}
@ -96,8 +95,6 @@ socket.on("msg", function(data) {
});
function notifyMessage(targetId, channel, activeChannel, msg) {
const button = $("#sidebar .chan[data-id='" + targetId + "']");
if (msg.highlight || (store.state.settings.notifyAllMessages && msg.type === "message")) {
if (!document.hasFocus() || !activeChannel || activeChannel.channel !== channel) {
if (store.state.settings.notification) {
@ -155,9 +152,16 @@ function notifyMessage(targetId, channel, activeChannel, msg) {
timestamp: timestamp,
});
notify.addEventListener("click", function() {
window.focus();
button.trigger("click");
this.close();
window.focus();
const channelTarget = document.querySelector(
"#sidebar .chan[data-id='" + targetId + "']"
);
if (channelTarget) {
channelTarget.click();
}
});
}
} catch (exception) {