-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlbtable.html
752 lines (577 loc) · 22.6 KB
/
lbtable.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap2/bootstrap-switch.min.css" />
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.2/css/buttons.dataTables.min.css" />
<script src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/buttons.colVis.min.js"></script>
<style>
.leftBorder {
border-left: 1px solid #ccc;
}
.top {
color:grey;
}
.highlight {
background-color: red;
}
table.dataTable tbody td {
padding: 4px 5px;
font-size: 14px;
}
table.dataTable thead th, table.dataTable thead td {
padding: 10px 12px;
border-bottom: 1px solid #111;
font-size: 14px;
}
table.dataTable.display tbody tr:hover {
background-color: #DFF0D8;
}
.loading {
width: 200px;
height: 200px;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
</style>
<script>
var teamLeaderboard = ['Highway11','Crust','xorrbit','Armand9x','vayerlaze'];
var pilotsToHighlight = [];
var maps = ["gates-of-hell-shipyard","gates-of-hell-woods","gates-of-hell-city","gates-of-hell","miami-lights","lapocalypse","bell-labs","ohio-crash-site","detroit","bud-light-2017-tryouts"];
var tryoutMaps = ["gates-of-hell","miami-lights","lapocalypse","bell-labs"];
var colors = ["#4EC2F7","#F77B71","#EF6191","#B967C7","#7884CB","#81C784","#FFB64C","#F44336","#E91E63","#3F51B5","#2196F3","#03A9F4","#00BCD4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548","#607D8B"];
//var colors = ["#F44336","#E91E63","#E91E63","#673AB7","#3F51B5","#2196F3","#03A9F4","#00BCD4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548","#607D8B"];
var mapsRetrieved = 0;
var allTables = "";
var pilots = {};
var cumulativePilots = [];
var fpvChatPilots = [];
var slackObject;
var columnToSort = 16;
var iconUrl = "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-08-15/69701088597_b8b48e4eca2e7472d1ff_88.jpg";
function getQueryString () {
var ret = {};
if (document.location.toString().indexOf("?") > 0)
{
var parts = (document.location.toString().split('?')[1]).split('&');
for (var i = 0; i < parts.length; i++) {
var p = parts[i].split('=');
// so strings will be correctly parsed:
p[1] = decodeURIComponent(p[1].replace(/\+/g, " "));
if (p[0].search(/\[\]/) >= 0) { // then it's an array
p[0] = p[0].replace('[]','');
if (typeof ret[p[0]] != 'object') ret[p[0]] = [];
ret[p[0]].push(p[1]);
} else {
ret[p[0]] = p[1];
}
}
return ret;
}
else
{
return false;
}
}
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = encodeURIComponent(name) + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
}
function getTime(value) {
time = 999999999 - parseInt(value)
return (time);
}
function msToTime(s) {
var ms = s % 1000;
s = (s - ms) / 1000;
var secs = s % 60;
s = (s - secs) / 60;
var mins = s % 60;
var hrs = (s - mins) / 60;
return mins + ':' + ("00" + secs).substr(-2,2) + '.' + ('00' + ms).slice(-3);
}
function convertMinutesToMs(time){
var timeArr = time.split(':');
timeArr[0] = (timeArr[0]) ? parseInt(timeArr[0]) * 60000 : 0;
timeArr[1] = (timeArr[1]) ? parseInt(timeArr[1]) * 1000 : 0;
return timeArr[0] + timeArr[1];
}
function calculateTryoutAverages(method) {
pilotName = readCookie("pilotsCookie");
totalTime = 0;
if (method == "1")
{
inputField = "tryout";
outputField = "average";
}
if (method == "4")
{
inputField = "average";
outputField = "tryout";
}
tryoutMaps.forEach(function (map) {
//calculate average
time = convertMinutesToMs($('#' + map + '-' + inputField + '-time').val());
if (method == "1")
{
calculatedTime = time / 4;
averageTime = calculatedTime;
totalTime += time;
}
if (method == "4")
{
calculatedTime = time * 4;
averageTime = time;
totalTime += calculatedTime;
}
time = msToTime(calculatedTime);
time = time.substr(0,time.length - 4);
$('#' + map + '-' + outputField + '-time').val(time);
//calculate +/- from best
bestTime = pilots[pilotName][map]["time"];
bestTime = convertMinutesToMs(bestTime.substr(0,bestTime.length -4)) + parseInt(bestTime.slice(-3));
//console.log("Average Time " + map);
//console.log(averageTime);
//console.log("Best Time " + map);
//console.log(bestTime);
plusMinus = msToTime(averageTime - bestTime);
$('#' + map + '-best-time').val(plusMinus.slice(2));
});
totalTime = msToTime(totalTime);
totalTime = totalTime.substr(0,totalTime.length - 4);
$('#total-tryout-time').html(totalTime);
}
function isWinnipegFPV(nameToCheck) {
//check to see if this leaderboard entry is part of the local leaderboard
isTeamMember = false;
teamLeaderboard.forEach(function (name) {
if (name == nameToCheck)
{
isTeamMember = true;
}
});
return isTeamMember;
}
function isPilotToHighlight(nameToCheck) {
//check to see if this leaderboard entry is part of the local leaderboard
isTeamMember = false;
pilotsToHighlight.forEach(function (name) {
if (name.toLowerCase() == nameToCheck.toLowerCase())
{
isTeamMember = true;
}
});
return isTeamMember;
}
function isFpvChatMember(nameToCheck) {
//check to see if this leaderboard entry is part of the local leaderboard
isTeamMember = false;
fpvChatPilots.forEach(function (member) {
if (member["name"].toLowerCase() == nameToCheck.toLowerCase())
{
isTeamMember = true;
}
});
return isTeamMember;
}
function getSlackMembers() {
url = "http://winnipegfpv.club/drl/users.py";
$.getJSON( url, function( data )
{
fpvChatPilots = data['members'];
generateCumulativeLeaderboard();
generateTable();
var dataTable = $('#table').dataTable({
dom: 'Bfrtip',
extend: 'collection',
buttons: [
{ extend: 'columnsToggle', columns: '.myColumns' }, // will be expanded to individual buttons
{ extend: 'columnToggle', text:'GoH Shipyard', columns:'.gates-of-hell-shipyard' }, // single button grouped
{ extend: 'columnToggle', text:'GoH Woods', columns:'.gates-of-hell-woods' }, // single button grouped
{ extend: 'columnToggle', text:'GoH City', columns:'.gates-of-hell-city' }, // single button grouped
{ extend: 'columnToggle', text:'Gates Of Hell', columns:'.gates-of-hell' }, // single button grouped
{ extend: 'columnToggle', text:'Miami Lights', columns:'.miami-lights' }, // single button grouped
{ extend: 'columnToggle', text:'Lapocalypse', columns:'.lapocalypse' }, // single button grouped
{ extend: 'columnToggle', text:'Bell Labs', columns:'.bell-labs' }, // single button grouped
{ extend: 'columnToggle', text:'Ohio Crash Site', columns:'.ohio-crash-site' }, // single button grouped
{ extend: 'columnToggle', text:'Detroit', columns:'.detroit' }, // single button grouped
{ extend: 'columnToggle', text:'Bud Light 2017 Tryouts', columns:'.bud-light-2017-tryouts' }, // single button grouped
{ extend: 'columnToggle', text:'Cumulative', columns:'.cumulative' } // single button grouped
],
paging: false,
columnDefs: [
{ targets: [2,3,5,6,8,9,11,12,14,15,17,18,20,21,23,24,26,27,29,30,32], orderable: false }
],
aaSorting: [[columnToSort, 'asc']],
createdRow: function (row, data, index) {
//
// if the second column cell is blank apply special formatting
//
if (data[0] == "Nytfury") {
console.dir(row);
$(row).removeClass('odd').removeClass('even').addClass("highlight");
}
}
});
var input = $(".dataTables_filter input");
input.unbind('keyup search input').bind('keypress', function (e) {
//if (e.which == 13) {
var keywords = input.val().split(' '), filter ='';
for (var i=0; i<keywords.length; i++) {
filter = (filter!=='') ? filter+'|'+keywords[i] : keywords[i];
}
dataTable.fnFilter(filter, null, true, false, true, true);
//}
});
$("#total-pilots").html(Object.keys(pilots).length + " pilots" );
$("#cumulative-total-entries").html(cumulativePilots.length + " pilots");
$('#loading').hide();
$('#table').show();
//set inputs from cookie values
$("#pilotsCookie").val(readCookie("pilotsCookie"));
$('#mapCookie option[value=' + readCookie("mapCookie") + ']').prop('selected', true);
tryoutMaps.forEach(function (map) {
$('#' + map + '-tryout-time').val(readCookie(map + 'Cookie'));
});
//calculateTryoutAverages("1");
});
}
function convertMapToTitle(map) {
//capitalize first letter of each word
title = map.toLowerCase().replace(/\b[a-z]/g, function(letter) {
return letter.toUpperCase();
});
//replace - with a space
title = title.replace(/-/g, ' ');
return title;
}
function generateCumulativeLeaderboard() {
//create array of all pilots that have completed 4 maps
$.each(pilots, function( index, value ) {
//console.log( index + ": " + value["mapCount"] );
if (value.mapCount == 9)
{
cumulativePilots.push({name:index, cumulativeTime:value.cumulativeTime});
}
});
//sort array of pilots by time
cumulativePilots.sort(function(a, b) {
return parseFloat(a.cumulativeTime) - parseFloat(b.cumulativeTime);
});
teamMemberCount = 0;
count = 1;
entries = [];
//generate table row for each pilot
cumulativePilots.forEach( function (item)
{
pilots[item.name]["cumulativeRank"] = count;
count += 1;
});
}
function generateTableHeader() {
tableHeader1 = "<tr><th rowspan=2>Name<div style='color:#777;font-size:12px;font-style:italic;float:right;margin-right:10px;' id='total-pilots'></div></th>";
tableHeader2 = "<tr>";
count = 0;
maps.forEach(function (map) {
tableHeader1 += "<th colspan=3 class='leftBorder' style='color:" + colors[count] + "'>" + convertMapToTitle(map) + "<div style='color:#777;font-size:12px;font-style:italic;float:right;margin-right:2px;' id='" + map + "-total-entries'></div></th>";
tableHeader2 += "<th class='leftBorder " + map + "'>Rank</th><th class='" + map + "'>Time</th><th class='" + map + "'>Top</th>";
count += 1;
});
tableHeader1 += "<th colspan=2 class='leftBorder'>Cumulative (9 map total)<div style='color:#777;font-size:12px;font-style:italic;float:right;margin-right:2px;' id='cumulative-total-entries'></div></tr>";
tableHeader2 += "<th class='leftBorder cumulative'>Rank</th><th class='cumulative'>Time</th>";
//tableHeader2 += "<th class='cumulative'>Potential Tryout</th>";
tableHeader2 += "</tr>";
$('#header').html(tableHeader1 + tableHeader2);
}
function generateTable() {
rows = [];
$.each(pilots, function( name, pilot ) {
//console.log(name);
rowStyle = "";
//rowStyle = "background:#f2dede";
if (isPilotToHighlight(name))
{
rowStyle = "background:#f2dede";
}
if (isFpvChatMember(name)) {
tableRow = "<tr style='" + rowStyle + "'><td >" + "<img src='" + iconUrl + "' style='height:20px'> " + name + "</td>" ;
}
else
{
tableRow = "<tr style='" + rowStyle + "'><td>" + name + "</td>" ;
}
count = 0;
maps.forEach(function (map) {
if (pilot[map]) {
tableRow += "<td class='leftBorder' style='color:" + colors[count] + "'> " + pilot[map]["rank"] + "<td>" + pilot[map]["time"] + "<td class='top'>" + pilot[map]["percentRank"] + "%</td>";
}
else
{
tableRow += "<td class='leftBorder'><span style='opacity:.001'>9999</style></td><td> <td> ";
}
count += 1;
});
if (pilot['mapCount'] == 9)
{
tableRow += "<td class='leftBorder'>" + pilot.cumulativeRank + "<td>" + msToTime(pilot.cumulativeTime) + "</td>";
//tableRow += "<td>" + msToTime(pilot.cumulativeTime * 6) ;
}
else
{
tableRow += "<td class='leftBorder'><span style='opacity:.001'>99999</span></td><td> </td>";
//tableRow += "<td> </td>";
}
tableRow += "</tr>";
rows.push(tableRow);
});
$('#pilots').html(rows.join(""));
$('#pilots-total-entries' ).html("" + count + " pilots");
}
$( document ).ready(function() {
if (readCookie("pilotsCookie") != null)
{
pilotsToHighlight = readCookie("pilotsCookie").split(" ");
}
if (readCookie("mapCookie") != null)
{
columnToSort = readCookie("mapCookie");
}
generateTableHeader();
//retrieve leaderboard json for each map
maps.forEach(function (map) {
var teamMemberCount = 0;
var entries = [];
url = "http://winnipegfpv.club/drl/drlol.py?map=" + map;
$.getJSON( url, function( data )
{
obj = data;
totalEntries = obj["data"]["Leaderboard"].length;
obj["data"]["Leaderboard"].forEach( function (item)
{
rank = (parseInt(item.Position) + 1);
percentRank = parseInt(((1 - ((totalEntries - rank) / totalEntries)) * 100));
if (isWinnipegFPV(item.DisplayName))
{
teamMemberCount += 1;
tableRow = "<tr class = 'success local-" + map + "'><td>" + teamMemberCount;
}
else
{
tableRow = "<tr class='global-" + map + "' style='display:none'><td> ";
}
pilotName = item.DisplayName;
//handle entries with no pilot name
if (typeof(item.DisplayName) === "undefined")
{
//console.log(item.PlayFabId);
pilotName = map + "-pilot" + rank;
}
//add this pilot to the hash if they are not already in it
if (typeof(pilots[pilotName]) === "undefined")
{
pilots[pilotName] = {};
}
pilots[pilotName][map] = {};
pilots[pilotName][map]["time"] = msToTime(getTime(item.StatValue));
pilots[pilotName][map]["rank"] = rank;
pilots[pilotName][map]["percentRank"] = percentRank;
//add all times to cumulative leaderboard (except campaign and bud-light-2017 and ohio-crash-site)
if (map != 'campaign' && map != 'bud-light-2017-tryouts')
{
if (pilots[pilotName]["mapCount"])
{
pilots[pilotName]["mapCount"] += 1;
pilots[pilotName]["cumulativeTime"] += getTime(item.StatValue);
}
else
{
pilots[pilotName]["mapCount"] = 1;
pilots[pilotName]["cumulativeTime"] = getTime(item.StatValue);
}
}
//tableRow += " <td> " + rank + "<td>" + percentRank + "%<td>" + item.DisplayName + "<td>" + msToTime(getTime(item.StatValue)) + "</tr>";
//entries.push( tableRow );
});
//add the table rows to the table for this map
//$('#' + map ).html(entries.join(""));
$('#' + map + '-total-entries' ).html("" + totalEntries + " pilots");
//$('#loading-' + map ).hide();
//generate cumulative leaderboard once all map leaderboards have been generated
mapsRetrieved += 1;
if (mapsRetrieved == maps.length)
{
getSlackMembers();
}
});
});
});
</script>
<body>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal" style="margin-left:10px;margin:10px">My Leaderboard Settings</button>
<div id='loading' class='loading'>Loading Leaderboard <img src='https://i1.wp.com/cdnjs.cloudflare.com/ajax/libs/galleriffic/2.0.1/css/loader.gif'></div>
<table class='display order-column table-condensed' style='display:none;' id='table'>
<thead id='header'></thead>
<tbody id='pilots'>
</tbody>
</table>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">My Leaderboard Settings</h4>
</div>
<div class="modal-body">
<form>
<div class="row">
<div class='col-md-12 clearfix'>
<div class="form-group">
<label for='pilotsCookie' >Pilot(s) To Highlight</label>
<input class='form-control col-md-12' id='pilotsCookie'>
<p class="help-block">add multiple pilots by seperating names with a space</p>
</div>
<div class="form-group">
<label for='mapCookie'>Default Map To Sort By</label>
<select class='form-control' id='mapCookie'>
<option value='1'>GoH Shipyard </option>
<option value='4'>GoH Woods</option>
<option value='7'>GoH City</option>
<option value='10'>Gates Of Hell</option>
<option value'13'>Miami Lights</option>
<option value='16'>Lapocalypse</option>
<option value='19'>Bell Labs</option>
<option value='22'>Ohio Crash Site</option>
<option value='25'>Detroit</option>
<option value='28'>Bud Light 2017 Tryouts</option>
<option value='31'>Cumulative</option>
</select>
</div>
</div>
</div>
<!--
<div class="row">
<div class='col-sm-4 clearfix'>
<h4>4 Heat Times</h4>
<div class="form-group">
<label for='gates-of-hell-tryout-time' >Gates Of Hell</label>
<input class='form-control col-md-12' id='gates-of-hell-tryout-time' placeholder="00:00">
</div>
<div class="form-group">
<label for='miami-lights-tryout-time' >Miami Lights</label>
<input class='form-control col-md-12' id='miami-lights-tryout-time' placeholder='00:00'>
</div>
<div class="form-group">
<label for='lapocalypse-tryout-time' >Lapocalypse</label>
<input class='form-control col-md-12' id='lapocalypse-tryout-time' placeholder='00:00'>
</div>
<div class="form-group">
<label for='bell-labs-tryout-time' >Bell Labs</label>
<input class='form-control col-md-12' id='bell-labs-tryout-time' placeholder='00:00'>
</div>
<br>
<div class="form-group">
<button type="button" class="btn btn-info" id='calculate-button' onClick='calculateTryoutAverages("1")' style='margin-top:10px' >Calculate 1 Heat Time ></button>
</div>
</div>
<div class='col-sm-4 clearfix'>
<h4>Average 1 Heat Time</h4>
<div class="form-group">
<label for='gates-of-hell-average-time' >Gates Of Hell</label>
<input class='form-control col-md-12' id='gates-of-hell-average-time' >
</div>
<div class="form-group">
<label for='miami-lights-average-time' >Miami Lights</label>
<input class='form-control col-md-12' id='miami-lights-average-time' >
</div>
<div class="form-group">
<label for='lapocalypse-average-time' >Lapocalypse</label>
<input class='form-control col-md-12' id='lapocalypse-average-time' >
</div>
<div class="form-group">
<label for='bell-labs-average-time' >Bell Labs</label>
<input class='form-control col-md-12' id='bell-labs-average-time' >
</div>
<br>
<div class="form-group">
<button type="button" class="btn btn-info" id='calculate-button' onClick='calculateTryoutAverages("4")' style='margin-top:10px' > < Calculate 4 Heat Time</button>
</div>
</div>
<div class='col-sm-4 clearfix'>
<h4>Best Time +/-</h4>
<div class="form-group">
<label for='gates-of-hell-best-time' >Gates Of Hell</label>
<input class='form-control col-md-12' id='gates-of-hell-best-time' readonly>
</div>
<div class="form-group">
<label for='miami-lights-best-time' >Miami Lights</label>
<input class='form-control col-md-12' id='miami-lights-best-time' readonly>
</div>
<div class="form-group">
<label for='lapocalypse-best-time' >Lapocalypse</label>
<input class='form-control col-md-12' id='lapocalypse-best-time' readonly>
</div>
<div class="form-group">
<label for='bell-labs-best-time' >Bell Labs</label>
<input class='form-control col-md-12' id='bell-labs-best-time' readonly>
</div>
<div class="form-group" style="margin-top:50px;">
Total: <span class="badge" id='total-tryout-time'></span>
</div>
</div>
</div>
-->
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" id='save-cookie-button' data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
$( "#save-cookie-button" ).click(function() {
createCookie('pilotsCookie',$("#pilotsCookie").val(),100);
createCookie('mapCookie',$("#mapCookie").val(),100);
//tryoutMaps.forEach(function (map) {
// createCookie(map + 'Cookie',$('#' + map + '-tryout-time').val(),100);
//
//});
location.reload();
});
</script>