inf_search_result.ejs
3.12 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="search.css" />
</head>
<script language="JavaScript">
function character(){
var a = Math.floor(Math.random() * 9) + 1;
return "main_character/" + a + ".png";
}
function level(){
return "level/" + '<%- level %>' + ".png";
}
</script>
<body>
<div id="div">
<img id="imgId" src="" width="150" height="120">
<script>document.getElementById("imgId").src = character()</script>
<text id="nick"> <%- name %> </text>
<img id="imgId2" src="" width="30" height="30">
<script>document.getElementById("imgId2").src = level()</script>
</div>
<div id="sebo">
</div>
<div id="resu">
<div id="most">
</div>
<div id="div1">
<div id="div2"></div>
</div>
</div>
<div id="hle">
<text > 문의사항 : mjoo1106@naver.com | blog.naver.com/mjoo1106 </text>
</div>
</body>
<script>
var body = '<%- body -%>';
var match = JSON.parse(body);
var head=["승","타입","카트","맵","시간","순위","플레이"];
const target=document.querySelector('#div2');
for(var i=1; i<=7; i++){
var obj=document.createElement('div');
obj.id="tet"+i;
obj.innerText=head[i-1];
target.append(obj);
}
const div_target=document.querySelector('#div1');
for(var i=1; i<=5; i++){
var obj=document.createElement('div');
obj.id="fordiv";
div_target.append(obj);
var win = match.matches[0].matches[i-1].player.matchWin;
var tId = match.matches[0].matches[i-1].trackId;
var kartId = match.matches[0].matches[i-1].player.kart;
var mrank = match.matches[0].matches[i-1].player.matchRank;
var players = match.matches[0].matches[i-1].playerCount;
var stime = new Date(match.matches[0].matches[i-1].startTime.split('T')[0] + " " + match.matches[0].matches[i-1].startTime.split('T')[1]);
var etime = new Date(match.matches[0].matches[i-1].endTime.split('T')[0] + " " + match.matches[0].matches[i-1].endTime.split('T')[1]);
var diff = etime - stime
var minute = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
var second = Math.floor((diff % (1000 * 60)) / 1000);
var ranking = mrank + " / " + players
var diff_time=minute + " : " + second;
if(win==0)
win="패";
else
win="승";
if (mrank == "99") {
ranking = "retire";
diff_time = "retire";
}
var arr=[win,"타입",kartId,tId,diff_time,ranking,"몇 일전?"];
for(var j=1; j<=7; j++){
var sobj=document.createElement('div');
sobj.id="tet"+j;
if(j==3){
var img=document.createElement('img');
img.id="IMG";
img.src="kart/"+arr[j-1]+".png";
sobj.append(img);
}
else if(j==4){
var img=document.createElement('img');
img.id="IMG";
img.src="track/"+arr[j-1]+".png";
sobj.append(img);
}
else{
sobj.innerText=arr[j-1];
}
obj.append(sobj);
}
}
</script>
</html>