mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
This commit is contained in:
@@ -473,6 +473,19 @@ app.cacheBuster = null;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.updateUserStatus = function(el, status) {
|
||||||
|
if (!el.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
translator.translate('[[global:' + status + ']]', function(translated) {
|
||||||
|
el.removeClass('online offline dnd away')
|
||||||
|
.addClass(status)
|
||||||
|
.attr('title', translated)
|
||||||
|
.attr('data-original-title', translated);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function handleNewTopic() {
|
function handleNewTopic() {
|
||||||
$('#content').on('click', '#new_topic', function() {
|
$('#content').on('click', '#new_topic', function() {
|
||||||
require(['composer'], function(composer) {
|
require(['composer'], function(composer) {
|
||||||
|
|||||||
@@ -69,18 +69,11 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onUserStatusChange(data) {
|
function onUserStatusChange(data) {
|
||||||
var onlineStatus = $('.account-online-status');
|
if (parseInt(ajaxify.variables.get('theirid'), 10) !== parseInt(data.uid, 10)) {
|
||||||
|
|
||||||
if(parseInt(ajaxify.variables.get('theirid'), 10) !== parseInt(data.uid, 10)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
translator.translate('[[global:' + data.status + ']]', function(translated) {
|
app.updateUserStatus($('.account [component="user/status"]'), data.status);
|
||||||
onlineStatus.attr('class', 'account-online-status fa fa-circle status ' + data.status)
|
|
||||||
.attr('title', translated)
|
|
||||||
.attr('data-original-title', translated);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadMorePosts(direction) {
|
function loadMorePosts(direction) {
|
||||||
|
|||||||
@@ -163,16 +163,7 @@ define('forum/chats', ['string', 'sounds', 'forum/infinitescroll', 'translator']
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('event:user_status_change', function(data) {
|
socket.on('event:user_status_change', function(data) {
|
||||||
var userEl = $('.chats-list li[data-uid="' + data.uid +'"]');
|
app.updateUserStatus($('.chats-list [data-uid="' + data.uid + '"] [component="user/status"]'), data.status);
|
||||||
|
|
||||||
if (userEl.length) {
|
|
||||||
var statusEl = userEl.find('.status');
|
|
||||||
translator.translate('[[global:' + data.status + ']]', function(translated) {
|
|
||||||
statusEl.attr('class', 'fa fa-circle status ' + data.status)
|
|
||||||
.attr('title', translated)
|
|
||||||
.attr('data-original-title', translated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,20 +48,11 @@ define('forum/topic/browsing', ['translator'], function(translator) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Browsing.onUserStatusChange = function(data) {
|
Browsing.onUserStatusChange = function(data) {
|
||||||
updateOnlineIcon($('.username-field[data-uid="' + data.uid + '"]'), data.status);
|
app.updateUserStatus($('[data-uid="' + data.uid + '"] [component="user/status"]'), data.status);
|
||||||
|
|
||||||
updateBrowsingUsers(data);
|
updateBrowsingUsers(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateOnlineIcon(el, status) {
|
|
||||||
translator.translate('[[global:' + status + ']]', function(translated) {
|
|
||||||
el.siblings('i')
|
|
||||||
.attr('class', 'fa fa-circle status ' + status)
|
|
||||||
.attr('title', translated)
|
|
||||||
.attr('data-original-title', translated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateBrowsingUsers(data) {
|
function updateBrowsingUsers(data) {
|
||||||
var activeEl = $('[component="topic/browsing/list"]');
|
var activeEl = $('[component="topic/browsing/list"]');
|
||||||
var user = activeEl.find('a[data-uid="'+ data.uid + '"]');
|
var user = activeEl.find('a[data-uid="'+ data.uid + '"]');
|
||||||
|
|||||||
@@ -182,17 +182,8 @@ define('forum/users', ['translator'], function(translator) {
|
|||||||
if (data.status === 'offline') {
|
if (data.status === 'offline') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var usersContainer = $('#users-container');
|
|
||||||
var userEl = usersContainer.find('li[data-uid="' + data.uid +'"]');
|
|
||||||
|
|
||||||
if (userEl.length) {
|
app.updateUserStatus($('#users-container [data-uid="' + data.uid +'"] [component="user/status"]'), data.status);
|
||||||
var statusEl = userEl.find('.status');
|
|
||||||
translator.translate('[[global:' + data.status + ']]', function(translated) {
|
|
||||||
statusEl.attr('class', 'fa fa-circle status ' + data.status)
|
|
||||||
.attr('title', translated)
|
|
||||||
.attr('data-original-title', translated);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActiveSection() {
|
function getActiveSection() {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats', 'translator'], fun
|
|||||||
|
|
||||||
socket.on('event:user_status_change', function(data) {
|
socket.on('event:user_status_change', function(data) {
|
||||||
var modal = module.getModal(data.uid);
|
var modal = module.getModal(data.uid);
|
||||||
updateStatus(modal, data.status);
|
app.updateUserStatus(modal.find('[component="user/status"]'), data.status);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,20 +153,12 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats', 'translator'], fun
|
|||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
updateStatus(chatModal, status);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateStatus(chatModal, status) {
|
app.updateUserStatus(chatModal.find('[component="user/status"]'), status);
|
||||||
translator.translate('[[global:' + status + ']]', function(translated) {
|
|
||||||
chatModal.find('#chat-user-status').attr('class', 'fa fa-circle status ' + status)
|
|
||||||
.attr('title', translated)
|
|
||||||
.attr('data-original-title', translated);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.createModal = function(username, touid, callback) {
|
module.createModal = function(username, touid, callback) {
|
||||||
|
|
||||||
templates.parse('chat', {}, function(chatTpl) {
|
templates.parse('chat', {}, function(chatTpl) {
|
||||||
translator.translate(chatTpl, function (chatTpl) {
|
translator.translate(chatTpl, function (chatTpl) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user