moved event alert to serverside, now node controls the registration alert. added some transition animation to page changes

v1.18.x
psychobunny 12 years ago
parent 67bf1b6041
commit a06b3519a1

@ -18,13 +18,19 @@ var ajaxify = {};
current_state = url; current_state = url;
window.history.pushState({}, url, "/" + url); window.history.pushState({}, url, "/" + url);
content.innerHTML = templates[tpl_url];
exec_body_scripts(content); jQuery('#content').fadeOut(100, function() {
content.innerHTML = templates[tpl_url];
ajaxify.enable(); exec_body_scripts(content);
if (callback) {
callback(); ajaxify.enable();
} if (callback) {
callback();
}
jQuery('#content').fadeIn(200);
});
} }
return true; return true;
@ -42,6 +48,7 @@ var ajaxify = {};
if (ajaxify.go(url)) { if (ajaxify.go(url)) {
ev.preventDefault(); ev.preventDefault();
return false;
} }
} }

@ -13,6 +13,10 @@ var socket,
socket.on('event:connect', function(data) { socket.on('event:connect', function(data) {
}); });
socket.on('event:alert', function(data) {
app.alert(data);
});
}, },
async: false async: false

@ -54,14 +54,7 @@
socket.on('user.create', function(data) { socket.on('user.create', function(data) {
//console.log('user create: ' + data.status); //console.log('user create: ' + data.status);
ajaxify.go('/', function() { ajaxify.go('/');
app.alert({
title: 'Thank you for registering',
message: 'You have successfully registered - welcome to nodebb!',
type: 'notify',
timeout: 2000
});
});
}); });
socket.on('user.exists', function(data) { socket.on('user.exists', function(data) {

@ -65,6 +65,13 @@ var RDB = require('./redis.js');
io.sockets.emit('user.latest', {username: username}); io.sockets.emit('user.latest', {username: username});
global.socket.emit('user.create', {'status': 1}); global.socket.emit('user.create', {'status': 1});
global.socket.emit('event:alert', {
title: 'Thank you for registering',
message: 'You have successfully registered - welcome to nodebb!',
type: 'notify',
timeout: 2000
});
}); });
}); });
}; };

Loading…
Cancel
Save