fix parent clicks

isekai-main
Barış Soner Uşaklı 1 year ago
parent 8132d36be1
commit d45c1b0073

@ -173,17 +173,19 @@ define('forum/chats', [
}); });
}); });
}; };
Chats.addParentHandler = function (mainWrapper) { Chats.addParentHandler = function (mainWrapper) {
mainWrapper.on('click', '[component="chat/message/parent"]', function () { mainWrapper.off('click', '[component="chat/message/parent"]')
const parentEl = $(this); .on('click', '[component="chat/message/parent"]', function () {
parentEl.find('[component="chat/message/parent/content"]').toggleClass('line-clamp-1'); const parentEl = $(this);
parentEl.find('.chat-timestamp').toggleClass('hidden'); parentEl.find('[component="chat/message/parent/content"]').toggleClass('line-clamp-1');
parentEl.toggleClass('flex-column').toggleClass('flex-row'); parentEl.find('.chat-timestamp').toggleClass('hidden');
const chatContent = parentEl.parents('[component="chat/message/content"]'); parentEl.toggleClass('flex-column').toggleClass('flex-row');
if (chatContent.length && messages.isAtBottom(chatContent)) { const chatContent = parentEl.parents('[component="chat/message/content"]');
messages.scrollToBottom(chatContent); if (chatContent.length && messages.isAtBottom(chatContent)) {
} messages.scrollToBottom(chatContent);
}); }
});
}; };
@ -206,19 +208,20 @@ define('forum/chats', [
}; };
Chats.addIPHandler = function (container) { Chats.addIPHandler = function (container) {
container.on('click', '.chat-ip-button', async function () { container.off('click', '.chat-ip-button')
const ipEl = $(this); .on('click', '.chat-ip-button', async function () {
let ip = ipEl.attr('data-ip'); const ipEl = $(this);
if (ip) { let ip = ipEl.attr('data-ip');
navigator.clipboard.writeText(ip); if (ip) {
ipEl.translateText('[[global:copied]]'); navigator.clipboard.writeText(ip);
setTimeout(() => ipEl.text(ip), 2000); ipEl.translateText('[[global:copied]]');
return; setTimeout(() => ipEl.text(ip), 2000);
} return;
const mid = ipEl.parents('[data-mid]').attr('data-mid'); }
ip = await socket.emit('modules.chats.getIP', mid); const mid = ipEl.parents('[data-mid]').attr('data-mid');
ipEl.text(ip).attr('data-ip', ip); ip = await socket.emit('modules.chats.getIP', mid);
}); ipEl.text(ip).attr('data-ip', ip);
});
}; };
Chats.addPopoutHandler = function () { Chats.addPopoutHandler = function () {

Loading…
Cancel
Save