Fixing issues with JS variable scope.

This commit is contained in:
marcins78@gmail.com
2013-01-01 20:35:07 +00:00
parent d3c95ee5c3
commit 981f0e127e
2 changed files with 23 additions and 20 deletions

View File

@@ -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";
}
}

View File

@@ -330,25 +330,28 @@ var GempLotrHallUI = Class.extend({
var joined = queue.getAttribute("signedUp");
if (joined != "true") {
var but = $("<button>Join queue</button>");
$(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 = $("<button>Leave queue</button>");
$(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 = $("<button>Join table</button>");
$(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 = $("<button>Watch game</button>");
$(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);
}