A lot of small fixes.
This commit is contained in:
@@ -18,11 +18,11 @@ public class GameHistoryDAO {
|
|||||||
_dbAccess = dbAccess;
|
_dbAccess = dbAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGameHistory(String winner, String loser, String winReason, String loseReason, String winRecordingId, String loseRecordingId, String formatName, String winnerDeckName, String loserDeckName, Date startDate, Date endDate) {
|
public void addGameHistory(String winner, String loser, String winReason, String loseReason, String winRecordingId, String loseRecordingId, String formatName, String tournament, String winnerDeckName, String loserDeckName, Date startDate, Date endDate) {
|
||||||
try {
|
try {
|
||||||
Connection connection = _dbAccess.getDataSource().getConnection();
|
Connection connection = _dbAccess.getDataSource().getConnection();
|
||||||
try {
|
try {
|
||||||
PreparedStatement statement = connection.prepareStatement("insert into game_history (winner, loser, win_reason, lose_reason, win_recording_id, lose_recording_id, format_name, winner_deck_name, loser_deck_name, start_date, end_date) values (?,?,?,?,?,?,?,?,?,?,?)");
|
PreparedStatement statement = connection.prepareStatement("insert into game_history (winner, loser, win_reason, lose_reason, win_recording_id, lose_recording_id, format_name, tournament, winner_deck_name, loser_deck_name, start_date, end_date) values (?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||||
try {
|
try {
|
||||||
statement.setString(1, winner);
|
statement.setString(1, winner);
|
||||||
statement.setString(2, loser);
|
statement.setString(2, loser);
|
||||||
@@ -31,10 +31,11 @@ public class GameHistoryDAO {
|
|||||||
statement.setString(5, winRecordingId);
|
statement.setString(5, winRecordingId);
|
||||||
statement.setString(6, loseRecordingId);
|
statement.setString(6, loseRecordingId);
|
||||||
statement.setString(7, formatName);
|
statement.setString(7, formatName);
|
||||||
statement.setString(8, winnerDeckName);
|
statement.setString(8, tournament);
|
||||||
statement.setString(9, loserDeckName);
|
statement.setString(9, winnerDeckName);
|
||||||
statement.setLong(10, startDate.getTime());
|
statement.setString(10, loserDeckName);
|
||||||
statement.setLong(11, endDate.getTime());
|
statement.setLong(11, startDate.getTime());
|
||||||
|
statement.setLong(12, endDate.getTime());
|
||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -52,7 +53,7 @@ public class GameHistoryDAO {
|
|||||||
try {
|
try {
|
||||||
Connection connection = _dbAccess.getDataSource().getConnection();
|
Connection connection = _dbAccess.getDataSource().getConnection();
|
||||||
try {
|
try {
|
||||||
PreparedStatement statement = connection.prepareStatement("select winner, loser, win_reason, lose_reason, win_recording_id, lose_recording_id, format_name, winner_deck_name, loser_deck_name, start_date, end_date from game_history where winner=? or loser=? order by end_date desc limit ?, ?");
|
PreparedStatement statement = connection.prepareStatement("select winner, loser, win_reason, lose_reason, win_recording_id, lose_recording_id, format_name, tournament, winner_deck_name, loser_deck_name, start_date, end_date from game_history where winner=? or loser=? order by end_date desc limit ?, ?");
|
||||||
try {
|
try {
|
||||||
statement.setString(1, player.getName());
|
statement.setString(1, player.getName());
|
||||||
statement.setString(2, player.getName());
|
statement.setString(2, player.getName());
|
||||||
@@ -69,12 +70,13 @@ public class GameHistoryDAO {
|
|||||||
String winRecordingId = rs.getString(5);
|
String winRecordingId = rs.getString(5);
|
||||||
String loseRecordingId = rs.getString(6);
|
String loseRecordingId = rs.getString(6);
|
||||||
String formatName = rs.getString(7);
|
String formatName = rs.getString(7);
|
||||||
String winnerDeckName = rs.getString(8);
|
String tournament = rs.getString(8);
|
||||||
String loserDeckName = rs.getString(9);
|
String winnerDeckName = rs.getString(9);
|
||||||
Date startDate = new Date(rs.getLong(10));
|
String loserDeckName = rs.getString(10);
|
||||||
Date endDate = new Date(rs.getLong(11));
|
Date startDate = new Date(rs.getLong(11));
|
||||||
|
Date endDate = new Date(rs.getLong(12));
|
||||||
|
|
||||||
GameHistoryEntry entry = new GameHistoryEntry(winner, winReason, winRecordingId, loser, loseReason, loseRecordingId, formatName, winnerDeckName, loserDeckName, startDate, endDate);
|
GameHistoryEntry entry = new GameHistoryEntry(winner, winReason, winRecordingId, loser, loseReason, loseRecordingId, formatName, tournament, winnerDeckName, loserDeckName, startDate, endDate);
|
||||||
result.add(entry);
|
result.add(entry);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ public class GameHistoryEntry {
|
|||||||
private String _loserRecording;
|
private String _loserRecording;
|
||||||
|
|
||||||
private String _formatName;
|
private String _formatName;
|
||||||
|
private String _tournament;
|
||||||
private String _winnerDeckName;
|
private String _winnerDeckName;
|
||||||
private String _loserDeckName;
|
private String _loserDeckName;
|
||||||
|
|
||||||
private Date _startTime;
|
private Date _startTime;
|
||||||
private Date _endTime;
|
private Date _endTime;
|
||||||
|
|
||||||
public GameHistoryEntry(String winner, String winReason, String winnerRecording, String loser, String loseReason, String loserRecording, String formatName, String winnerDeckName, String loserDeckName, Date startTime, Date endTime) {
|
public GameHistoryEntry(String winner, String winReason, String winnerRecording, String loser, String loseReason, String loserRecording, String formatName, String tournament, String winnerDeckName, String loserDeckName, Date startTime, Date endTime) {
|
||||||
_winner = winner;
|
_winner = winner;
|
||||||
_winReason = winReason;
|
_winReason = winReason;
|
||||||
_winnerRecording = winnerRecording;
|
_winnerRecording = winnerRecording;
|
||||||
@@ -27,6 +28,7 @@ public class GameHistoryEntry {
|
|||||||
_loseReason = loseReason;
|
_loseReason = loseReason;
|
||||||
_loserRecording = loserRecording;
|
_loserRecording = loserRecording;
|
||||||
_formatName = formatName;
|
_formatName = formatName;
|
||||||
|
_tournament = tournament;
|
||||||
_winnerDeckName = winnerDeckName;
|
_winnerDeckName = winnerDeckName;
|
||||||
_loserDeckName = loserDeckName;
|
_loserDeckName = loserDeckName;
|
||||||
_startTime = startTime;
|
_startTime = startTime;
|
||||||
@@ -61,6 +63,10 @@ public class GameHistoryEntry {
|
|||||||
return _formatName;
|
return _formatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTournament() {
|
||||||
|
return _tournament;
|
||||||
|
}
|
||||||
|
|
||||||
public String getWinnerDeckName() {
|
public String getWinnerDeckName() {
|
||||||
return _winnerDeckName;
|
return _winnerDeckName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public class GameHistoryService {
|
|||||||
_gameHistoryDAO = gameHistoryDAO;
|
_gameHistoryDAO = gameHistoryDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGameHistory(String winner, String loser, String winReason, String loseReason, String winRecordingId, String loseRecordingId, String formatName, String winnerDeckName, String loserDeckName, Date startDate, Date endDate) {
|
public void addGameHistory(String winner, String loser, String winReason, String loseReason, String winRecordingId, String loseRecordingId, String formatName, String tournament, String winnerDeckName, String loserDeckName, Date startDate, Date endDate) {
|
||||||
_gameHistoryDAO.addGameHistory(winner, loser, winReason, loseReason, winRecordingId, loseRecordingId, formatName, winnerDeckName, loserDeckName, startDate, endDate);
|
_gameHistoryDAO.addGameHistory(winner, loser, winReason, loseReason, winRecordingId, loseRecordingId, formatName, tournament, winnerDeckName, loserDeckName, startDate, endDate);
|
||||||
Integer winnerCount = _playerGameCount.get(winner);
|
Integer winnerCount = _playerGameCount.get(winner);
|
||||||
Integer loserCount = _playerGameCount.get(loser);
|
Integer loserCount = _playerGameCount.get(loser);
|
||||||
if (winnerCount != null)
|
if (winnerCount != null)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class GameRecorder {
|
|||||||
return new InflaterInputStream(new FileInputStream(file));
|
return new InflaterInputStream(new FileInputStream(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameRecordingInProgress recordGame(LotroGameMediator lotroGame, final String formatName, final Map<String, String> deckNames) {
|
public GameRecordingInProgress recordGame(LotroGameMediator lotroGame, final String formatName, final String tournament, final Map<String, String> deckNames) {
|
||||||
final Date startData = new Date();
|
final Date startData = new Date();
|
||||||
final Map<String, GatheringParticipantCommunicationChannel> recordingChannels = new HashMap<String, GatheringParticipantCommunicationChannel>();
|
final Map<String, GatheringParticipantCommunicationChannel> recordingChannels = new HashMap<String, GatheringParticipantCommunicationChannel>();
|
||||||
for (String playerId : lotroGame.getPlayersPlaying()) {
|
for (String playerId : lotroGame.getPlayersPlaying()) {
|
||||||
@@ -61,7 +61,7 @@ public class GameRecorder {
|
|||||||
@Override
|
@Override
|
||||||
public void finishRecording(String winner, String winReason, String loser, String loseReason) {
|
public void finishRecording(String winner, String winReason, String loser, String loseReason) {
|
||||||
Map<String, String> playerRecordingId = saveRecordedChannels(recordingChannels);
|
Map<String, String> playerRecordingId = saveRecordedChannels(recordingChannels);
|
||||||
_gameHistoryService.addGameHistory(winner, loser, winReason, loseReason, playerRecordingId.get(winner), playerRecordingId.get(loser), formatName, deckNames.get(winner), deckNames.get(loser), startData, new Date());
|
_gameHistoryService.addGameHistory(winner, loser, winReason, loseReason, playerRecordingId.get(winner), playerRecordingId.get(loser), formatName, tournament, deckNames.get(winner), deckNames.get(loser), startData, new Date());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class LotroServer extends AbstractServer {
|
|||||||
return "Game" + gameId;
|
return "Game" + gameId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized String createNewGame(LotroFormat lotroFormat, LotroGameParticipant[] participants, boolean competetive) {
|
public synchronized String createNewGame(LotroFormat lotroFormat, String tournament, LotroGameParticipant[] participants, boolean competetive) {
|
||||||
if (participants.length < 2)
|
if (participants.length < 2)
|
||||||
throw new IllegalArgumentException("There has to be at least two players");
|
throw new IllegalArgumentException("There has to be at least two players");
|
||||||
final String gameId = String.valueOf(_nextGameId);
|
final String gameId = String.valueOf(_nextGameId);
|
||||||
@@ -165,7 +165,7 @@ public class LotroServer extends AbstractServer {
|
|||||||
|
|
||||||
lotroGameMediator.sendMessageToPlayers("Players in the game are: " + players.toString());
|
lotroGameMediator.sendMessageToPlayers("Players in the game are: " + players.toString());
|
||||||
|
|
||||||
final GameRecorder.GameRecordingInProgress gameRecordingInProgress = _gameRecorder.recordGame(lotroGameMediator, lotroFormat.getName(), deckNames);
|
final GameRecorder.GameRecordingInProgress gameRecordingInProgress = _gameRecorder.recordGame(lotroGameMediator, lotroFormat.getName(), tournament, deckNames);
|
||||||
lotroGameMediator.addGameResultListener(
|
lotroGameMediator.addGameResultListener(
|
||||||
new GameResultListener() {
|
new GameResultListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ public class HallServer extends AbstractServer {
|
|||||||
LotroGameParticipant[] participants = players.toArray(new LotroGameParticipant[players.size()]);
|
LotroGameParticipant[] participants = players.toArray(new LotroGameParticipant[players.size()]);
|
||||||
final League league = awaitingTable.getLeague();
|
final League league = awaitingTable.getLeague();
|
||||||
final LeagueSerieData leagueSerie = awaitingTable.getLeagueSerie();
|
final LeagueSerieData leagueSerie = awaitingTable.getLeagueSerie();
|
||||||
String gameId = _lotroServer.createNewGame(awaitingTable.getLotroFormat(), participants, league != null);
|
String gameId = _lotroServer.createNewGame(awaitingTable.getLotroFormat(), getTournamentName(awaitingTable), participants, league != null);
|
||||||
LotroGameMediator lotroGameMediator = _lotroServer.getGameById(gameId);
|
LotroGameMediator lotroGameMediator = _lotroServer.getGameById(gameId);
|
||||||
if (league != null) {
|
if (league != null) {
|
||||||
lotroGameMediator.addGameResultListener(
|
lotroGameMediator.addGameResultListener(
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ public class ServerResource extends AbstractResource {
|
|||||||
historyEntry.setAttribute("loseReason", gameHistoryEntry.getLoseReason());
|
historyEntry.setAttribute("loseReason", gameHistoryEntry.getLoseReason());
|
||||||
|
|
||||||
historyEntry.setAttribute("formatName", gameHistoryEntry.getFormatName());
|
historyEntry.setAttribute("formatName", gameHistoryEntry.getFormatName());
|
||||||
|
String tournament = gameHistoryEntry.getTournament();
|
||||||
|
if (tournament != null)
|
||||||
|
historyEntry.setAttribute("tournament", tournament);
|
||||||
|
|
||||||
if (gameHistoryEntry.getWinner().equals(resourceOwner.getName()) && gameHistoryEntry.getWinnerRecording() != null) {
|
if (gameHistoryEntry.getWinner().equals(resourceOwner.getName()) && gameHistoryEntry.getWinnerRecording() != null) {
|
||||||
historyEntry.setAttribute("gameRecordingId", gameHistoryEntry.getWinnerRecording());
|
historyEntry.setAttribute("gameRecordingId", gameHistoryEntry.getWinnerRecording());
|
||||||
@@ -196,8 +199,8 @@ public class ServerResource extends AbstractResource {
|
|||||||
} else {
|
} else {
|
||||||
sb.append("You are not logged in, log in below or <button id='clickToRegister'>register</button>.");
|
sb.append("You are not logged in, log in below or <button id='clickToRegister'>register</button>.");
|
||||||
sb.append("<div class='status'>Tables count: ").append(_hallServer.getTablesCount()).append(", players in hall: ").append(_chatServer.getChatRoom("Game Hall").getUsersInRoom().size())
|
sb.append("<div class='status'>Tables count: ").append(_hallServer.getTablesCount()).append(", players in hall: ").append(_chatServer.getChatRoom("Game Hall").getUsersInRoom().size())
|
||||||
.append(", games played in last 24 hours: unknown").append(_gameHistoryService.getGamesPlayedCountInLastMs(1000 * 60 * 60 * 24))
|
.append(", games played in last 24 hours: ").append(_gameHistoryService.getGamesPlayedCountInLastMs(1000 * 60 * 60 * 24))
|
||||||
.append(",<br/> active players in last week: unknown").append(_gameHistoryService.getActivePlayersInLastMs(1000 * 60 * 60 * 24 * 7))
|
.append(",<br/> active players in last week: ").append(_gameHistoryService.getActivePlayersInLastMs(1000 * 60 * 60 * 24 * 7))
|
||||||
.append("</div>");
|
.append("</div>");
|
||||||
sb.append(getLoginHTML());
|
sb.append(getLoginHTML());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,10 +145,10 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
if (confirm("Do you wish to save this deck?"))
|
if (confirm("Do you wish to save this deck?"))
|
||||||
that.saveDeck(false);
|
that.saveDeck(false);
|
||||||
}, {
|
}, {
|
||||||
"404": function() {
|
"404": function() {
|
||||||
alert("Couldn't find the deck to rename on the server.");
|
alert("Couldn't find the deck to rename on the server.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -244,11 +244,11 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
|
|
||||||
this.infoDialog = $("<div></div>")
|
this.infoDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
title: "Card information"
|
title: "Card information"
|
||||||
});
|
});
|
||||||
|
|
||||||
var swipeOptions = {
|
var swipeOptions = {
|
||||||
threshold: 20,
|
threshold: 20,
|
||||||
@@ -296,14 +296,14 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
if (that.deckListDialog == null) {
|
if (that.deckListDialog == null) {
|
||||||
that.deckListDialog = $("<div></div>")
|
that.deckListDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
title: "Your stored decks",
|
title: "Your stored decks",
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 400,
|
height: 400,
|
||||||
modal: true
|
modal: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
that.deckListDialog.html("");
|
that.deckListDialog.html("");
|
||||||
|
|
||||||
@@ -370,6 +370,9 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
var tar = $(event.target);
|
var tar = $(event.target);
|
||||||
|
if (tar.length == 1 && tar[0].tagName == "A")
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!this.successfulDrag && this.infoDialog.dialog("isOpen")) {
|
if (!this.successfulDrag && this.infoDialog.dialog("isOpen")) {
|
||||||
this.infoDialog.dialog("close");
|
this.infoDialog.dialog("close");
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -418,14 +421,14 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
if (this.selectionDialog == null) {
|
if (this.selectionDialog == null) {
|
||||||
this.selectionDialog = $("<div></div>")
|
this.selectionDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
title: "Choose one",
|
title: "Choose one",
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 200,
|
height: 200,
|
||||||
modal: true
|
modal: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectionGroup = new NormalCardGroup(this.selectionDialog, function(card) {
|
this.selectionGroup = new NormalCardGroup(this.selectionDialog, function(card) {
|
||||||
return true;
|
return true;
|
||||||
@@ -510,10 +513,10 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
|
|
||||||
if (card.horizontal) {
|
if (card.horizontal) {
|
||||||
// 500x360
|
// 500x360
|
||||||
this.infoDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(360 + vertSpace, windowHeight)});
|
this.infoDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(380 + vertSpace, windowHeight)});
|
||||||
} else {
|
} else {
|
||||||
// 360x500
|
// 360x500
|
||||||
this.infoDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(500 + vertSpace, windowHeight)});
|
this.infoDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(520 + vertSpace, windowHeight)});
|
||||||
}
|
}
|
||||||
this.infoDialog.dialog("open");
|
this.infoDialog.dialog("open");
|
||||||
},
|
},
|
||||||
@@ -664,10 +667,10 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
that.checkDeckStatsDirty();
|
that.checkDeckStatsDirty();
|
||||||
}, that.checkDirtyInterval);
|
}, that.checkDirtyInterval);
|
||||||
}, {
|
}, {
|
||||||
"400": function() {
|
"400": function() {
|
||||||
alert("Invalid deck for getting stats.");
|
alert("Invalid deck for getting stats.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$("#deckStats").html("Deck has no Ring, Ring-bearer or all 9 sites");
|
$("#deckStats").html("Deck has no Ring, Ring-bearer or all 9 sites");
|
||||||
setTimeout(
|
setTimeout(
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ var GameHistoryUI = Class.extend({
|
|||||||
var root = xml.documentElement;
|
var root = xml.documentElement;
|
||||||
if (root.tagName == 'gameHistory') {
|
if (root.tagName == 'gameHistory') {
|
||||||
var historyTable = $("<table class='gameHistory'></table>");
|
var historyTable = $("<table class='gameHistory'></table>");
|
||||||
historyTable.append("<tr><th>Format</th><th>Deck</th><th>Winner</th><th>Loser</th><th>Win reason</th><th>Lose reason</th><th>Finished on</th><th>Replay link</th></tr>");
|
historyTable.append("<tr><th>Format</th><th>Tournament</th><th>Deck</th><th>Winner</th><th>Loser</th><th>Win reason</th><th>Lose reason</th><th>Finished on</th><th>Replay link</th></tr>");
|
||||||
|
|
||||||
var entries = root.getElementsByTagName("historyEntry");
|
var entries = root.getElementsByTagName("historyEntry");
|
||||||
for (var i = 0; i < entries.length; i++) {
|
for (var i = 0; i < entries.length; i++) {
|
||||||
var historyEntry = entries[i];
|
var historyEntry = entries[i];
|
||||||
var format = historyEntry.getAttribute("formatName");
|
var format = historyEntry.getAttribute("formatName");
|
||||||
|
var tournament = historyEntry.getAttribute("tournament");
|
||||||
var deck = historyEntry.getAttribute("deckName");
|
var deck = historyEntry.getAttribute("deckName");
|
||||||
var winner = historyEntry.getAttribute("winner");
|
var winner = historyEntry.getAttribute("winner");
|
||||||
var loser = historyEntry.getAttribute("loser");
|
var loser = historyEntry.getAttribute("loser");
|
||||||
@@ -42,6 +43,10 @@ var GameHistoryUI = Class.extend({
|
|||||||
row.append($("<td></td>").html(format));
|
row.append($("<td></td>").html(format));
|
||||||
else
|
else
|
||||||
row.append($("<td></td>").html(" "));
|
row.append($("<td></td>").html(" "));
|
||||||
|
if (tournament != null)
|
||||||
|
row.append($("<td></td>").html(tournament));
|
||||||
|
else
|
||||||
|
row.append($("<td></td>").html(" "));
|
||||||
if (deck != null)
|
if (deck != null)
|
||||||
row.append($("<td></td>").html(deck));
|
row.append($("<td></td>").html(deck));
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -234,7 +234,9 @@ var Card = Class.extend({
|
|||||||
|
|
||||||
getWikiLink: function() {
|
getWikiLink: function() {
|
||||||
var imageUrl = this.getUrlByBlueprintId(this.blueprintId, true);
|
var imageUrl = this.getUrlByBlueprintId(this.blueprintId, true);
|
||||||
return imageUrl.substr(0, imageUrl.length - 3) + "html";
|
var afterLastSlash = imageUrl.lastIndexOf("/") + 1;
|
||||||
|
var countAfterLastSlash = imageUrl.length - 3 - afterLastSlash;
|
||||||
|
return "http://lotrtcgdb.com/pages/" + imageUrl.substr(afterLastSlash, countAfterLastSlash) + "html";
|
||||||
},
|
},
|
||||||
|
|
||||||
formatSetNo: function(setNo) {
|
formatSetNo: function(setNo) {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ var LeagueResultsUI = Class.extend({
|
|||||||
|
|
||||||
this.questionDialog = $("<div></div>")
|
this.questionDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
title: "League operation"
|
title: "League operation"
|
||||||
});
|
});
|
||||||
|
|
||||||
this.loadResults();
|
this.loadResults();
|
||||||
},
|
},
|
||||||
@@ -84,19 +84,19 @@ var LeagueResultsUI = Class.extend({
|
|||||||
tabDiv.append(tabNavigation);
|
tabDiv.append(tabNavigation);
|
||||||
|
|
||||||
// Overall tab
|
// Overall tab
|
||||||
var tabContent = $("<div id='league" + i + "overall'></div>");
|
var tabContent = $("<div id='leagueoverall'></div>");
|
||||||
|
|
||||||
var standings = league.getElementsByTagName("leagueStanding");
|
var standings = league.getElementsByTagName("leagueStanding");
|
||||||
if (standings.length > 0)
|
if (standings.length > 0)
|
||||||
tabContent.append(this.createStandingsTable(standings));
|
tabContent.append(this.createStandingsTable(standings));
|
||||||
tabDiv.append(tabContent);
|
tabDiv.append(tabContent);
|
||||||
|
|
||||||
tabNavigation.append("<li><a href='#league" + i + "overall'>Overall results</a></li>");
|
tabNavigation.append("<li><a href='#leagueoverall'>Overall results</a></li>");
|
||||||
|
|
||||||
var series = league.getElementsByTagName("serie");
|
var series = league.getElementsByTagName("serie");
|
||||||
for (var j = 0; j < series.length; j++) {
|
for (var j = 0; j < series.length; j++) {
|
||||||
|
|
||||||
var tabContent = $("<div id='league" + i + "serie" + j + "'></div>");
|
var tabContent = $("<div id='leagueserie" + j + "'></div>");
|
||||||
|
|
||||||
var serie = series[j];
|
var serie = series[j];
|
||||||
var serieName = serie.getAttribute("type");
|
var serieName = serie.getAttribute("type");
|
||||||
@@ -120,7 +120,7 @@ var LeagueResultsUI = Class.extend({
|
|||||||
tabContent.append(this.createStandingsTable(standings));
|
tabContent.append(this.createStandingsTable(standings));
|
||||||
tabDiv.append(tabContent);
|
tabDiv.append(tabContent);
|
||||||
|
|
||||||
tabNavigation.append("<li><a href='#league" + i + "serie" + j + "'>Serie " + (j + 1) + "</a></li>");
|
tabNavigation.append("<li><a href='#leagueserie" + j + "'>Serie " + (j + 1) + "</a></li>");
|
||||||
}
|
}
|
||||||
|
|
||||||
tabDiv.tabs();
|
tabDiv.tabs();
|
||||||
@@ -162,6 +162,7 @@ var LeagueResultsUI = Class.extend({
|
|||||||
$("#leagueResults").append(detailsBut);
|
$("#leagueResults").append(detailsBut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#leagueResults").append("<hr />");
|
||||||
$("#leagueResults").append("<div id='leagueExtraInfo'></div>");
|
$("#leagueResults").append("<div id='leagueExtraInfo'></div>");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,20 +70,20 @@ var GempLotrMerchantUI = Class.extend({
|
|||||||
|
|
||||||
this.infoDialog = $("<div></div>")
|
this.infoDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
title: "Card information"
|
title: "Card information"
|
||||||
});
|
});
|
||||||
|
|
||||||
this.questionDialog = $("<div></div>")
|
this.questionDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
title: "Merchant operation"
|
title: "Merchant operation"
|
||||||
});
|
});
|
||||||
|
|
||||||
var swipeOptions = {
|
var swipeOptions = {
|
||||||
threshold: 20,
|
threshold: 20,
|
||||||
@@ -155,6 +155,9 @@ var GempLotrMerchantUI = Class.extend({
|
|||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
var tar = $(event.target);
|
var tar = $(event.target);
|
||||||
|
if (tar.length == 1 && tar[0].tagName == "A")
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!this.successfulDrag && this.infoDialog.dialog("isOpen")) {
|
if (!this.successfulDrag && this.infoDialog.dialog("isOpen")) {
|
||||||
this.infoDialog.dialog("close");
|
this.infoDialog.dialog("close");
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -193,10 +196,10 @@ var GempLotrMerchantUI = Class.extend({
|
|||||||
|
|
||||||
if (card.horizontal) {
|
if (card.horizontal) {
|
||||||
// 500x360
|
// 500x360
|
||||||
this.infoDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(360 + vertSpace, windowHeight)});
|
this.infoDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(380 + vertSpace, windowHeight)});
|
||||||
} else {
|
} else {
|
||||||
// 360x500
|
// 360x500
|
||||||
this.infoDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(500 + vertSpace, windowHeight)});
|
this.infoDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(520 + vertSpace, windowHeight)});
|
||||||
}
|
}
|
||||||
this.infoDialog.dialog("open");
|
this.infoDialog.dialog("open");
|
||||||
},
|
},
|
||||||
@@ -322,10 +325,10 @@ var GempLotrMerchantUI = Class.extend({
|
|||||||
|
|
||||||
if (card.horizontal) {
|
if (card.horizontal) {
|
||||||
// 500x360
|
// 500x360
|
||||||
this.questionDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(360 + vertSpace, windowHeight)});
|
this.questionDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(380 + vertSpace, windowHeight)});
|
||||||
} else {
|
} else {
|
||||||
// 360x500
|
// 360x500
|
||||||
this.questionDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(500 + vertSpace, windowHeight)});
|
this.questionDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(520 + vertSpace, windowHeight)});
|
||||||
}
|
}
|
||||||
this.questionDialog.dialog("open");
|
this.questionDialog.dialog("open");
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user