-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
858 lines (797 loc) · 45.1 KB
/
index.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
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>FIFA 2018</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<style>
/* The slider itself */
.slider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 100%; /* Full-width */
height: 25px; /* Specified height */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}
/* Mouse-over effects */
.slider:hover {
opacity: 1; /* Fully shown on mouse-over */
}
/* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */
.slider::-webkit-slider-thumb {
-webkit-appearance: none; /* Override default look */
appearance: none;
width: 25px; /* Set a specific slider handle width */
height: 25px; /* Slider handle height */
background: url('./images/football.ico');
background-repeat:no-repeat;
background-size:cover;
cursor: pointer; /* Cursor on hover */
}
.slider::-moz-range-thumb {
width: 25px; /* Set a specific slider handle width */
height: 25px; /* Slider handle height */
background: url('./images/football.ico');
background-repeat:no-repeat;
background-size:cover;
cursor: pointer; /* Cursor on hover */
}
.input-group-text{
width:7rem;
}
.hcenter{
margin-right:auto;margin-left:auto;
}
.vcenter{
margin-top:auto;margin-bottom:auto;
}
.enlight :hover{
background:#cccccc
}
.alertmsg{
position:fixed;
margin-top:20%;
margin-left:20%;
margin-right:20%;
width:60%;
z-index:999;
}
.notifymsg{
position:fixed;
margin-top:20%;
margin-left:20%;
margin-right:20%;
width:60%;
z-index:999;
}
</style>
<script src="js/eos.js"></script>
<script src="js/eosmod.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script>
function alert(msg){
$(".alert").remove();
var alert = '<div class="alert bg-danger text-light alertmsg" role="alert"><h5>' + msg + '</h5></div>';
$(alert).prependTo('body').show().delay(3000).fadeOut();
}
function notify(msg){
$(".alert").remove();
var notify = '<div class="alert bg-success text-light notifymsg" role="alert"><h5>' + msg + '</h5></div>';
$(notify).prependTo('body').show().delay(3000).fadeOut();
}
var confServer, confAccount, confKey, confCoreSymbol="EOS";
var allEosMatches = null;
function onPage(page){
$("#id_account_page").hide();
$("#id_bet_page").hide();
$("#id_bet_link").removeClass("active");
$("#id_account_link").removeClass("active");
$("#id_" + page + "_page").show();
$("#id_" + page + "_link").addClass("active");
}
function onSave(){
confServer = $("#id_server").val();
if(confServer == ""){
alert("Server invalid!");
return
}
confAccount = $("#id_account").val();
if(confAccount == ""){
alert("Account invalid!");
return
}
confKey = $("#id_active_key").val();
if(confAccount == ""){
alert("Activ key invalid!");
return
}
loadMatches(confServer).then(function(e){
notify("Connect to server ok, and your configuration is saved!");
localStorage.setItem("server", confServer);
localStorage.setItem("account", confAccount);
localStorage.setItem("active_key", confKey);
allEosMatches = e.rows;
buildMatchList();
updateCredit();
updateStats();
}).catch(function(e){
alert("Can not access server, check your configuration please!");
console.log("->" + e);
});
}
function buildMatchList(){
var matchList = $('#id_match_list');
matchList.empty();
$.each(allEosMatches, function(index, match){
var item =$('<div id="id_match'+match.matchid+'_row" class="row">' +/* id_matchxx_row */
'<div class="col-6">' +
'<div class="row text-center"><span class="text-center vcenter hcenter col-6" id="id_match' + match.matchid + '_date"></span><strong class="col-6 text-danger text-right" id="id_match' + match.matchid + '_disabled"></strong></div>' +/* id_matchxx_date */
'<div class="row text-center"><strong class="text-center vcenter hcenter" id="id_match' + match.matchid + '_desc"></strong></div>' +/* id_matchxx_desc */
'<div class="row">' +
'<h2 id="id_match'+match.matchid+'_score" class="text-center vcenter hcenter"></h2>' +/* id_matchxx_score */
'</div>' +
'</div>' +
'<div class="container col-6">' +
'<div class="row">' +
'<div class="col-6"><h6 id="id_match' + match.matchid +'_lTeam"></h6></div>' +/* id_matchxx_lTeam */
'<div class="col-6"><h6 id="id_match' + match.matchid +'_rTeam"></h6></div>' +/* id_matchxx_rTeam */
'</div>' +
'<div class="row">' +
'<div class="col-6"><img id="id_match' + match.matchid + '_lTeam_img" style="width:40px;height:25px" src=""></div>' +/* id_matchxx_lTeam_img */
'<div class="col-6"><img id="id_match' + match.matchid + '_rTeam_img" style="width:40px;height:25px" src=""></div>' +/* id_matchxx_rTeam_img */
'</div>' +
'</div>' +
'</div>');
item.find("#id_match" + match.matchid + "_row").attr("matchid",match.matchid);
var lTeam = allTeams.get(match.lTeam);
var rTeam = allTeams.get(match.rTeam);
var lSrc = "./teams/"+match.lTeam+".png";
var rSrc = "./teams/"+match.rTeam+".png";
var lWidth = "40px";
var rWidth = "40px";
if(lTeam == undefined){
//console.log("lTeam undefined for " + match.lTeam);
lTeam = match.lTeam;
lSrc = "./images/football.png";
lWidth = "25px";
item.find("#id_match" + match.matchid + "_lTeam").html(lTeam).attr("lTeamCn",match.lTeam);
}else{
//console.log("lTeam -> " + match.lTeam + lTeam);
item.find("#id_match" + match.matchid + "_lTeam").html(lTeam).attr("lTeamCn",lTeam);
lTeam = match.lTeam + "<br/>" + lTeam;
}
if(rTeam == undefined){
//console.log("rTeam undefined for " + match.rTeam);
rTeam = match.rTeam;
rSrc = "./images/football.png";
rWidth = "25px";
item.find("#id_match" + match.matchid + "_rTeam").html(rTeam).attr("rTeamCn",match.rTeam);
}else{
//console.log("rTeam -> " + match.rTeam + rTeam);
item.find("#id_match" + match.matchid + "_rTeam").html(rTeam).attr("rTeamCn",rTeam);
rTeam = match.rTeam + "<br/>" + rTeam;
}
item.find("#id_match" + match.matchid + "_lTeam").html(lTeam).attr("lTeamEn",match.lTeam);
item.find("#id_match" + match.matchid + "_rTeam").html(rTeam).attr("rTeamEn",match.rTeam);
item.find("#id_match" + match.matchid + "_lTeam_img").attr("src", lSrc).css("width",lWidth);
item.find("#id_match" + match.matchid + "_rTeam_img").attr("src", rSrc).css("width",rWidth);
var tm = new Date();
tm.setTime(match.tmBegin * 1000);
var minStr = tm.getMinutes();
if(minStr == "0"){
minStr = "00";
}
var tmStr = "" + tm.getFullYear() + "-" + (1 + tm.getMonth()) + "-" + tm.getDate() + " " + tm.getHours() + ":" + minStr;
item.find("#id_match" + match.matchid + "_date").text(tmStr);
item.find("#id_match" + match.matchid + "_desc").text(match.desc);
if(match.lScore >= 0 && match.rScore >= 0){
item.find("#id_match" + match.matchid + "_score").text("" + match.lScore + " : " + match.rScore);
}else{
item.find("#id_match" + match.matchid + "_score").text("-- : --");
}
var allowBet = true;
var tmNow = new Date();
//console.log("" + match.lTeam + ":" + match.rTeam + " - " + match.matchid + " tmBegin : " + match.tmBegin + ", now:" + (tmNow.getTime()/1000));
if(match.status == 1 && match.tmBegin >= tmNow.getTime()/1000 + 60 * 10){/* not freezed and 10 mins before game */
if(index % 2 == 0){
item.css("background-color","#f8ffff");
}else{
item.css("background-color","#fffff8");
}
item.addClass("enlight");
}else{
allowBet = false;
item.css("background-color","#dddddd");
item.find("#id_match" + match.matchid + "_disabled").text("bet freezed");
}
item.children("*").unbind().click(function(mid, allow, lt, rt, ls, rs, lw, rw){
return function(){
setupOverview(mid);
setupMyBet(mid, allow);
updateCredit();
updateStats();
console.log("lt -> " + lt);
console.log("rt -> " + rt);
$("#id_bet_overview_title div:eq(0) h4").html(lt);
$("#id_bet_overview_title div:eq(3) h4").html(rt);
$("#id_bet_overview_title div:eq(1) img").attr("src",ls).css("width", lw);
$("#id_bet_overview_title div:eq(2) img").attr("src",rs).css("width", rw);
$("#id_mybet_title").text("Bet of "+ confAccount);
}
}(match.matchid, allowBet, lTeam, rTeam, lSrc, rSrc, lWidth, rWidth));
matchList.append(item);
});
}
function mytrim(str){
if(confCoreSymbol == 'SYS'){
return str.replace(/ SYS/, "");
}else if (confCoreSymbol == 'EOS'){
return str.replace(/ EOS/, "");
}else{
console.log("core symbol '" + confCoreSymbol + "' invalid");
alert("core symbol '" + confCoreSymbol + "' invalid");
return str;
}
}
function setupOverview(matchid){
loadGames(confServer, matchid).then(function(e){
$.each(e.rows, function(index, game){
var idstr = null;
if(game.concede >= 0){
idstr = "#id_ov_concede_p" + game.concede;
}else{
idstr = "#id_ov_concede_n"+ (-game.concede);
}
$(idstr).attr("gameid", game.gameid).attr("matchid", matchid);
var amountStr = mytrim(game.win);
if(amountStr == "0.0000"){
amountStr = "";
}
$(idstr + " div:eq(1)").text(amountStr);
amountStr = mytrim(game.punch);
if(amountStr == "0.0000"){
amountStr = "";
}
$(idstr + " div:eq(2)").text(amountStr);
amountStr = mytrim(game.lose);
if(amountStr == "0.0000"){
amountStr = "";
}
$(idstr + " div:eq(3)").text(amountStr);
if(index % 2 == 0){
$(idstr).css("background-color","#f8fff8");
}else{
$(idstr).css("background-color","#fff8f8");
}
});
}).catch(function(e){
alert("load match from EOS failed!");
});
}
function onDeposit(money){
deposit(confServer, confAccount, confKey, money).then(function(e){
notify(confAccount + " despoit " + money + " to soccer account OK!");
updateCredit();
updateStats();
}).catch(function(e){
console.log("onDeposit failed -> " + JSON.stringify(e));
alert(confAccount + " failed to despoit " + money + "!");
})
}
function onApplyWithdraw(){
var money = $('#id_credit').attr("creditval");
applyWithdraw(confServer, confAccount, confKey, money).then(function(e){
console.log("onApplyWithdraw OK -> " + JSON.stringify(e));
notify(confAccount + " withdraw application sent!");
updateCredit();
updateStats();
}).catch(function(e){
console.log("onApplyWithdraw failed -> " + JSON.stringify(e));
notify(confAccount + " withdraw application failed!");
alert(confAccount + " failed to withdraw!");
})
}
function onCancelWithdraw(){
cancelWithdraw(confServer, confAccount, confKey).then(function(e){
console.log("onCancelWithdraw OK -> " + JSON.stringify(e));
notify(confAccount + " cancel withdraw OK!");
updateCredit();
updateStats();
}).catch(function(e){
console.log("onCancelWithdraw failed -> " + JSON.stringify(e));
notify(confAccount + " cancel withdraw failed!");
alert(confAccount + " failed to cancel withdraw!");
})
}
function onBet(matchid, concede, side){
var gameid = matchid + concede + 5 + 1;
console.log("onSubmitBet - matchid:" + matchid + ", concede:" +
concede + ", side:" + side + ", gameid:" + gameid +
", decode gameid:" + Eos.modules.format.decodeName(gameid, false));
var lTeamEn = $("#id_match" + matchid + "_lTeam").attr("lTeamEn");
var rTeamEn = $("#id_match" + matchid + "_rTeam").attr("rTeamEn");
var lTeamCn = $("#id_match" + matchid + "_lTeam").attr("lTeamCn");
var rTeamCn = $("#id_match" + matchid + "_rTeam").attr("rTeamCn");
$("#id_bet_modal").attr("a_matchid", matchid);
$("#id_bet_modal").attr("a_concede", concede);
$("#id_bet_modal").attr("a_side", side);
$("#id_bet_modal").attr("a_lTeamEn", lTeamEn);
$("#id_bet_modal").attr("a_lTeamCn", lTeamCn);
$("#id_bet_modal").attr("a_rTeamEn", rTeamEn);
$("#id_bet_modal").attr("a_rTeamCn", rTeamCn);
var descCn, descEn;
if(side > 0){
descCn = '你正在押注 俄罗斯 V.S. 沙特阿拉伯 净胜球大于CONCEDE。<br/>' +
'如果俄罗斯胜CONCEDE球以上,那么你获胜。<br/>' +
'如果俄罗斯净胜CONCEDE球或者更少,那么你将失去押注本金。';
descEn = 'You are betting Russia V.S. SaudiArabia will more than CONCEDE goal.<br/>' +
'If Russia win more than CONCEDE goal, You win.<br/>' +
'Otherwise your will lost your bet.';
}else if(side == 0){
descCn = '你正在押注 俄罗斯 V.S. 沙特阿拉伯 净胜球等于CONCEDE。<br/>' +
'如果俄罗斯恰好胜CONCEDE球,那么你获胜。<br/>' +
'其他情况你将失去押注本金。';
descEn = 'You are betting Russia V.S. SaudiArabia will exactly CONCEDE goal.<br/>' +
'If Russia win exactly CONCEDE goal, You win.<br/>' +
'Otherwise your will lost your bet.';
}else {
descCn = '你正在押注 俄罗斯 V.S. 沙特阿拉伯 净胜球小于CONCEDE。<br/>' +
'如果俄罗斯净胜CONCEDE球以下,那么你获胜。<br/>' +
'其他情况你将失去押注本金。';
descEn = 'You are betting Russia V.S. SaudiArabia will less than CONCEDE goal.<br/>' +
'If Russia lost more than CONCEDE goals, You win.<br/>' +
'Otherwise your will lost your bet.';
}
descCn = descCn = descCn.replace(/俄罗斯/g, lTeamCn).replace(/沙特阿拉伯/g, rTeamCn).replace(/CONCEDE/g, "" + concede);
descEn = descEn.replace(/Russia/g, lTeamEn).replace(/SaudiArabia/g, rTeamEn).replace(/CONCEDE/g, "" + concede);
$("#id_bet_modal_desc_cn").html(descCn);
$("#id_bet_modal_desc_en").html(descEn);
$('#id_bet_modal').show().modal();
}
function onSubmitBet(clear){
var matchid = $("#id_bet_modal").attr("a_matchid");
var concede = parseInt($("#id_bet_modal").attr("a_concede"));
var side = parseInt($("#id_bet_modal").attr("a_side"));
var lTeamEn = $("#id_bet_modal").attr("a_lTeamEn");
var lTeamCn = $("#id_bet_modal").attr("a_lTeamCn");
var rTeamEn = $("#id_bet_modal").attr("a_rTeamEn");
var rTeamCn = $("#id_bet_modal").attr("a_rTeamCn");
var money = "" + parseFloat($("#id_bet_price").val()).toFixed(4) + " " + confCoreSymbol;
if(clear == 'clear'){
money = "0.0000 " + confCoreSymbol;
}
var gameid = parseInt(matchid) + parseInt(concede) + 5 + 1;
console.log("onSubmitBet - server:" + confServer +
", account:" + confAccount +
", matchid:" + matchid +
", gameid:" + gameid +
", decode gameid:" + Eos.modules.format.decodeName(gameid, false) +
", money:" + money +
", side:"+ side +
", lTeamEn:" + lTeamEn +
", rTeamEn" + rTeamEn +
", concede" + concede);
submitBet(confServer, confAccount, confKey, gameid, money, side, lTeamEn, rTeamEn,
concede).then(function(e){
notify("submit to EOS OK, transition id : " + e.transaction_id);
console.log("submit to EOS OK, transition id : " + e.transaction_id);
$('#id_bet_modal').modal('hide');
$("#id_match"+matchid+"_date").trigger("click");
}).catch(function(e){
console.log("submit failed -> " + JSON.stringify(e));
$('#id_bet_modal').modal('hide');
alert("submit bet to EOS failed!");
});
}
function setupMyBet(matchid, allowBet){
loadUserBet(confServer, matchid, confAccount).then(function(reses){
$.each(reses, function(idx, res){
var idstr = null;
if(idx - 5 >= 0){
idstr = "#id_mine_concede_p" + (idx - 5);
}else{
idstr = "#id_mine_concede_n"+ (5 - idx);
}
if(allowBet){
$(idstr + " a:eq(0)").text("").unbind().click(()=>onBet(matchid, idx - 5, 1));
$(idstr + " a:eq(1)").text("").unbind().click(()=>onBet(matchid, idx - 5, 0));
$(idstr + " a:eq(2)").text("").unbind().click(()=>onBet(matchid, idx - 5, -1));
}else{
$(idstr + " a:eq(0)").text("").unbind().click(()=>notify("game freezed, can not bet!"));
$(idstr + " a:eq(1)").text("").unbind().click(()=>notify("game freezed, can not bet!"));
$(idstr + " a:eq(2)").text("").unbind().click(()=>notify("game freezed, can not bet!"));
}
if(res.rows.length == 0 || res.rows[0].account != confAccount || res.rows[0].gameid != matchid + idx + 1){
$(idstr + " a").text("");
}else{
var valStr = mytrim(res.rows[0].money);
if(res.rows[0].side > 0){
$(idstr + " a:eq(0)").text(valStr);
}else if(res.rows[0].side == 0){
$(idstr + " a:eq(1)").text(valStr);
}else{
$(idstr + " a:eq(2)").text(valStr);
}
}
if(idx % 2 == 0){
$(idstr).css("background-color","#f8fff8");
}else{
$(idstr).css("background-color","#fff8f8");
}
});
}).catch(function(e){
console.log("loadUserBet -> failed : " + JSON.stringify(e));
alert("load " + confAccount + "'s bet failed!");
});
}
function updateCredit(){
confAccount = $("#id_account").val();
$("#id_name_code").text("Name Code : " + Eos.modules.format.encodeName(confAccount, false));
getCredit(confServer, confAccount).then(function(res){
//console.log("updateCredit OK -> ", JSON.stringify(res));
$('#id_current_account').html("<strong>"+confAccount+"</strong>");
if(res.rows[0].account == confAccount){
$('#id_credit').attr("creditval", res.rows[0].money);
$('#id_credit').attr("freezedval", res.rows[0].freezed);
$('#id_credit_using').text(res.rows[0].money);
$('#id_credit_freezed').text(res.rows[0].freezed);
}else{
console.log("updateCredit got wrong account " + res.rows[0].account + ", need : " + confAccount);
$('#id_credit').attr("creditval", res.rows[0].money);
$('#id_credit').attr("freezedval", res.rows[0].freezed);
$('#id_credit_using').text("-.---- " + confCoreSymbol);
$('#id_credit_freezed').text("-.---- " + confCoreSymbol);
alert("query credit for " + confAccount + " failed!");
}
}).catch(function(res){
console.log("updateCredit failed -> ", JSON.stringify(res));
$('#id_credit').attr("creditval", 0);
$('#id_credit').attr("freezedval", 0);
$('#id_credit_using').text("-.---- " + confCoreSymbol);
$('#id_credit_freezed').text("-.---- " + confCoreSymbol);
alert("query credit for " + confAccount + " failed!");
});
}
function updateStats(){
getGameStat(confServer).then(function(e){
//console.log("getGameStat OK");
var stat = e.rows[0];
$('#id_stat_incoming').text(stat.stat_incoming);
$('#id_stat_outcoming').text(stat.stat_outcoming);
$('#id_stat_holding').text(stat.stat_holding);
$('#id_stat_profit').text(stat.stat_profit);
$('#id_stat_credit').text(stat.stat_credit);
$('#id_stat_bet').text(stat.stat_bet);
}).catch(function(e){
console.log("getGameStat failed");
alert("query game owner's balance failed");
});
}
$(window).ready(function(){
onPage("bet");
confServer = localStorage.getItem("server");
confAccount = localStorage.getItem("account");
confKey = localStorage.getItem("active_key");
$("#id_server").val(confServer);
$("#id_account").val(confAccount);
$("#id_active_key").val(confKey);
$("#id_bet_price").trigger("input");
loadMatches(confServer).then(function(e){
notify("Connect to server ok!");
allEosMatches = e.rows;
buildMatchList();
updateCredit();
updateStats();
}).catch(function(e){
alert("Can not access server, check your configuration please!");
console.log("->" + e);
});
});
</script>
</head>
<body>
<div class="modal" id="id_bet_modal" tabindex="-1" role="dialog" aria-labelledby="id_bet_modal_label" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="id_bet_modal_label">确认下注 Confirm Bet</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div id="id_bet_modal_desc_cn" class="text-danger"></div>
<div class="dropdown-divider"></div>
<div id="id_bet_modal_desc_en" class="text-danger"></div>
<div class="dropdown-divider"></div>
<div class="row">
<div class="col-6">
<input id="id_bet_price" type="range" min="0.1" max="1" value="0.1" step="0.01" class="slider" id="myRange"
oninput="$('#id_bet_price_label').text('BET ' + $('#id_bet_price').val() + ' ' + confCoreSymbol)">
</div>
<div class="col-4"><strong id="id_bet_price_label" ></strong></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-warning" hint="take back bet from game." onclick="onSubmitBet('clear')">Clear</button>
<button type="button" class="btn btn-primary" hint="submit bet to EOS" onclick="onSubmitBet()">Submit</button>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand navbar-dark bg-dark">
<div class="collapse navbar-collapse" id="titleBar">
<ul class="navbar-nav">
<li class="nav-item">
<a id="id_bet_link" class="nav-link active" href="#" onclick="onPage('bet');">Bet</a>
</li>
<li class="nav-item">
<a id="id_account_link" class="nav-link" href="#" onclick="onPage('account');">Configure</a>
</li>
</ul>
</div>
<div class="btn-group">
<button id="id_current_account" type="button" class="btn btn-dark dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<strong>----</strong>
</button>
<div class="dropdown-menu bg-dark">
<a class="text-light dropdown-item" href="#" onclick="onDeposit('1.0000 ' + confCoreSymbol);">Deposit 1 EOS/SYS</a>
<a class="text-light dropdown-item" href="#" onclick="onApplyWithdraw();">Apply withdraw</a>
<a class="text-light dropdown-item" href="#" onclick="onCancelWithdraw();">Cancel withdraw</a>
</div>
</div>
<span id="id_credit" class="text-light">
<strong>Credit</strong>
<span style="width:5px"></span>
<span id="id_credit_using">-.---- ***</span>
<span style="width:10px"></span>
<strong>Freezed</strong>
<span style="width:5px"></span>
<span id="id_credit_freezed">-.---- ***</span>
</span>
<span style="width:3rem"></span>
<a class="navbar-brand text-light" href="#"><strong>FIFA2018</strong><img src="images/FIFAWorldCup.png" style="height:3rem;width:3rem"></img><sub>gpmn 06170230pm v1.0</sub></a>
</nav>
<div id="id_account_page" class="hcenter" style="width:40rem">
<div class="card">
<div class="card-header text-center bg-dark text-light">
<H3>Configure</H3>
</div>
<div class="card-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Server addr</span>
</div>
<input class="form-control" id="id_server" aria-describedby="basic-addon3" type="url" val="http://mainnet.eoscalgary.io">
<div class="input-group-append">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Servers</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" onclick='$("#id_server").val($(this).text())'>http://mainnet.eoscalgary.io</a>
<a class="dropdown-item" href="#" onclick='$("#id_server").val($(this).text())'>http://mainnet.eoscanada.com</a>
<a class="dropdown-item" href="#" onclick='$("#id_server").val($(this).text())'>http://mainnet.eoscannon.io</a>
<a class="dropdown-item" href="#" onclick='$("#id_server").val($(this).text())'>http://mainnet.genereos.io</a>
</div>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Account</span>
</div>
<input class="form-control" id="id_account" aria-describedby="basic-addon3" type="text"
placeholder="account" onchange="updateCredit()">
<div class="input-group-append">
<span id="id_name_code" style="width:20rem" class="input-group-text"></span>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Active key</span>
</div>
<input class="form-control" id="id_active_key" aria-describedby="basic-addon3" type="password" placeholder="active key of account">
</div>
<div class="input-group mb-3">
<span>First, we strongly recommend to <span class="text-danger">create a dummy acount</span> to play this game!</span>
<span>Second, active key is enough, <span class="text-danger">don't input your owner key!</span></span>
</div>
<div class="input-group mb-3">
<a href="#" class="btn btn-primary hcenter" onclick="onSave()">Save</a>
</div>
</div>
</div>
<div class="card">
<div class="card-header text-center bg-dark text-light">
<H3>Game Admin's statistics</H3>
</div>
<div class="card-body" style="">
<div class="row"><span class="col-3"></span><strong class="col-3">Incoming</strong><span id="id_stat_incoming" class="col-3 text-success"></span><span class="col-3"></span></div>
<div class="row"><span class="col-3"></span><strong class="col-3">Outcoming</strong><span id="id_stat_outcoming" class="col-3 text-danger"></span><span class="col-3"></span></div>
<div class="row"><span class="col-3"></span><strong class="col-3">Holding</strong><span id="id_stat_holding" class="col-3 text-success"></span><span class="col-3"></span></div>
<div class="row"><span class="col-3"></span><strong class="col-3">Profit</strong><span id="id_stat_profit" class="col-3"></span><span class="col-3"></span></div>
<div class="row"><span class="col-3"></span><strong class="col-3">Credit</strong><span id="id_stat_credit" class="col-3"></span><span class="col-3"></span></div>
<div class="row"><span class="col-3"></span><strong class="col-3">Bet</strong><span id="id_stat_bet" class="col-3"></span><span class="col-3"></span></div>
</div>
</div>
</div>
<div id="id_bet_page">
<div>
<div class="row">
<div id="id_match_list" class="col-6 pre-scrollable" style="min-height:720px">
</div>
<div id="id_game_list" class="col-6">
<div id="id_bet_overview_title" class="bg-dark row text-white">
<div class="col-4">
<h4 style="text-align:center">--</h4>
</div>
<div class="col-2">
<img style="width:25px;height:25px;margin:5px" src="./images/football.png">
</div>
<div class="col-2">
<img style="width:25px;height:25px;margin:5px" src="./images/football.png">
</div>
<div class="col-4">
<h4 style="text-align:center">--</h4>
</div>
</div>
<div class="row bg-dark text-white">
<h4 class="vcenter hcenter">Overview</h4>
</div>
<div class="row">
<div class="col-3"><h6></h6></div>
<div class="col-3"><h6>胜Win</h6></div>
<div class="col-3"><h6>平Punch</h6></div>
<div class="col-3"><h6>负Lose</h6></div>
</div>
<div id="id_ov_concede_n5" class="row">
<div class="col-3"><strong>-5球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_n4" class="row">
<div class="col-3"><strong>-4球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_n3" class="row">
<div class="col-3"><strong>-3球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_n2" class="row">
<div class="col-3"><strong>-2球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_n1" class="row">
<div class="col-3"><strong>-1球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_p0" class="row">
<div class="col-3"><strong>0球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_p1" class="row">
<div class="col-3"><strong>1球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_p2" class="row">
<div class="col-3"><strong>2球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_p3" class="row">
<div class="col-3"><strong>3球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_p4" class="row">
<div class="col-3"><strong>4球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div id="id_ov_concede_p5" class="row">
<div class="col-3"><strong>5球</strong></div>
<div class="col-3"></div>
<div class="col-3"></div>
<div class="col-3"></div>
</div>
<div class="row bg-dark text-white">
<h4 id="id_mybet_title" class="hcenter vcenter">My Bet</h4>
</div>
<div class="row">
<div class="col-3"><h6></h6></div>
<div class="col-3"><h6>胜Win</h6></div>
<div class="col-3"><h6>平Punch</h6></div>
<div class="col-3"><h6>负Lose</h6></div>
</div>
<div id="id_mine_concede_n5" class="row enlight">
<div class="col-3"><strong>-5球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_n4" class="row enlight">
<div class="col-3"><strong>-4球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_n3" class="row enlight">
<div class="col-3"><strong>-3球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_n2" class="row enlight">
<div class="col-3"><strong>-2球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_n1" class="row enlight">
<div class="col-3"><strong>-1球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_p0" class="row enlight">
<div class="col-3"><strong>0球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_p1" class="row enlight">
<div class="col-3"><strong>1球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_p2" class="row enlight">
<div class="col-3"><strong>2球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_p3" class="row enlight">
<div class="col-3"><strong>3球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_p4" class="row enlight">
<div class="col-3"><strong>4球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
<div id="id_mine_concede_p5" class="row enlight">
<div class="col-3"><strong>5球</strong></div>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
<a href="#" class="col-3"></a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>