diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-011/hallUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-011/hallUi.js index 2a1cee6ef..932934d8f 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-011/hallUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-011/hallUi.js @@ -49,15 +49,15 @@ var GempLotrHallUI = Class.extend({ var editDeck = $(""); editDeck.button().click( - function () { - location.href = 'deckBuild.html'; - }); + function () { + location.href = 'deckBuild.html'; + }); var merchant = $(""); merchant.button().click( - function () { - location.href = 'merchant.html'; - }); + function () { + location.href = 'merchant.html'; + }); this.buttonsDiv.append(editDeck); this.buttonsDiv.append(" | "); @@ -74,17 +74,17 @@ var GempLotrHallUI = Class.extend({ this.createTableButton = $(""); $(this.createTableButton).button().click( - function () { - that.supportedFormatsSelect.hide(); - that.decksSelect.hide(); - that.createTableButton.hide(); - var format = that.supportedFormatsSelect.val(); - var deck = that.decksSelect.val(); - if (deck != null) - that.comm.createTable(format, deck, function (xml) { - that.processResponse(xml); - }); - }); + function () { + that.supportedFormatsSelect.hide(); + that.decksSelect.hide(); + that.createTableButton.hide(); + var format = that.supportedFormatsSelect.val(); + var deck = that.decksSelect.val(); + if (deck != null) + that.comm.createTable(format, deck, function (xml) { + that.processResponse(xml); + }); + }); this.createTableButton.hide(); this.decksSelect = $(""); @@ -98,10 +98,10 @@ var GempLotrHallUI = Class.extend({ this.leaveTableButton = $(""); $(this.leaveTableButton).button().click( - function () { - that.leaveTableButton.hide(); - that.comm.leaveTable(); - }); + function () { + that.leaveTableButton.hide(); + that.comm.leaveTable(); + }); this.leaveTableButton.hide(); this.buttonsDiv.append(this.leaveTableButton); @@ -210,6 +210,7 @@ var GempLotrHallUI = Class.extend({ } this.tablesDiv.append(tablesTable); + var skipReload = false; var games = root.getElementsByTagName("game"); if (games.length > 0) { var waitingGameId = games[0].getAttribute("id"); @@ -217,7 +218,9 @@ var GempLotrHallUI = Class.extend({ var participantIdAppend = ""; if (participantId != null) participantIdAppend = "&participantId=" + participantId; - location.href = "/gemp-lotr/game.html?gameId=" + waitingGameId + participantIdAppend; + this.tablesDiv.append(""); + skipReload = true; + setTimeout("location.href = '/gemp-lotr/game.html?gameId=" + waitingGameId + participantIdAppend + "'", 3000); } if (!this.supportedFormatsInitialized) { @@ -248,9 +251,11 @@ var GempLotrHallUI = Class.extend({ var that = this; - setTimeout(function () { - that.updateHall(); - }, 1000); + if (!skipReload) { + setTimeout(function () { + that.updateHall(); + }, 1000); + } } }, @@ -268,24 +273,24 @@ var GempLotrHallUI = Class.extend({ 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); - }); - }); + function (event) { + var deck = that.decksSelect.val(); + if (deck != null) + that.comm.joinQueue(id, deck, function (xml) { + that.processResponse(xml); + }); + }); actionsField.append(but); } else { var but = $(""); $(but).button().click( - function (event) { - var deck = that.decksSelect.val(); - if (deck != null) - that.comm.leaveQueue(id, deck, function (xml) { - that.processResponse(xml); - }); - }); + function (event) { + var deck = that.decksSelect.val(); + if (deck != null) + that.comm.leaveQueue(id, deck, function (xml) { + that.processResponse(xml); + }); + }); actionsField.append(but); } @@ -320,13 +325,13 @@ var GempLotrHallUI = Class.extend({ if (!waiting) { var but = $(""); $(but).button().click( - function (event) { - var deck = that.decksSelect.val(); - if (deck != null) - that.comm.joinTable(id, deck, function (xml) { - that.processResponse(xml); - }); - }); + function (event) { + var deck = that.decksSelect.val(); + if (deck != null) + that.comm.joinTable(id, deck, function (xml) { + that.processResponse(xml); + }); + }); actionsField.append(but); } } @@ -334,13 +339,13 @@ var GempLotrHallUI = Class.extend({ if (watchable == "true") { var but = $(""); $(but).button().click( - function (event) { - var participantId = getUrlParam("participantId"); - var participantIdAppend = ""; - if (participantId != null) - participantIdAppend = "&participantId=" + participantId; - location.href = "/gemp-lotr/game.html?gameId=" + gameId + participantIdAppend; - }); + function (event) { + var participantId = getUrlParam("participantId"); + var participantIdAppend = ""; + if (participantId != null) + participantIdAppend = "&participantId=" + participantId; + location.href = "/gemp-lotr/game.html?gameId=" + gameId + participantIdAppend; + }); actionsField.append(but); }