From de83dd14cea90c372fa38ac5b3d9a9e931aaa2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=A4=AA?= Date: Tue, 31 Dec 2013 00:48:26 +1100 Subject: [PATCH 1/2] Fix team selection bug in tournaments along with a more intuitive naming for team selection variables and classes --- js/client-chat-tournament.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/js/client-chat-tournament.js b/js/client-chat-tournament.js index 594b1418f..e4aeaf6b6 100644 --- a/js/client-chat-tournament.js +++ b/js/client-chat-tournament.js @@ -101,14 +101,14 @@ '
There are currently no new matches available for you. Please wait for some other battles to end.
' + '
' + '' + - '' + + '' + '' + '
' + '
' + '
' + '
' + '
' + - '' + + '' + '' + '
' + '' + @@ -124,9 +124,9 @@ this.$join = $wrapper.find('.tournament-join'); this.$leave = $wrapper.find('.tournament-leave'); this.$noMatches = $wrapper.find('.tournament-nomatches'); + this.$teamSelect = $wrapper.find('.tournament-team'); this.$challenge = $wrapper.find('.tournament-challenge'); this.$challengeUser = $wrapper.find('.tournament-challenge-user'); - this.$challengeTeam = $wrapper.find('.tournament-challenge-team'); this.$challengeChallenge = $wrapper.find('.tournament-challenge-challenge'); this.$challengeBy = $wrapper.find('.tournament-challengeby'); this.$challenging = $wrapper.find('.tournament-challenging'); @@ -159,12 +159,12 @@ self.room.send('/tournament leave'); }); this.$challengeChallenge.on('click', function() { - var team = Storage.teams[self.$challengeTeam.children().val()]; + var team = Storage.teams[self.$challenge.find('.tournament-team').children().val()]; self.room.send('/utm ' + JSON.stringify(team ? team.team : null)); self.room.send('/tournament challenge ' + self.$challengeUser.children().val()); }); this.$challengeAccept.on('click', function() { - var team = Storage.teams[self.$challengeTeam.children().val()]; + var team = Storage.teams[self.$challenged.find('.tournament-team').children().val()]; self.room.send('/utm ' + JSON.stringify(team ? team.team : null)); self.room.send('/tournament acceptchallenge'); }); @@ -192,9 +192,9 @@ if (!this.info.isJoined || !this.info.isStarted) return; - this.$challengeTeam.html(app.rooms[''].renderTeams(this.info.format)); - this.$challengeTeam.children().data('type', 'challengeTeam'); - this.$challengeTeam.children().attr('name', 'tournamentButton'); + this.$teamSelect.html(app.rooms[''].renderTeams(this.info.format)); + this.$teamSelect.children().data('type', 'teamSelect'); + this.$teamSelect.children().attr('name', 'tournamentButton'); }; TournamentBox.prototype.isBoxVisible = function () { @@ -594,7 +594,7 @@ app.addPopup(UserPopup, {user: user, users: this.info.challenges, sourceEl: button}); }; - TournamentBox.prototype.challengeTeam = function (team, button) { + TournamentBox.prototype.teamSelect = function (team, button) { app.addPopup(TeamPopup, {team: team, format: this.info.format, sourceEl: button}); }; From 819dbcc6faba41740d89c5126225dfcad9b5eac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=A4=AA?= Date: Tue, 31 Dec 2013 02:22:04 +1100 Subject: [PATCH 2/2] Fix bug where the tournament box doesn't disappear when the box is open and the tournament ends, but the user is in a different room --- js/client-chat-tournament.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/client-chat-tournament.js b/js/client-chat-tournament.js index e4aeaf6b6..2a40a07ec 100644 --- a/js/client-chat-tournament.js +++ b/js/client-chat-tournament.js @@ -382,7 +382,7 @@ this.bracketPopup.close(); this.savedPopoutBracketPosition = {}; - if (!this.isBoxVisible()) + if (!this.isBoxVisible() || app.curSideRoom !== this.room) this.$wrapper.find('.active').andSelf().removeClass('active'); else this.toggleBoxVisibility(false);