From 07805176b157f99b5040d3266cd95ea5f86976d2 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Thu, 6 Oct 2011 21:03:30 +0000 Subject: [PATCH] Tweaking new sets, formats and filtering in deck builder. --- .../src/main/webapp/js/deckBuildingUi.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js index 709304d45..3f038e64c 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js @@ -27,6 +27,8 @@ var GempLotrDeckBuildingUI = Class.extend({ filterDirty: false, deckDirty: false, + checkDirtyInterval: 300, + init: function() { var that = this; @@ -356,6 +358,7 @@ var GempLotrDeckBuildingUI = Class.extend({ var cardDiv = this.addCardToContainer(blueprintId, "special", container); cardDiv.addClass("cardInDeck"); this.showNormalFilter(); + this.deckDirty = true; }; }, @@ -421,6 +424,7 @@ var GempLotrDeckBuildingUI = Class.extend({ }, checkDeckStatsDirty: function() { + log("Checking stats"); if (this.deckDirty) { this.deckDirty = false; this.updateDeckStats(); @@ -428,23 +432,30 @@ var GempLotrDeckBuildingUI = Class.extend({ var that = this; setTimeout( function() { - that.checkDeckStatsDirty() - }, 100); + that.checkDeckStatsDirty(); + }, that.checkDirtyInterval); } }, updateDeckStats: function() { var that = this; var deckContents = this.getDeckContents(); - if (deckContents != null) + if (deckContents != null) { this.comm.getDeckStats(deckContents, function(html) { $("#deckStats").html(html); setTimeout( function() { - that.checkDeckStatsDirty() - }, 100); + that.checkDeckStatsDirty(); + }, that.checkDirtyInterval); }); + } else { + $("#deckStats").html("Deck has no Ring, Ring-bearer or all 9 sites"); + setTimeout( + function() { + that.checkDeckStatsDirty(); + }, that.checkDirtyInterval); + } }, removeCardFromDeck: function(cardDiv) { @@ -564,6 +575,7 @@ var GempLotrDeckBuildingUI = Class.extend({ }, processError: function (xhr, ajaxOptions, thrownError) { - alert("There was a problem during communication with server"); + if (thrownError != "abort") + alert("There was a problem during communication with server"); } }); \ No newline at end of file