From c87a4381f845e9cbbb3a3b3d18b09ece453115ad Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Thu, 17 Jan 2013 23:05:35 +0000 Subject: [PATCH] If a game is waiting for your decision, the title is blinking. --- .../src/main/web/js/gemp-015/gameUi.js | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-015/gameUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-015/gameUi.js index 693aa567a..abcc39946 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-015/gameUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-015/gameUi.js @@ -878,6 +878,7 @@ var GempLotrGameUI = Class.extend({ decisionFunction:function (decisionId, result) { var that = this; + this.stopAnimatingTitle(); this.communication.gameDecisionMade(decisionId, result, this.channelNumber, function (xml) { @@ -1093,8 +1094,46 @@ var GempLotrGameUI = Class.extend({ } } - if (!hasDecision) + if (!hasDecision) { this.animations.updateGameState(animate); + } else { + this.startAnimatingTitle(); + } + }, + + keepAnimating: false, + + startAnimatingTitle: function() { + var that = this; + this.keepAnimating = true; + setTimeout(function() { + that.setDecisionTitle(); + }, 500); + }, + + stopAnimatingTitle: function() { + this.keepAnimating = false; + window.document.title = "Game of Gemp-LotR"; + }, + + setDecisionTitle: function() { + if (this.keepAnimating) { + window.document.title = "Waiting for your decision"; + var that = this; + setTimeout(function() { + that.setNormalTitle(); + }, 500); + } + }, + + setNormalTitle: function() { + if (this.keepAnimating) { + window.document.title = "Game of Gemp-LotR"; + var that = this; + setTimeout(function() { + that.setDecisionTitle(); + }, 500); + } }, getPlayerIndex:function (playerId) {