From 76959c3b2a31819cac7cc7773494cc0df49d8c3c Mon Sep 17 00:00:00 2001 From: Andy Janata Date: Sat, 30 Nov 2013 04:54:56 +0000 Subject: [PATCH] refactor emote code to have withEmote in one place. --- WebContent/js/cah.app.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/WebContent/js/cah.app.js b/WebContent/js/cah.app.js index 9462c2e..847b9b6 100644 --- a/WebContent/js/cah.app.js +++ b/WebContent/js/cah.app.js @@ -146,22 +146,22 @@ function chatsubmit_click(game_id, parent_element) { // TODO support an /ignore command case '': if (game_id !== null) { - ajax = cah.Ajax.build(cah.$.AjaxOperation.GAME_CHAT).withGameId(game_id).withEmote(false); + ajax = cah.Ajax.build(cah.$.AjaxOperation.GAME_CHAT).withGameId(game_id); } else { - ajax = cah.Ajax.build(cah.$.AjaxOperation.CHAT).withEmote(false); + ajax = cah.Ajax.build(cah.$.AjaxOperation.CHAT); } - ajax = ajax.withMessage(text); + ajax = ajax.withEmote(false).withMessage(text); cah.log.status_with_game(game_id, "<" + cah.nickname + "> " + text); break; case 'me': - if (game_id !== null) { - ajax = cah.Ajax.build(cah.$.AjaxOperation.GAME_CHAT).withGameId(game_id).withEmote(true); - } else { - ajax = cah.Ajax.build(cah.$.AjaxOperation.CHAT).withEmote(true); - } - ajax = ajax.withMessage(text); - cah.log.status_with_game(game_id, "* " + cah.nickname + " " + text); - break; + if (game_id !== null) { + ajax = cah.Ajax.build(cah.$.AjaxOperation.GAME_CHAT).withGameId(game_id); + } else { + ajax = cah.Ajax.build(cah.$.AjaxOperation.CHAT); + } + ajax = ajax.withEmote(true).withMessage(text); + cah.log.status_with_game(game_id, "* " + cah.nickname + " " + text); + break; case 'wall': ajax = cah.Ajax.build(cah.$.AjaxOperation.CHAT).withWall(true).withMessage(text); break;