Showing
16 changed files
with
193 additions
and
67 deletions
1 | var key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiMjAxNjMxMTYzIiwiYXV0aF9pZCI6IjIiLCJ0b2tlbl90eXBlIjoiQWNjZXNzVG9rZW4iLCJzZXJ2aWNlX2lkIjoiNDMwMDExMzkzIiwiWC1BcHAtUmF0ZS1MaW1pdCI6IjUwMDoxMCIsIm5iZiI6MTYzNDMwMTE0NCwiZXhwIjoxNjQ5ODUzMTQ0LCJpYXQiOjE2MzQzMDExNDR9.EEWMly4HZG_DY-aleMtDFVOOmbWl8uVmG1tHVM3c-BE" | 1 | var key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiMjAxNjMxMTYzIiwiYXV0aF9pZCI6IjIiLCJ0b2tlbl90eXBlIjoiQWNjZXNzVG9rZW4iLCJzZXJ2aWNlX2lkIjoiNDMwMDExMzkzIiwiWC1BcHAtUmF0ZS1MaW1pdCI6IjUwMDoxMCIsIm5iZiI6MTYzNDMwMTE0NCwiZXhwIjoxNjQ5ODUzMTQ0LCJpYXQiOjE2MzQzMDExNDR9.EEWMly4HZG_DY-aleMtDFVOOmbWl8uVmG1tHVM3c-BE" |
2 | var chname; | 2 | var chname; |
3 | - | 3 | +var userId; |
4 | +var username; | ||
5 | +var kart_level; | ||
4 | exports.home_get=function(req,res){ | 6 | exports.home_get=function(req,res){ |
5 | res.render('search_home'); | 7 | res.render('search_home'); |
6 | }; | 8 | }; |
... | @@ -8,9 +10,6 @@ exports.home_get=function(req,res){ | ... | @@ -8,9 +10,6 @@ exports.home_get=function(req,res){ |
8 | 10 | ||
9 | exports.result_post=function(req,res){ | 11 | exports.result_post=function(req,res){ |
10 | chname=encodeURIComponent(req.body.test); | 12 | chname=encodeURIComponent(req.body.test); |
11 | -}; | ||
12 | - | ||
13 | -exports.result_get=function(req,res){ | ||
14 | var api_url='https://api.nexon.co.kr/kart/v1.0/users/nickname/'+chname; | 13 | var api_url='https://api.nexon.co.kr/kart/v1.0/users/nickname/'+chname; |
15 | var request=require('request'); | 14 | var request=require('request'); |
16 | var options={ | 15 | var options={ |
... | @@ -20,18 +19,32 @@ exports.result_get=function(req,res){ | ... | @@ -20,18 +19,32 @@ exports.result_get=function(req,res){ |
20 | request.get(options, function(error, response, body){ | 19 | request.get(options, function(error, response, body){ |
21 | if (!error && response.statusCode == 200) { | 20 | if (!error && response.statusCode == 200) { |
22 | var jsbody=JSON.parse(body); | 21 | var jsbody=JSON.parse(body); |
23 | - var option2={ | 22 | + userId=jsbody.accessId; |
23 | + username=jsbody.name; | ||
24 | + kart_level=jsbody.level; | ||
25 | + res.send(JSON.stringify(response.statusCode)); | ||
26 | + } | ||
27 | + else { | ||
28 | + res.send(JSON.stringify(response.statusCode)); | ||
29 | + } | ||
30 | + }); | ||
31 | +} | ||
32 | + | ||
33 | +exports.result_get = function (req, res) { | ||
34 | + var api_url="https://api.nexon.co.kr/kart/v1.0/users/" + userId + "/matches?start_date=&end_date= &offset=0&limit=10&match_types=7b9f0fd5377c38514dbb78ebe63ac6c3b81009d5a31dd569d1cff8f005aa881a"; | ||
35 | + var request=require('request'); | ||
36 | + var options = { | ||
24 | //개인전만 검색하는 것임 | 37 | //개인전만 검색하는 것임 |
25 | - url: "https://api.nexon.co.kr/kart/v1.0/users/"+jsbody.accessId+"/matches?start_date=&end_date= &offset=0&limit=10&match_types=7b9f0fd5377c38514dbb78ebe63ac6c3b81009d5a31dd569d1cff8f005aa881a", | 38 | + url: api_url, |
26 | - headers:{Authorization: key} | 39 | + headers: { Authorization: key } |
27 | }; | 40 | }; |
28 | - request.get(option2, function(error, response, body){ | 41 | + request.get(options, function (error, response, body) { |
29 | - var match=JSON.parse(body); | 42 | + if (!error && response.statusCode == 200) { |
30 | - res.render('search_result',{name: jsbody.name, level: jsbody.level,body:JSON.stringify(match)}); | 43 | + var match = JSON.parse(body); |
31 | - }); | 44 | + res.render('search_result', { name: username, level: kart_level, body: JSON.stringify(match) }); |
32 | - } else { | 45 | + } |
33 | - res.status(response.statusCode).end(); | 46 | + else{ |
34 | - console.log('error = ' + response.statusCode); | 47 | + res.send("error :" + response.statusCode); |
35 | } | 48 | } |
36 | }); | 49 | }); |
37 | }; | 50 | }; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
views/metadata/emblem/emblem1.png
0 → 100644
19.6 KB
views/metadata/emblem/emblem2.png
0 → 100644
18.5 KB
views/metadata/emblem/emblem3.png
0 → 100644
16.6 KB
views/metadata/emblem/emblem4.png
0 → 100644
14.9 KB
views/metadata/emblem/emblem5.png
0 → 100644
11.6 KB
views/metadata/emblem/emblem6.png
0 → 100644
18.4 KB
views/metadata/emblem/emblem7.png
0 → 100644
13.4 KB
views/metadata/emblem/emblem8.png
0 → 100644
13.1 KB
views/metadata/image/empty.png
0 → 100644
5.51 KB
views/metadata/image/search_image.png
0 → 100644
300 KB
This diff is collapsed. Click to expand it.
1 | <html> | 1 | <html> |
2 | <head> | 2 | <head> |
3 | - <title>TESTESTEST</title> | 3 | + <title>전적 검색</title> |
4 | <meta charset="utf-8"> | 4 | <meta charset="utf-8"> |
5 | <!-- 제이쿼리 불러오기 --> | 5 | <!-- 제이쿼리 불러오기 --> |
6 | <!--<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>--> | 6 | <!--<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>--> |
7 | <link rel="stylesheet" type="text/css" href="search_home.css" /> | 7 | <link rel="stylesheet" type="text/css" href="search_home.css" /> |
8 | + <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> | ||
8 | <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | 9 | <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> |
9 | </head> | 10 | </head> |
10 | <body> | 11 | <body> |
... | @@ -12,7 +13,7 @@ | ... | @@ -12,7 +13,7 @@ |
12 | <img class="box2" id="right" src="metadata/image/sdao.png"> | 13 | <img class="box2" id="right" src="metadata/image/sdao.png"> |
13 | <div class="search"> | 14 | <div class="search"> |
14 | <input type="text" id="name" placeholder="카트라이더 닉네임 입력" /> | 15 | <input type="text" id="name" placeholder="카트라이더 닉네임 입력" /> |
15 | - <input type="submit" value="" onClick="location.href='search/result'" id="OK"/> | 16 | + <input type="button" value="" id="OK"/> |
16 | </div> | 17 | </div> |
17 | <script> | 18 | <script> |
18 | $("#OK").click(function(){ // OK 버튼 클릭하면 | 19 | $("#OK").click(function(){ // OK 버튼 클릭하면 |
... | @@ -23,7 +24,15 @@ | ... | @@ -23,7 +24,15 @@ |
23 | data: { | 24 | data: { |
24 | test: $("#name").val() // 텍스트필드에 입력한 값을 test라는 이름으로 보냄 | 25 | test: $("#name").val() // 텍스트필드에 입력한 값을 test라는 이름으로 보냄 |
25 | }, | 26 | }, |
26 | - dataType: 'json' | 27 | + dataType: 'json', |
28 | + success: function(data){ | ||
29 | + if(data=="200"){ | ||
30 | + window.location.href="/search/result"; | ||
31 | + } | ||
32 | + else{ | ||
33 | + swal("ERROR", "존재하지 않는 닉네임입니다."); | ||
34 | + } | ||
35 | + } | ||
27 | }); | 36 | }); |
28 | }); | 37 | }); |
29 | </script> | 38 | </script> | ... | ... |
1 | body{ | 1 | body{ |
2 | background:rgb(240, 239, 239) | 2 | background:rgb(240, 239, 239) |
3 | } | 3 | } |
4 | -#hle | 4 | +#div |
5 | { | 5 | { |
6 | position: relative; | 6 | position: relative; |
7 | - top:3px; | 7 | + width: 1200px; |
8 | - left:-1120px; | 8 | + height: 200px; |
9 | + left:50%; | ||
10 | + margin:0px 0px 0px -600px; | ||
11 | + float:left; | ||
9 | } | 12 | } |
10 | -#div | 13 | +#emblem |
11 | { | 14 | { |
12 | - position: relative; | 15 | + position:relative; |
13 | - width: 1150px; | 16 | + width:120px; |
14 | - height: 220px; | 17 | + height:120px; |
15 | - line-height: 200px; | 18 | + top:50%; |
16 | - margin: 0 auto; | 19 | + margin:-60px 0px 0px 5px; |
17 | - background-image: url(search_chang.png); | 20 | + box-shadow: 2px 2px 2px rgb(166, 166, 166); |
21 | + border:2px solid rgb(166, 166, 166); | ||
22 | + float:left; | ||
23 | +} | ||
24 | +#name | ||
25 | +{ | ||
26 | + position:relative; | ||
27 | + width:300px; | ||
28 | + height:50px; | ||
29 | + top:50%; | ||
30 | + margin:-25px 0px 0px 20px; | ||
31 | + float:left; | ||
32 | +} | ||
33 | +#s_home | ||
34 | +{ | ||
35 | + position:relative; | ||
36 | + left:355px; | ||
37 | +} | ||
38 | +#title | ||
39 | +{ | ||
40 | + font-family: 'Nanum Gothic'; | ||
41 | + font-size:large; | ||
42 | + font-weight:bold; | ||
18 | } | 43 | } |
19 | - | ||
20 | #resu | 44 | #resu |
21 | { | 45 | { |
22 | position: relative; | 46 | position: relative; |
23 | - width: 1150px; | 47 | + width: 1700px; |
24 | - height: 1400px; | 48 | + height: 1100px; |
25 | margin: 0 auto; | 49 | margin: 0 auto; |
26 | - top:6px; | 50 | + top:250px; |
27 | } | 51 | } |
28 | #most | 52 | #most |
29 | { | 53 | { |
30 | position: relative; | 54 | position: relative; |
31 | width: 370px; | 55 | width: 370px; |
32 | - height: 600px; | 56 | + height: 800px; |
57 | + left:-250px; | ||
33 | float:left; | 58 | float:left; |
34 | } | 59 | } |
35 | #imgId | 60 | #imgId |
... | @@ -38,15 +63,16 @@ body{ | ... | @@ -38,15 +63,16 @@ body{ |
38 | } | 63 | } |
39 | #nick | 64 | #nick |
40 | { | 65 | { |
41 | - font-size:xx-large; | 66 | + font-family: 'Nanum Gothic'; |
42 | - font-weight: bold; | 67 | + font-size:40px; |
68 | + font-weight:bold; | ||
43 | } | 69 | } |
44 | #div1 | 70 | #div1 |
45 | { | 71 | { |
46 | position: relative; | 72 | position: relative; |
47 | - width: 500px; | 73 | + width: 800px; |
48 | height: 900px; | 74 | height: 900px; |
49 | - left:3%; | 75 | + left:-150px; |
50 | float:left; | 76 | float:left; |
51 | } | 77 | } |
52 | 78 | ||
... | @@ -70,7 +96,11 @@ body{ | ... | @@ -70,7 +96,11 @@ body{ |
70 | width:80px; | 96 | width:80px; |
71 | height:60px; | 97 | height:60px; |
72 | } | 98 | } |
73 | - | 99 | +#IMG4 |
100 | +{ | ||
101 | + width:80px; | ||
102 | + height:60px; | ||
103 | +} | ||
74 | #img3 | 104 | #img3 |
75 | { | 105 | { |
76 | position: relative; | 106 | position: relative; |
... | @@ -84,6 +114,7 @@ body{ | ... | @@ -84,6 +114,7 @@ body{ |
84 | border-collapse: separate; | 114 | border-collapse: separate; |
85 | border-spacing: 0 10px; | 115 | border-spacing: 0 10px; |
86 | text-align:center; | 116 | text-align:center; |
117 | + width:100%; | ||
87 | } | 118 | } |
88 | #table_row | 119 | #table_row |
89 | { | 120 | { | ... | ... |
... | @@ -5,31 +5,65 @@ | ... | @@ -5,31 +5,65 @@ |
5 | <meta charset="utf-8"> | 5 | <meta charset="utf-8"> |
6 | <link rel="stylesheet" type="text/css" href="search_result.css" /> | 6 | <link rel="stylesheet" type="text/css" href="search_result.css" /> |
7 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js"></script> | 7 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js"></script> |
8 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | ||
8 | </head> | 9 | </head> |
9 | <script language="JavaScript"> | 10 | <script language="JavaScript"> |
10 | - function character(){ | ||
11 | - var a = Math.floor(Math.random() * 9) + 1; | ||
12 | - return "metadata/main_character/" + a + ".png"; | ||
13 | - } | ||
14 | function level(){ | 11 | function level(){ |
15 | return "metadata/level/" + '<%- level %>' + ".png"; | 12 | return "metadata/level/" + '<%- level %>' + ".png"; |
16 | } | 13 | } |
14 | + function embl(){ | ||
15 | + var rand=Math.floor(Math.random()*8+1); | ||
16 | + return "background-image:url('metadata/emblem/emblem"+rand+".png')"; | ||
17 | + } | ||
18 | + function get_jsondata(id, kind){ | ||
19 | + var str; | ||
20 | + var local_url='metadata/'+kind+'.json'; | ||
21 | + function save(data){ | ||
22 | + str=data; | ||
23 | + } | ||
24 | + $.ajaxSetup({ | ||
25 | + async: false | ||
26 | + }); | ||
27 | + $.getJSON(local_url,function(json){ | ||
28 | + var kind_json; | ||
29 | + if(kind=="kart"){ | ||
30 | + kind_json=json.kart; | ||
31 | + } | ||
32 | + else if(kind=="track"){ | ||
33 | + kind_json=json.track; | ||
34 | + } | ||
35 | + else if(kind=="character"){ | ||
36 | + kind_json=json.character; | ||
37 | + } | ||
38 | + for (var i = 0; i < kind_json.length; i++) { | ||
39 | + if (kind_json[i]['id'] == id) { | ||
40 | + save(kind_json[i]['name']); | ||
41 | + break; | ||
42 | + } | ||
43 | + } | ||
44 | + }); | ||
45 | + return str; | ||
46 | + } | ||
17 | </script> | 47 | </script> |
18 | <body> | 48 | <body> |
19 | <div id="div"> | 49 | <div id="div"> |
20 | - <img id="imgId" src="" width="150" height="120"> | 50 | + <div id="emblem"> |
21 | - <script>document.getElementById("imgId").src = character()</script> | 51 | + <script>document.getElementById("emblem").style = embl()</script> |
52 | + </div> | ||
53 | + <div id="name"> | ||
22 | <text id="nick"> <%- name %> </text> | 54 | <text id="nick"> <%- name %> </text> |
23 | - <img id="imgId2" src="" width="30" height="30"> | 55 | + </div> |
24 | - <script>document.getElementById("imgId2").src = level()</script> | 56 | + <img id="s_home" src="metadata/image/search_image.png"> |
25 | </div> | 57 | </div> |
26 | 58 | ||
27 | 59 | ||
28 | <div id="resu"> | 60 | <div id="resu"> |
29 | <div id="most"> | 61 | <div id="most"> |
62 | + <text id="title">SAVE</text> | ||
30 | <canvas id="myChart2"width="350" height="200"></canvas> | 63 | <canvas id="myChart2"width="350" height="200"></canvas> |
31 | - <text>RETIRE</text> | 64 | + <text id="title"><br>RANKING GRAPE</text> |
32 | <canvas id="myChart"width="350" height="200"></canvas> | 65 | <canvas id="myChart"width="350" height="200"></canvas> |
66 | + <text id="title"><br>MOST KART</text> | ||
33 | <table id="table_most" border="1"> | 67 | <table id="table_most" border="1"> |
34 | <colgroup> | 68 | <colgroup> |
35 | <col width="10%"/> | 69 | <col width="10%"/> |
... | @@ -51,30 +85,30 @@ | ... | @@ -51,30 +85,30 @@ |
51 | <colgroup> | 85 | <colgroup> |
52 | <col width="100px"/> | 86 | <col width="100px"/> |
53 | <col width="100px"/> | 87 | <col width="100px"/> |
54 | - <col width="100px"/> | 88 | + <col width="150px"/> |
89 | + <col width="200px"/> | ||
55 | <col width="100px"/> | 90 | <col width="100px"/> |
56 | <col width="100px"/> | 91 | <col width="100px"/> |
57 | </colgroup> | 92 | </colgroup> |
58 | </table> | 93 | </table> |
59 | </div> | 94 | </div> |
60 | </div> | 95 | </div> |
61 | - | ||
62 | - <div id="hle"> | ||
63 | - <text> 문의사항 : mjoo1106@naver.com</text> | ||
64 | - </div> | ||
65 | </body> | 96 | </body> |
66 | 97 | ||
67 | <script> | 98 | <script> |
68 | var body = '<%- body -%>'; | 99 | var body = '<%- body -%>'; |
69 | var most_kart=[]; | 100 | var most_kart=[]; |
70 | var rank_grape=[]; | 101 | var rank_grape=[]; |
102 | + var retire=0; | ||
71 | var match = JSON.parse(body); | 103 | var match = JSON.parse(body); |
104 | + var Len = match.matches[0].matches.length; | ||
72 | const div_target=document.querySelector('#table'); | 105 | const div_target=document.querySelector('#table'); |
73 | - for(var i=1; i<=10; i++){ | 106 | + for(var i=1; i<=Len; i++){ |
74 | var obj=document.createElement('tr'); | 107 | var obj=document.createElement('tr'); |
75 | obj.id="table_row"; | 108 | obj.id="table_row"; |
76 | var win = match.matches[0].matches[i-1].player.matchWin; | 109 | var win = match.matches[0].matches[i-1].player.matchWin; |
77 | var tId = match.matches[0].matches[i-1].trackId; | 110 | var tId = match.matches[0].matches[i-1].trackId; |
111 | + var character=match.matches[0].matches[i-1].character; | ||
78 | var kartId = match.matches[0].matches[i-1].player.kart; | 112 | var kartId = match.matches[0].matches[i-1].player.kart; |
79 | most_kart.push(kartId); | 113 | most_kart.push(kartId); |
80 | var mrank = match.matches[0].matches[i-1].player.matchRank; | 114 | var mrank = match.matches[0].matches[i-1].player.matchRank; |
... | @@ -83,7 +117,11 @@ | ... | @@ -83,7 +117,11 @@ |
83 | var etime = new Date(match.matches[0].matches[i-1].endTime.split('T')[0] + " " + match.matches[0].matches[i-1].endTime.split('T')[1]); | 117 | var etime = new Date(match.matches[0].matches[i-1].endTime.split('T')[0] + " " + match.matches[0].matches[i-1].endTime.split('T')[1]); |
84 | var diff = etime - stime | 118 | var diff = etime - stime |
85 | var minute = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); | 119 | var minute = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); |
120 | + if(minute<10) | ||
121 | + minute='0'+minute; | ||
86 | var second = Math.floor((diff % (1000 * 60)) / 1000); | 122 | var second = Math.floor((diff % (1000 * 60)) / 1000); |
123 | + if(second<10) | ||
124 | + second='0'+second; | ||
87 | var ranking = mrank + "/" + players | 125 | var ranking = mrank + "/" + players |
88 | var diff_time=minute + " : " + second; | 126 | var diff_time=minute + " : " + second; |
89 | var now_time=new Date(); | 127 | var now_time=new Date(); |
... | @@ -104,6 +142,7 @@ | ... | @@ -104,6 +142,7 @@ |
104 | 142 | ||
105 | if (mrank == "99" || win=="탈주") { | 143 | if (mrank == "99" || win=="탈주") { |
106 | ranking = "retire"; | 144 | ranking = "retire"; |
145 | + retire+=1; | ||
107 | diff_time = "retire"; | 146 | diff_time = "retire"; |
108 | obj.style="background: rgb(226,182,179)"; | 147 | obj.style="background: rgb(226,182,179)"; |
109 | rank_grape.push(8); | 148 | rank_grape.push(8); |
... | @@ -118,8 +157,8 @@ | ... | @@ -118,8 +157,8 @@ |
118 | } | 157 | } |
119 | 158 | ||
120 | div_target.append(obj); | 159 | div_target.append(obj); |
121 | - var arr=["개인전","#"+ranking,kartId,tId,diff_time,ranking]; | 160 | + var arr=["개인전","#"+ranking,kartId,tId,character,diff_time,ranking]; |
122 | - for(var j=1; j<=5; j++){ | 161 | + for(var j=1; j<=6; j++){ |
123 | var sobj=document.createElement('td'); | 162 | var sobj=document.createElement('td'); |
124 | if(j==1){ | 163 | if(j==1){ |
125 | var tet1=document.createElement('text'); | 164 | var tet1=document.createElement('text'); |
... | @@ -140,10 +179,17 @@ | ... | @@ -140,10 +179,17 @@ |
140 | else if(j==3){ | 179 | else if(j==3){ |
141 | var img=document.createElement('img'); | 180 | var img=document.createElement('img'); |
142 | var tet1=document.createElement('text'); | 181 | var tet1=document.createElement('text'); |
182 | + var str=get_jsondata(arr[j-1],"kart"); | ||
143 | var br=document.createElement('br'); | 183 | var br=document.createElement('br'); |
144 | img.id="IMG"; | 184 | img.id="IMG"; |
185 | + if(str==null){ | ||
186 | + tet1.innerText="조회 불가능" | ||
187 | + img.src="metadata/image/empty.png"; | ||
188 | + } | ||
189 | + else{ | ||
190 | + tet1.innerText=str; | ||
145 | img.src="metadata/kart/"+arr[j-1]+".png"; | 191 | img.src="metadata/kart/"+arr[j-1]+".png"; |
146 | - tet1.innerText="카트이름" | 192 | + } |
147 | sobj.append(img); | 193 | sobj.append(img); |
148 | sobj.append(br); | 194 | sobj.append(br); |
149 | sobj.append(tet1); | 195 | sobj.append(tet1); |
... | @@ -151,11 +197,30 @@ | ... | @@ -151,11 +197,30 @@ |
151 | else if(j==4){ | 197 | else if(j==4){ |
152 | var img=document.createElement('img'); | 198 | var img=document.createElement('img'); |
153 | var tet1=document.createElement('text'); | 199 | var tet1=document.createElement('text'); |
200 | + var str=get_jsondata(arr[j-1],"track"); | ||
154 | tet1.id="IMG2_TEXT"; | 201 | tet1.id="IMG2_TEXT"; |
155 | var br=document.createElement('br'); | 202 | var br=document.createElement('br'); |
156 | img.id="IMG2"; | 203 | img.id="IMG2"; |
204 | + if(str==null || str[1]=='r'){ | ||
205 | + tet1.innerText="조회 불가능" | ||
206 | + img.src="metadata/image/empty.png"; | ||
207 | + } | ||
208 | + else{ | ||
209 | + tet1.innerText=str; | ||
157 | img.src="metadata/track/"+arr[j-1]+".png"; | 210 | img.src="metadata/track/"+arr[j-1]+".png"; |
158 | - tet1.innerText="맵 이름" | 211 | + } |
212 | + sobj.append(img); | ||
213 | + sobj.append(br); | ||
214 | + sobj.append(tet1); | ||
215 | + } | ||
216 | + else if(j==5){ | ||
217 | + var img=document.createElement('img'); | ||
218 | + var str=get_jsondata(arr[j-1],"character"); | ||
219 | + var tet1=document.createElement('text'); | ||
220 | + var br=document.createElement('br'); | ||
221 | + img.id="IMG4"; | ||
222 | + img.src="metadata/character/"+arr[j-1]+".png"; | ||
223 | + tet1.innerText=str; | ||
159 | sobj.append(img); | 224 | sobj.append(img); |
160 | sobj.append(br); | 225 | sobj.append(br); |
161 | sobj.append(tet1); | 226 | sobj.append(tet1); |
... | @@ -167,15 +232,11 @@ | ... | @@ -167,15 +232,11 @@ |
167 | } | 232 | } |
168 | } | 233 | } |
169 | /////////////most카트라이더 부분///////////////////////// | 234 | /////////////most카트라이더 부분///////////////////////// |
170 | - /*const most_div=document.querySelector('#most'); | ||
171 | - var obj=documnet.createElement("button"); | ||
172 | - obj.innerText=most_kart[2]; | ||
173 | - most_div.append(obj);*/ | ||
174 | var count=[]; | 235 | var count=[]; |
175 | - for(var i=0; i<10; i++){ | 236 | + for(var i=0; i<Len; i++){ |
176 | var item=most_kart[i]; | 237 | var item=most_kart[i]; |
177 | count[i]=0; | 238 | count[i]=0; |
178 | - for(var j=0; j<10; j++){ | 239 | + for(var j=0; j<Len; j++){ |
179 | if(item==most_kart[j]){ | 240 | if(item==most_kart[j]){ |
180 | count[i]+=1; | 241 | count[i]+=1; |
181 | } | 242 | } |
... | @@ -183,7 +244,7 @@ | ... | @@ -183,7 +244,7 @@ |
183 | } | 244 | } |
184 | var max=0; | 245 | var max=0; |
185 | var index=0; //most_kart 배열에서 어디부분이 모스트인지 알려주는 index | 246 | var index=0; //most_kart 배열에서 어디부분이 모스트인지 알려주는 index |
186 | - for(var i=0; i<10; i++){ | 247 | + for(var i=0; i<Len; i++){ |
187 | if(max<count[i]){ | 248 | if(max<count[i]){ |
188 | max=count[i]; | 249 | max=count[i]; |
189 | index=i; | 250 | index=i; |
... | @@ -193,13 +254,19 @@ | ... | @@ -193,13 +254,19 @@ |
193 | var obj=document.createElement('tr'); | 254 | var obj=document.createElement('tr'); |
194 | most_div.append(obj); | 255 | most_div.append(obj); |
195 | /*save는 retire횟수 따져주는 것*/ | 256 | /*save는 retire횟수 따져주는 것*/ |
196 | - var temp_arr=[most_kart[index],"카트이름","30%",max]; | 257 | + var temp_arr=[most_kart[index],get_jsondata(most_kart[index],'kart'),(Len-retire)*10+"%",max]; |
197 | for(var i=0; i<4; i++){ | 258 | for(var i=0; i<4; i++){ |
198 | var sobj=document.createElement('td'); | 259 | var sobj=document.createElement('td'); |
199 | if(i==0){ | 260 | if(i==0){ |
200 | var img=document.createElement('img'); | 261 | var img=document.createElement('img'); |
201 | img.id="IMG3"; | 262 | img.id="IMG3"; |
263 | + if(temp_arr[1]==null){ | ||
264 | + temp_arr[1]="조회 불가능" | ||
265 | + img.src="metadata/image/empty.png"; | ||
266 | + } | ||
267 | + else{ | ||
202 | img.src="metadata/kart/"+temp_arr[i]+".png"; | 268 | img.src="metadata/kart/"+temp_arr[i]+".png"; |
269 | + } | ||
203 | sobj.append(img); | 270 | sobj.append(img); |
204 | } | 271 | } |
205 | else{ | 272 | else{ |
... | @@ -247,14 +314,20 @@ | ... | @@ -247,14 +314,20 @@ |
247 | var ctx=document.getElementById('myChart').getContext('2d'); | 314 | var ctx=document.getElementById('myChart').getContext('2d'); |
248 | new Chart(ctx,options); | 315 | new Chart(ctx,options); |
249 | /////////////////////// | 316 | /////////////////////// |
317 | + | ||
250 | var options2={ | 318 | var options2={ |
251 | type: 'doughnut', | 319 | type: 'doughnut', |
252 | data:{ | 320 | data:{ |
321 | + labels:['retire','save'], | ||
253 | datasets: [{ | 322 | datasets: [{ |
254 | - data: [50,50], | 323 | + data: [retire,Len-retire], |
324 | + backgroundColor:[ | ||
325 | + 'rgba(255, 100, 100, 1)', | ||
326 | + 'rgba(54, 162, 235, 1)' | ||
327 | + ], | ||
255 | }] | 328 | }] |
256 | }, | 329 | }, |
257 | - options:{ | 330 | + /* options:{ |
258 | responsive:false, | 331 | responsive:false, |
259 | scales:{ | 332 | scales:{ |
260 | xAxes: [{ | 333 | xAxes: [{ |
... | @@ -274,7 +347,7 @@ | ... | @@ -274,7 +347,7 @@ |
274 | } | 347 | } |
275 | }] | 348 | }] |
276 | } | 349 | } |
277 | - } | 350 | + }*/ |
278 | }; | 351 | }; |
279 | var ctx2=document.getElementById('myChart2').getContext('2d'); | 352 | var ctx2=document.getElementById('myChart2').getContext('2d'); |
280 | new Chart(ctx2,options2); | 353 | new Chart(ctx2,options2); | ... | ... |
-
Please register or login to post a comment