From 981f0e127eeaed69bce1f71adf7281748a22ca47 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Tue, 1 Jan 2013 20:35:07 +0000 Subject: [PATCH] Fixing issues with JS variable scope. --- .../SingleEliminationOnDemandPrizes.java | 2 +- .../src/main/webapp/js/gemp-014/hallUi.js | 41 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationOnDemandPrizes.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationOnDemandPrizes.java index dfec3856b..0c38118ad 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationOnDemandPrizes.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationOnDemandPrizes.java @@ -53,6 +53,6 @@ public class SingleEliminationOnDemandPrizes implements TournamentPrizes{ @Override public String getPrizeDescription() { - return "1st place - 2 boosters, 2nd place - 1 booster and a random promo, 3rd & 4th - 1 booster"; + return "3 wins - 2 boosters, 2 wins - 1 booster and a random promo, 1 win - 1 booster"; } } diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-014/hallUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-014/hallUi.js index 53255cc2c..b71e01f4e 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-014/hallUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-014/hallUi.js @@ -330,25 +330,28 @@ var GempLotrHallUI = Class.extend({ var joined = queue.getAttribute("signedUp"); if (joined != "true") { var but = $(""); - $(but).button().click( - function (event) { - var deck = that.decksSelect.val(); - if (deck != null) - that.comm.joinQueue(id, deck, function (xml) { - that.processResponse(xml); - }); - }); + $(but).button().click(( + function(queueId) { + return function () { + var deck = that.decksSelect.val(); + if (deck != null) + that.comm.joinQueue(queueId, deck, function (xml) { + that.processResponse(xml); + }); + }; + } + )(id)); actionsField.append(but); } else { var but = $(""); - $(but).button().click( - function (event) { + $(but).button().click(( + function(queueId) { var deck = that.decksSelect.val(); if (deck != null) that.comm.leaveQueue(id, deck, function (xml) { that.processResponse(xml); }); - }); + })(id)); actionsField.append(but); } @@ -411,27 +414,27 @@ var GempLotrHallUI = Class.extend({ var that = this; var but = $(""); - $(but).button().click( - function (event) { + $(but).button().click(( + function(tableId) { var deck = that.decksSelect.val(); if (deck != null) - that.comm.joinTable(id, deck, function (xml) { + that.comm.joinTable(tableId, deck, function (xml) { that.processResponse(xml); }); - }); + })(id)); lastField.append(but); } if (status == "PLAYING" && watchable == "true") { var but = $(""); - $(but).button().click( - function (event) { + $(but).button().click(( + function(gameIdToWatch) { var participantId = getUrlParam("participantId"); var participantIdAppend = ""; if (participantId != null) participantIdAppend = "&participantId=" + participantId; - location.href = "/gemp-lotr/game.html?gameId=" + gameId + participantIdAppend; - }); + location.href = "/gemp-lotr/game.html?gameId=" + gameIdToWatch + participantIdAppend; + })(gameId)); lastField.append(but); }