Browse files

added win_state flag for results page

  • Loading branch information...
1 parent d59ec52 commit 7490defaa338c0b8e4bfa618be1dad0d5061e3b5 @getify getify committed Aug 29, 2010
Showing with 16 additions and 5 deletions.
  1. BIN public/images/blank.png
  2. +2 −0 public/js/socket.js
  3. +14 −5 public/results.html
View
BIN public/images/blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2 public/js/socket.js
@@ -37,6 +37,7 @@
destroyed : function(message) {
var msg = message.msg;
console.log(msg);
+ global.APPVIEW.win_state = false;
global.APPVIEW.next_page();
},
gamestart : function(message) {
@@ -83,6 +84,7 @@
win : function(message) {
var msg = message.msg;
console.log(msg);
+ global.APPVIEW.win_state = true;
global.APPVIEW.next_page();
},
yourturn : function(message) {
View
19 public/results.html
@@ -23,7 +23,7 @@
<article>
<section class="mod">
- <h3>YOU DIED OF DYSENTERY OR YOU WON!</h3>
+ <h3 id="results_status_msg">Game Over</h3>
<section class="handle mod">
@@ -67,10 +67,7 @@
</section>
- <section class="mod results_image">
- <!-- results-lose.jpg -->
- <img src="images/results-win.jpg" alt="Congrats you won over XYZ, ABC, MNO, and BOB!">
- </section>
+ <section class="mod results_image"><img src="images/blank.png" /></section>
</section>
@@ -87,5 +84,17 @@
</div>
<div id="yourturn"></div>
+
+ <script type="text/javascript" class="init">
+ if (APPVIEW.win_state === true) {
+ $(".results_image img").attr("src","images/results-win.jpg");
+ $("#results_status_msg").text("YOU WON!");
+ }
+ else if (APPVIEW.win_state === false) {
+ $(".results_image img").attr("src","images/results-lose.jpg");
+ $("#results_status_msg").text("YOU DIED OF DYSENTERY");
+ }
+ APPVIEW.win_state = null;
+ </script>
</body>
</html>

0 comments on commit 7490def

Please sign in to comment.