v1.18.x
Baris Usakli 12 years ago
parent 58ad74abb5
commit 19b570cdcf

@ -28,6 +28,7 @@ var ajaxify = {};
ajaxify.go = function(url, callback, template, quiet) {
// leave room and join global
app.enter_room('global');
app.showLoginMessage();
var url = url.replace(/\/$/, "");

@ -21,8 +21,9 @@ var socket,
socket.on('event:connect', function(data) {
console.log('connected to nodebb socket: ', data);
app.username = data.username;
});
socket.on('event:alert', function(data) {
app.alert(data);
});
@ -228,13 +229,12 @@ var socket,
mobileMenu.onNavigate();
});
app.populate_online_users();
var url = window.location.href,
parts = url.split('/'),
active = parts[parts.length-1];
jQuery('#main-nav li').removeClass('active');
if(active) {
jQuery('#main-nav li a').each(function() {
@ -254,6 +254,17 @@ var socket,
}
app.showLoginMessage = function() {
if(location.href.indexOf('loggedin') !== -1) {
app.alert({
type: 'success',
title: 'Welcome Back ' + app.username + '!',
message: 'You have successfully logged in!',
timeout: 5000
});
}
}
jQuery('document').ready(function() {
addTouchEvents();
});

@ -41,9 +41,9 @@
});
socket.emit('api:updateHeader', { fields: ['username', 'picture', 'userslug'] });
socket.on('api:updateHeader', function(data) {
var rightMenu = $('#right-menu');
if (data.uid > 0) {

@ -28,7 +28,7 @@
data: loginData,
success: function(data, textStatus, jqXHR) {
$('#login-error-notify').hide();
window.location.replace(RELATIVE_PATH + "/");
window.location.replace(RELATIVE_PATH + "/?loggedin");
},
error : function(data, textStatus, jqXHR) {
$('#login-error-notify').show().delay(1000).fadeOut(250);

@ -47,13 +47,19 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
userSockets[uid] = userSockets[uid] || [];
userSockets[uid].push(socket);
if(uid)
if(uid) {
socket.join('uid_' + uid);
io.sockets.in('global').emit('api:user.isOnline', isUserOnline(uid));
socket.join('uid_' + uid);
user.getUserField(uid, 'username', function(username) {
socket.emit('event:connect', {status: 1, username:username});
});
}
});
});
socket.emit('event:connect', {status: 1});
socket.on('disconnect', function() {

Loading…
Cancel
Save