mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	moved event alert to serverside, now node controls the registration alert. added some transition animation to page changes
This commit is contained in:
		| @@ -18,6 +18,8 @@ var ajaxify = {}; | |||||||
| 				current_state = url; | 				current_state = url; | ||||||
|  |  | ||||||
| 				window.history.pushState({}, url, "/" + url); | 				window.history.pushState({}, url, "/" + url); | ||||||
|  | 				 | ||||||
|  | 				jQuery('#content').fadeOut(100, function() { | ||||||
| 					content.innerHTML = templates[tpl_url]; | 					content.innerHTML = templates[tpl_url]; | ||||||
| 					exec_body_scripts(content); | 					exec_body_scripts(content); | ||||||
|  |  | ||||||
| @@ -25,6 +27,10 @@ var ajaxify = {}; | |||||||
| 					if (callback) { | 					if (callback) { | ||||||
| 						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 | ||||||
|  | 				}); | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user