summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-08 22:36:07 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-08 22:37:50 +0100
commit541cefc5509fde6870b8adb03f8bc4abdf823510 (patch)
tree3f9b092e54351abd39e62d1c6071effbcc22e23a
parent669957dd8cc2dfe697bbbc38d6e695236b3ac4b1 (diff)
mobile: handle the score
updates in the score are reflected in the top bar of the mobile iface. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--cao-mobile.html2
-rw-r--r--cao-mobile.js5
2 files changed, 6 insertions, 1 deletions
diff --git a/cao-mobile.html b/cao-mobile.html
index 900ae2b..49f5dfa 100644
--- a/cao-mobile.html
+++ b/cao-mobile.html
@@ -14,7 +14,7 @@
<div data-role="page">
<header hidden>
<span id="leave-room">Leave this room</span>
- <span id="score">Your score is 0</span>
+ <span id="score">Your score is <span id="score-value">0</span></span>
</header>
<div id="home" class="page current">
<h1>Cards Against Humanity</h1>
diff --git a/cao-mobile.js b/cao-mobile.js
index d476e1c..6776bb6 100644
--- a/cao-mobile.js
+++ b/cao-mobile.js
@@ -14,6 +14,7 @@ $(document).ready(function() {
var $played_card_number = $("#played-card-number");
var $header = $("header");
var $white_cards = $('#white-cards');
+ var $score_value = $('#score-value');
$leave_room.click(function () {
window.location.reload();
@@ -108,5 +109,9 @@ $(document).ready(function() {
$become_judge.show();
};
+ cao.on_updated_score = function(score) {
+ $score_value.html(score);
+ };
+
cao.run();
});