diff --git a/scripts/communication/template/communication.js b/scripts/communication/template/communication.js index 7272f78afa6..18516a8a862 100644 --- a/scripts/communication/template/communication.js +++ b/scripts/communication/template/communication.js @@ -1,7 +1,8 @@ // the namespace events connect to var namespace = '/chat', - socket = io.connect(window.location.protocol + '//' + document.domain + ':' + location.port + namespace), - global_chat_rooms = ['Room1', 'Room2', 'Room3', 'Room4', 'Room5']; + socket = io.connect(window.location.protocol + '//' + document.domain + ':' + location.port + namespace), + global_chat_rooms = ['Room1', 'Room2', 'Room3', 'Room4', 'Room5']; // need to get this list from galaxy.ini + // socketio events var events_module = { // event handler for sent data from server @@ -100,23 +101,23 @@ var click_events = { message = $el_send_data.val(); message = message.trim(); // removes whitespaces if( message.length > 0 && click_events.is_connected ) { - var send_data = {}, - event_name = ""; - if ( e.keyCode == 13 || e.which == 13 ) { // if enter is pressed - // if the tab is all chats - if ( click_events.active_tab === '#all_chat_tab' ) { - send_data.data = message; - event_name = 'event broadcast'; - } - else { // if the tab belongs to room - send_data.data = message; - send_data.room = $el_active_li.children().attr("title"); - event_name = 'event room'; - } - socket.emit(event_name, send_data); - $el_send_data.val(''); - return false; - } + var send_data = {}, + event_name = ""; + if ( e.keyCode == 13 || e.which == 13 ) { // if enter is pressed + // if the tab is all chats + if ( click_events.active_tab === '#all_chat_tab' ) { + send_data.data = message; + event_name = 'event broadcast'; + } + else { // if the tab belongs to room + send_data.data = message; + send_data.room = $el_active_li.children().attr("title"); + event_name = 'event room'; + } + socket.emit(event_name, send_data); + $el_send_data.val(''); + return false; + } } }); }, @@ -470,30 +471,30 @@ var utils = { else { // emits join room event socket.emit('join', {room: chat_room_name}); - // removes the active class from the chat creating tab - $el_chat_room_tab.removeClass('fade active in').addClass('fade'); - $el_active_li.removeClass('active'); - // sets new tab id + // removes the active class from the chat creating tab + $el_chat_room_tab.removeClass('fade active in').addClass('fade'); + $el_active_li.removeClass('active'); + // sets new tab id tab_id = "galaxy_tabroom_" + chat_room_name; self.connected_room.push( chat_room_name ); - // create chat room tab header for new room - tab_room_header_template = "