summaryrefslogtreecommitdiff
path: root/http/dealconvert.js
diff options
context:
space:
mode:
Diffstat (limited to 'http/dealconvert.js')
-rw-r--r--http/dealconvert.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/http/dealconvert.js b/http/dealconvert.js
index ff25444..e038b58 100644
--- a/http/dealconvert.js
+++ b/http/dealconvert.js
@@ -52,9 +52,9 @@ $(document).ready(function() {
var warningTemplate = $('template#file-output-warning');
var errorTemplate = $('template#file-output-error');
var fileTemplate = $('template#file-output');
- var inputHeader = outputGroup.find('.card-header');
+ var inputHeader = outputGroup.find('.file-header');
inputHeader.text(data.name);
- var groupBody = outputGroup.find('.card-body');
+ var groupBody = outputGroup.find('.file-body');
if (data.error) {
inputHeader.addClass('bg-danger');
groupBody.append(errorTemplate.clone().contents().unwrap().text(data.error));
@@ -94,6 +94,24 @@ $(document).ready(function() {
);
}
}
+ if (data.preview) {
+ var boardTemplate = $('#board-preview');
+ var hands = ['north', 'east', 'south', 'west'];
+ var suits = ['spades', 'hearts', 'diamonds', 'clubs'];
+ for (var b = 0; b < data.preview.length; b++) {
+ var board = boardTemplate.clone().contents().unwrap();
+ board.find('.board-number').text(data.preview[b].number);
+ board.find('.board-conditions').attr('src', 'img/' + data.preview[b].conditions + '.png');
+ for (var h = 0; h < hands.length; h++) {
+ for (var s = 0; s < suits.length; s++) {
+ board.find('.board-' + hands[h] + '-' + suits[s]).text(data.preview[b].hands[h][s].join(''));
+ }
+ }
+ outputGroup.find('.file-boards-panel .board-body').append(board);
+ }
+ } else {
+ outputGroup.find('.file-boards-panel').remove();
+ }
}
$('body').append(outputGroup);
completed += 1;