-
Notifications
You must be signed in to change notification settings - Fork 0
/
handVisualizer.html
123 lines (93 loc) · 3.54 KB
/
handVisualizer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hand Visualizer</title>
</head>
<body>
<h1>Paste your hand history here</h1>
<textarea id="hand"></textarea>
<button onclick="visualize(handParser(document.getElementById('hand').value));">
Submit
</button>
<script src="parser.js"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script>
var visualize = function(parsedHand){
var $container = $("<section>");
var $players = $("<ul>", {id: "players"});
var $player;
var $preflop = $("<ul>", {id: "preflop"});
var $preflopPlayer;
var $flop = $("<ul>", {id: "flop"});
var $flopActions;
var $flopCard;
var $turn = $("<ul>", {id: "turn"});
var $turnCard = $("<li>").html(parsedHand.flop[0]+parsedHand.flop[1]+parsedHand.flop[2]+parsedHand.turn);
$turn.append($turnCard);
var $turnActions = $("<ul>", {id: "turnActions"});
var $turnAction;
var $river = $("<ul>", {id: "river"});
var $riverCard = $("<li>").html(parsedHand.flop[0]+parsedHand.flop[1]+parsedHand.flop[2]+parsedHand.river);
$river.append($riverCard);
var $riverActions = $("<ul>", {id: "riverActions"});
var $riverAction;
for(var i = 0; i < parsedHand.players.length; i++){
$player = $("<li>");
$player.html(parsedHand.players[i][0] + ": " + parsedHand.players[i][1]);
$players.append($player);
}
for(var j = 0; j < parsedHand.preFlopActions.length; j++){
$preflopPlayer = $("<li>");
$preflopPlayer.html(parsedHand.preFlopActions[j]);
$preflop.append($preflopPlayer);
}
for(var j = 0; j < parsedHand.flop.length; j++){
$flopCard = $("<li>");
$flopCard.html(parsedHand.flop[j]);
$flop.append($flopCard);
}
for(var j = 0; j < parsedHand.flopActions.length; j++){
$flopCard = $("<li>");
$flopCard.html(parsedHand.flopActions[j]);
$flop.append($flopCard);
}
for(var j = 0; j < parsedHand.turnActions.length; j++){
$turnAction = $("<li>");
$turnAction.html(parsedHand.turnActions[j]);
$turn.append($turnAction);
}
for(var j = 0; j < parsedHand.riverActions.length; j++){
$riverAction = $("<li>");
$riverAction.html(parsedHand.riverActions[j]);
$river.append($riverAction);
}
$turn.append($turnActions);
$preflop.prepend('<h2>Preflop</h2>');
$players.prepend('<h2>Jogadores</h2>');
$flop.prepend('<h2>Flop</h2>');
$turn.prepend('<h2>Turn</h2>');
$river.prepend('<h2>River</h2>');
$container.append($flop);
$container.append($flop);
$container.append($players);
$container.append($preflop);
$container.append($turn);
$container.append($river);
$container.append("<h2>Mão</h2>");
if(parsedHand.gameStyle == "Hold'em No Limit"){
$container.append("<div class'hand'>" + parsedHand.hands[0][0] + parsedHand.hands[0][1] + "</div>");
} else {
$container.append("<div class'hand'>" + parsedHand.hands[0][0] + parsedHand.hands[0][1] + parsedHand.hands[0][2] + parsedHand.hands[0][3]+"</div>");
}
// // actions preflop
// var actions = "";
// for(var i = 0; i < parsedHand.preFlopActions.length; i++){
// actions += parsedHand.preFlopActions[i] + ", ";
// }
// $container.append("<div>" + actions + "</div>");
$("body").append($container);
};
</script>
</body>
</html>