Skip to content

Commit d7d9341

Browse files
Merge branch 'Arc676-hidestuff'
2 parents 7e4e50a + 9509f8e commit d7d9341

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/res/js/match/match.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,35 @@
416416
pickTab("tab-objects")
417417
}
418418

419+
/**
420+
* Toggle hand visibility.
421+
*/
422+
function toggleHand() {
423+
$("#hand-container").toggle()
424+
$("#toggle-hand-button").html(($("#hand-container").is(":visible") ? "Hide" : "Show") + " Hand")
425+
}
426+
427+
/**
428+
* Toggle chat visibility.
429+
*/
430+
function toggleChat() {
431+
$("#chat-container").toggle()
432+
let chatVisible = $("#chat-container").is(":visible")
433+
$("#toggle-chat-button").html((chatVisible ? "Hide" : "Show") + " Chat")
434+
435+
// The match hand has the width of the chat hardcoded in its container
436+
// size. When the chat is invisible, the hand should be centered in the
437+
// new view.
438+
$(".match-hand").css("width", chatVisible ? "" : "100vw")
439+
}
440+
419441
setInterval(loadStatus, 1000)
420442
loadStatus()
421443
setInterval(loadCards, 1000)
422444
loadCards()
423445
pickTab("tab-actions")
424446
$("#tab-actions").click(chooseActionsTab)
425447
$("#tab-objects").click(chooseObjectsTab)
448+
$("#toggle-hand-button").click(toggleHand)
449+
$("#toggle-chat-button").click(toggleChat)
426450
})()

src/res/tpl/match.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
<a href="/match/abandon">Abandon match</a>
1919
</div>
2020
<div>
21+
<a href="#" id="toggle-hand-button">
22+
Hide Hand
23+
</a>
24+
&mdash;
25+
<a href="#" id="toggle-chat-button">
26+
Hide Chat
27+
</a>
28+
&mdash;
2129
<a href="#" id="lightLabel">
2230
Lights are being checked...
2331
</a>
@@ -46,13 +54,13 @@
4654
<div class="match-played-cards"></div>
4755
</div>
4856
</div>
49-
<div class="match-chat">
57+
<div id="chat-container" class="match-chat">
5058
<input type="text" class="chat-line" id="chatinput" placeholder="Type a message..." spellcheck="false" maxlength="120" autocomplete="off">
5159
<div class="chat-messages" id="chatlist"></div>
5260
</div>
5361
</div>
5462
<div class="match-hand">
55-
<div class="match-hand-container">
63+
<div id="hand-container" class="match-hand-container">
5664
<div class="match-hand-tabs">
5765
<div class="hand-tab-header" id="tab-actions">
5866
Actions

0 commit comments

Comments
 (0)