Showing
3 changed files
with
39 additions
and
9 deletions
... | @@ -2,7 +2,7 @@ module.exports = function(app){ | ... | @@ -2,7 +2,7 @@ module.exports = function(app){ |
2 | 2 | ||
3 | var request = require("request"); | 3 | var request = require("request"); |
4 | var urlenconde = require('urlencode'); | 4 | var urlenconde = require('urlencode'); |
5 | -var apikey = "RGAPI-4591bbaf-8e3f-4afa-91c2-359b66a402b7"//api | 5 | +var apikey = "RGAPI-26fe9028-bf28-4baa-a0e0-34c116c57742"//api |
6 | 6 | ||
7 | var profileIconId; //아이콘 번호 | 7 | var profileIconId; //아이콘 번호 |
8 | var revisionDate; //수정날짜 | 8 | var revisionDate; //수정날짜 |
... | @@ -39,7 +39,11 @@ var rotation_champ = new Array(); | ... | @@ -39,7 +39,11 @@ var rotation_champ = new Array(); |
39 | profileIconId = info_summoner_json["profileIconId"]; | 39 | profileIconId = info_summoner_json["profileIconId"]; |
40 | summonerLevel = info_summoner_json["summonerLevel"]; | 40 | summonerLevel = info_summoner_json["summonerLevel"]; |
41 | revisionDate = info_summoner_json["revisionDate"]; | 41 | revisionDate = info_summoner_json["revisionDate"]; |
42 | - | 42 | + var profileUrl="http://ddragon.leagueoflegends.com/cdn/10.23.1/img/profileicon/"; |
43 | + request(profileUrl,function(error,response,body){ | ||
44 | + var profileIcon; | ||
45 | + profileIcon="http://ddragon.leagueoflegends.com/cdn/10.23.1/img/profileicon/"+profileIconId+".png"; | ||
46 | + | ||
43 | var champUrl = "https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/" + urlenconde(id) + "?api_key=" + apikey; | 47 | var champUrl = "https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/" + urlenconde(id) + "?api_key=" + apikey; |
44 | request(champUrl,function(error,response,body){ | 48 | request(champUrl,function(error,response,body){ |
45 | var info_champ_json = JSON.parse(body); | 49 | var info_champ_json = JSON.parse(body); |
... | @@ -49,6 +53,7 @@ var rotation_champ = new Array(); | ... | @@ -49,6 +53,7 @@ var rotation_champ = new Array(); |
49 | var rotation_name = new Array(); | 53 | var rotation_name = new Array(); |
50 | var champ_pic = new Array(); | 54 | var champ_pic = new Array(); |
51 | var rotation_pic =new Array(); | 55 | var rotation_pic =new Array(); |
56 | + var champ_level=new Array();//숙련도 레벨 | ||
52 | var champions_length = Object.keys(info_champ_json).length; | 57 | var champions_length = Object.keys(info_champ_json).length; |
53 | 58 | ||
54 | //console.log("\n\ninfo_champ_json\n\n", info_champ_json); | 59 | //console.log("\n\ninfo_champ_json\n\n", info_champ_json); |
... | @@ -65,7 +70,7 @@ var rotation_champ = new Array(); | ... | @@ -65,7 +70,7 @@ var rotation_champ = new Array(); |
65 | for(var i=0; i < champions_length; i++){ | 70 | for(var i=0; i < champions_length; i++){ |
66 | champ_point[i] = (info_champ_json[i]["championPoints"]); | 71 | champ_point[i] = (info_champ_json[i]["championPoints"]); |
67 | champ_id[i] = info_champ_json[i]["championId"]; | 72 | champ_id[i] = info_champ_json[i]["championId"]; |
68 | - | 73 | + champ_level[i]=info_champ_json[i]["championLevel"] |
69 | } | 74 | } |
70 | var rotationUrl = "https://kr.api.riotgames.com/lol/platform/v3/champion-rotations?api_key="+apikey; | 75 | var rotationUrl = "https://kr.api.riotgames.com/lol/platform/v3/champion-rotations?api_key="+apikey; |
71 | request(rotationUrl,function(error,response,body){ | 76 | request(rotationUrl,function(error,response,body){ |
... | @@ -80,7 +85,7 @@ var rotation_champ = new Array(); | ... | @@ -80,7 +85,7 @@ var rotation_champ = new Array(); |
80 | 85 | ||
81 | 86 | ||
82 | 87 | ||
83 | - | 88 | + |
84 | 89 | ||
85 | var staticUrl = "http://ddragon.leagueoflegends.com/cdn/10.23.1/data/en_US/champion.json"; | 90 | var staticUrl = "http://ddragon.leagueoflegends.com/cdn/10.23.1/data/en_US/champion.json"; |
86 | request(staticUrl,function(error,response,body){ | 91 | request(staticUrl,function(error,response,body){ |
... | @@ -149,17 +154,21 @@ var rotation_champ = new Array(); | ... | @@ -149,17 +154,21 @@ var rotation_champ = new Array(); |
149 | var temp_name; | 154 | var temp_name; |
150 | var temp_point; | 155 | var temp_point; |
151 | var temp_pic; | 156 | var temp_pic; |
157 | + var temp_chamlev; | ||
152 | for(var i=0; i < champ_id.length-1; i++){//챔피언 포인트 순으로 sorting | 158 | for(var i=0; i < champ_id.length-1; i++){//챔피언 포인트 순으로 sorting |
153 | for(var j=i+1;j <champ_id.length-1; j++) | 159 | for(var j=i+1;j <champ_id.length-1; j++) |
154 | if(champ_point[i] < champ_point[j]){ | 160 | if(champ_point[i] < champ_point[j]){ |
161 | + temp_chamlev=champ_level[i]; | ||
155 | temp_id = champ_id[i]; | 162 | temp_id = champ_id[i]; |
156 | temp_name = champ_name[i]; | 163 | temp_name = champ_name[i]; |
157 | temp_point = champ_point[i]; | 164 | temp_point = champ_point[i]; |
158 | temp_pic = champ_pic[i]; | 165 | temp_pic = champ_pic[i]; |
166 | + champ_level[i]=champ_level[j]; | ||
159 | champ_id[i] = champ_id[j] | 167 | champ_id[i] = champ_id[j] |
160 | champ_name[i] = champ_name[j]; | 168 | champ_name[i] = champ_name[j]; |
161 | champ_point[i] = champ_point[j]; | 169 | champ_point[i] = champ_point[j]; |
162 | champ_pic[i] = champ_pic[j]; | 170 | champ_pic[i] = champ_pic[j]; |
171 | + champ_level[j]=champ_level[i]; | ||
163 | champ_id[j] = temp_id | 172 | champ_id[j] = temp_id |
164 | champ_name[j] = temp_name; | 173 | champ_name[j] = temp_name; |
165 | champ_point[j] = temp_point; | 174 | champ_point[j] = temp_point; |
... | @@ -198,6 +207,8 @@ var rotation_champ = new Array(); | ... | @@ -198,6 +207,8 @@ var rotation_champ = new Array(); |
198 | 207 | ||
199 | 208 | ||
200 | res.render('index', { title: req.params.username ,//데이터를 ejs로 넘길 때 사용 | 209 | res.render('index', { title: req.params.username ,//데이터를 ejs로 넘길 때 사용 |
210 | + c_lev: champ_level, | ||
211 | + c_profile: profileIcon, | ||
201 | c_id: champ_id, | 212 | c_id: champ_id, |
202 | c_name: champ_name, | 213 | c_name: champ_name, |
203 | c_point: champ_point, | 214 | c_point: champ_point, |
... | @@ -215,6 +226,7 @@ var rotation_champ = new Array(); | ... | @@ -215,6 +226,7 @@ var rotation_champ = new Array(); |
215 | }); | 226 | }); |
216 | }); | 227 | }); |
217 | }); | 228 | }); |
229 | +}); | ||
218 | }); | 230 | }); |
219 | }); | 231 | }); |
220 | }; | 232 | }; | ... | ... |
... | @@ -11,7 +11,12 @@ | ... | @@ -11,7 +11,12 @@ |
11 | <style> @import url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css");</style> | 11 | <style> @import url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css");</style> |
12 | <script> | 12 | <script> |
13 | $(document).ready(function(){ | 13 | $(document).ready(function(){ |
14 | - | 14 | + $("#enter").on("keypress",function(event){ |
15 | + if(event.keyCode==13){ | ||
16 | + var name = $("input").val(); | ||
17 | + location.href = "http://localhost:3000/search/" + name; | ||
18 | + } | ||
19 | + }); | ||
15 | 20 | ||
16 | $("button#searchButton").click(function(){ | 21 | $("button#searchButton").click(function(){ |
17 | var name = $("input").val(); | 22 | var name = $("input").val(); |
... | @@ -22,7 +27,7 @@ | ... | @@ -22,7 +27,7 @@ |
22 | </head> | 27 | </head> |
23 | <body> | 28 | <body> |
24 | 29 | ||
25 | - | 30 | + |
26 | <div class="imgOpacity"> | 31 | <div class="imgOpacity"> |
27 | <div class="center"> | 32 | <div class="center"> |
28 | <img src= "/FindMelogo.png" width = 150, height = 150/> | 33 | <img src= "/FindMelogo.png" width = 150, height = 150/> |
... | @@ -47,6 +52,7 @@ | ... | @@ -47,6 +52,7 @@ |
47 | 52 | ||
48 | <table class="basic"> | 53 | <table class="basic"> |
49 | <tbody> | 54 | <tbody> |
55 | + <tr><td> <img src= <%=c_profile%> width=120, height=120></td></tr> | ||
50 | <tr><td> <img src= <%=c_imgtier%> width=120, height=120></td></tr> | 56 | <tr><td> <img src= <%=c_imgtier%> width=120, height=120></td></tr> |
51 | <tr><td><%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%></td></tr> | 57 | <tr><td><%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%></td></tr> |
52 | <tr><td><%= "Win : " + c_wins + " / Lose : " + c_losses%></td></tr> | 58 | <tr><td><%= "Win : " + c_wins + " / Lose : " + c_losses%></td></tr> |
... | @@ -96,12 +102,17 @@ | ... | @@ -96,12 +102,17 @@ |
96 | <%}%> | 102 | <%}%> |
97 | </strong> | 103 | </strong> |
98 | </div> | 104 | </div> |
105 | + <br> | ||
106 | + | ||
99 | <% for (var i=0; i<c_id.length-1; i++){ %> | 107 | <% for (var i=0; i<c_id.length-1; i++){ %> |
100 | <div class="champImage"> | 108 | <div class="champImage"> |
101 | <div class="center"> | 109 | <div class="center"> |
102 | <img src= <%=c_pic[i]%> width=50, height=50> | 110 | <img src= <%=c_pic[i]%> width=50, height=50> |
111 | + <B> | ||
103 | <%= c_name[i] %> | 112 | <%= c_name[i] %> |
104 | - <%= "point: " + c_point[i] %> | 113 | + </B> |
114 | + <%= "point: " + c_point[i]+ " \tchampion level: " + c_lev[i] %> | ||
115 | + | ||
105 | <% } %> | 116 | <% } %> |
106 | </div> | 117 | </div> |
107 | 118 | ... | ... |
... | @@ -11,16 +11,23 @@ | ... | @@ -11,16 +11,23 @@ |
11 | <style> @import url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css");</style> | 11 | <style> @import url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css");</style> |
12 | <script> | 12 | <script> |
13 | $(document).ready(function(){ | 13 | $(document).ready(function(){ |
14 | - | 14 | + $("#enter").on("keypress",function(event){ |
15 | - | 15 | + if(event.keyCode==13){ |
16 | + var name = $("input").val(); | ||
17 | + location.href = "http://localhost:3000/search/" + name; | ||
18 | + } | ||
19 | + }); | ||
20 | + | ||
16 | $("button#searchButton").click(function(){ | 21 | $("button#searchButton").click(function(){ |
17 | var name = $("input").val(); | 22 | var name = $("input").val(); |
18 | location.href = "http://localhost:3000/search/" + name; | 23 | location.href = "http://localhost:3000/search/" + name; |
19 | }) | 24 | }) |
25 | + | ||
20 | }); | 26 | }); |
21 | </script> | 27 | </script> |
22 | </head> | 28 | </head> |
23 | <body> | 29 | <body> |
30 | + | ||
24 | <div class="imgOpacity"> | 31 | <div class="imgOpacity"> |
25 | <div class="center"> | 32 | <div class="center"> |
26 | <img src= "FindMelogo.png" width = 300, height = 300/> | 33 | <img src= "FindMelogo.png" width = 300, height = 300/> | ... | ... |
-
Please register or login to post a comment