|
|
|
@ -103,20 +103,18 @@ define('forum/chats', [
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Chats.addIPHandler = function (container) {
|
|
|
|
|
container.on('click', '.chat-ip-button', function () {
|
|
|
|
|
const ipEl = $(this).parent();
|
|
|
|
|
container.on('click', '.chat-ip-button', async function () {
|
|
|
|
|
const ipEl = $(this);
|
|
|
|
|
let ip = ipEl.attr('data-ip');
|
|
|
|
|
if (ip) {
|
|
|
|
|
navigator.clipboard.writeText(ip);
|
|
|
|
|
ipEl.translateText('[[global:copied]]');
|
|
|
|
|
setTimeout(() => ipEl.text(ip), 2000);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const mid = ipEl.parents('[data-mid]').attr('data-mid');
|
|
|
|
|
socket.emit('modules.chats.getIP', mid, function (err, ip) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return alerts.error(err);
|
|
|
|
|
}
|
|
|
|
|
ipEl.text(ip);
|
|
|
|
|
ipEl.on('click', () => {
|
|
|
|
|
navigator.clipboard.writeText(ip);
|
|
|
|
|
ipEl.translateText('[[global:copied]]');
|
|
|
|
|
setTimeout(() => ipEl.text(ip), 2000);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
ip = await socket.emit('modules.chats.getIP', mid);
|
|
|
|
|
ipEl.text(ip).attr('data-ip', ip);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|