modified ajaxify slightly to make transitions between pages a bit more fluid (although first load doesn't look that awesome); fixed up rooms - resolved DRY failure and properly leave rooms

This commit is contained in:
psychobunny
2013-05-05 20:10:26 +00:00
parent 8133ac53de
commit 3947b6b6fd
4 changed files with 30 additions and 25 deletions

View File

@@ -1,7 +1,6 @@
var socket,
config,
app = {},
current_room,
API_URL = null;
// todo: cleanup,etc
@@ -172,11 +171,21 @@ var socket,
jQuery(post_window).slideToggle(250);
};
app.current_room = null;
app.enter_room = function(room) {
if (app.current_room === room) return;
socket.emit('event:enter_room', {
'enter': room,
'leave': app.current_room
});
app.current_room = room;
};
jQuery('document').ready(function() {
if (current_room != 'global') {
socket.emit('event:enter_room', 'global');
current_room = 'global';
}
app.enter_room('global');
// On menu click, change "active" state