From faf9ec33cea373fe3f9abe38d2d3b3d0f87f7a55 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Fri, 17 Jul 2015 14:41:30 -0400 Subject: [PATCH] Support in-battle chat in low res --- js/client-battle.js | 10 +++++++++- style/client.css | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/js/client-battle.js b/js/client-battle.js index 121e74c49..3f4470a4e 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -8,7 +8,7 @@ initialize: function (data) { this.me = {}; - this.$el.addClass('ps-room-opaque').html('
Battle is here
Connecting...
'); + this.$el.addClass('ps-room-opaque').html('
Battle is here
Connecting...
'); this.$battle = this.$el.find('.battle'); this.$controls = this.$el.find('.battle-controls'); @@ -39,6 +39,14 @@ join: function () { app.send('/join ' + this.id); }, + showChat: function() { + this.$('.battle-chat-toggle').attr('name', 'hideChat').text('Battle'); + this.$el.addClass('showing-chat'); + }, + hideChat: function() { + this.$('.battle-chat-toggle').attr('name', 'showChat').text('Chat'); + this.$el.removeClass('showing-chat'); + }, leave: function () { if (!this.expired) app.send('/leave ' + this.id); if (this.battle) this.battle.destroy(); diff --git a/style/client.css b/style/client.css index 7c02f3ee3..095b30c9d 100644 --- a/style/client.css +++ b/style/client.css @@ -1469,6 +1469,9 @@ div[class^='tournament-message-'], div[class*=' tournament-message-'] { width: 640px; background: #EEF2F5; } +.battle-chat-toggle { + display: none; +} @media (max-width:639px) { .ps-room .battle-controls { left: 0; @@ -1511,6 +1514,25 @@ div[class^='tournament-message-'], div[class*=' tournament-message-'] { display: none; } } +@media (max-width:830px) { + .battle-chat-toggle { + display: block; + position: absolute; + top: 5px; + left: 6px; + font-size: 14px; + padding: 2px 5px; + } + .showing-chat .battle, + .showing-chat .battle-controls { + display: none; + } + .showing-chat .battle-log, + .showing-chat .battle-log-add { + left: 0; + display: block; + } +} .shiftselect button, .moveselect button, .switchselect button {