1 function getRegions() {
3 "BR": "br1.api.riotgames.com",
4 "EUNE": "eun1.api.riotgames.com",
5 "EUW": "euw1.api.riotgames.com",
6 "JP": "jp1.api.riotgames.com",
7 "KR": "kr.api.riotgames.com",
8 "LAN": "la1.api.riotgames.com",
9 "LAS": "la2.api.riotgames.com",
10 "NA": "na1.api.riotgames.com",
11 "OCE": "oc1.api.riotgames.com",
12 "TR": "tr1.api.riotgames.com",
13 "RU": "ru.api.riotgames.com",
14 "PBE": "pbe1.api.riotgames.com",
17 function getQueues() {
21 4 : "5v5 Ranked Solo",
22 6 : "5v5 Ranked Premade",
25 9 : "3v3 Ranked Flex",
26 14 : "5v5 Draft Pick",
27 16 : "5v5 Dominion Blind Pick",
28 17 : "5v5 Dominion Draft Pick",
29 25 : "Dominion Co-op vs AI",
30 31 : "Co-op vs AI Intro Bot",
31 32 : "Co-op vs AI Beginner Bot",
32 33 : "Co-op vs AI Intermediate Bot",
33 41 : "3v3 Ranked Team",
34 42 : "5v5 Ranked Team",
36 61 : "5v5 Team Builder",
39 72 : "1v1 Snowdown Showdown",
40 73 : "2v2 Snowdown Showdown",
42 76 : "Ultra Rapid Fire",
43 78 : "One For All: Mirror Mode",
44 83 : "Co-op vs AI Ultra Rapid Fire",
45 91 : "Doom Bots Rank 1",
46 92 : "Doom Bots Rank 2",
47 93 : "Doom Bots Rank 5",
51 300 : "Legend of the Poro King",
53 313 : "Black Market Brawlers",
55 317 : "Definitely Not Dominion",
58 400 : "5v5 Draft Pick",
59 410 : "5v5 Ranked Dynamic",
60 420 : "5v5 Ranked Solo",
61 430 : "5v5 Blind Pick",
62 440 : "5v5 Ranked Flex",
64 460 : "3v3 Blind Pick",
65 470 : "3v3 Ranked Flex",
66 600 : "Blood Hunt Assassin",
67 610 : "Dark Star: Singularity",
69 800 : "Co-op vs. AI Intermediate Bot",
70 810 : "Co-op vs. AI Intro Bot",
71 820 : "Co-op vs. AI Beginner Bot",
72 830 : "Co-op vs. AI Intro Bot",
73 840 : "Co-op vs. AI Beginner Bot",
74 850 : "Co-op vs. AI Intermediate Bot",
77 920 : "Legend of the Poro King",
79 950 : "Doom Bots Voting",
80 960 : "Doom Bots Standard",
81 980 : "Star Guardian Invasion: Normal",
82 990 : "Star Guardian Invasion: Onslaught",
83 1000 : "PROJECT: Hunters",
86 1030 : "Odyssey Extraction: Intro",
87 1040 : "Odyssey Extraction: Cadet",
88 1050 : "Odyssey Extraction: Crewmember",
89 1060 : "Odyssey Extraction: Captain",
90 1070 : "Odyssey Extraction: Onslaught",
94 function getChampions() {
95 $.ajax("/lol/champions")
97 app.champions = JSON.parse(data);
100 function getChampLookup() {
101 $.ajax("/lol/champlookup")
103 app.champlookup = JSON.parse(data);
106 let matchesHtml = [];
107 function getMatches() {
108 $.ajax("/lol/matches?region=" + app.region + "&summoner=" + app.summoner)
110 app.matches = JSON.parse(data);
112 matchesHtml.push("<tr><th></th><th>Game Type</th><th>Time</th></tr>");
113 for (m in app.matches) {
114 app.matches[m].championString = app.champlookup[app.matches[m].champion];
115 app.matches[m].queueString = app.queues[app.matches[m].queue];
116 app.matches[m].timestampString = new Date(app.matches[m].timestamp).toLocaleString();
117 let newTag = "<tr><td><img class='championIcon' src='http://ddragon.leagueoflegends.com/cdn/8.24.1/img/champion/" + app.matches[m].championString + ".png'></img></td>";
118 newTag = newTag.concat("<td>" + app.matches[m].queueString + "</td>");
119 newTag = newTag.concat("<td>" + app.matches[m].timestampString + "</td>");
120 newTag = newTag.concat("</tr>");
122 matchesHtml.push(newTag);
124 var clusterize = new Clusterize({
126 scrollId: 'scrollArea',
127 contentId: 'contentArea',
132 app.summoner = $("#nameinput").val();
133 app.region = $("#regionselect").val();
136 window.history.pushState("object or string", "Title",
144 function toggleStartUp() {
145 $("#start").removeClass("down");
146 $("#start").addClass("up");
148 function toggleStartDown() {
149 $("#start").removeClass("up");
150 $("#start").addClass("down");
152 function slideStartUp() {
153 $("#start").removeClass("slidedown");
154 $("#start").addClass("slideup");
156 function slideStartDown() {
157 $("#start").removeClass("slideup");
158 $("#start").addClass("slidedown");
160 function setView(view) {
161 console.log("Setting view to " + view);
162 if (view == "history") {
164 $("#matchhistory").show();
165 } else if (view == "stats") {
171 function changeView(view) {
172 let oldView = app.view;
173 console.log("changing view from " + oldView + " to " + view);
174 if (oldView == "start") {
175 if (view == "history") {
177 $("#matchhistory").show("blind", { direction: "down" }, 300);
178 } else if (view == "stats") {
180 $("#stats").show("blind", { direction: "down" }, 300);
182 } else if (oldView == "history") {
183 if (view == "start") {
184 $("#matchhistory").hide("blind", { direction: "down" }, 300);
186 } else if (view == "stats") {
187 $("#stats").show("blind", { direction: "right" });
188 $("#matchhistory").hide("blind", { direction: "left" });
190 } else if (oldView == "stats") {
191 if (view == "start") {
192 $("#stats").hide("blind", { direction: "down" }, 300);
194 } else if (view == "history") {
195 $("#matchhistory").show("blind", { direction: "left" });
196 $("#stats").hide("blind", { direction: "right" });
207 regions: getRegions(),
212 { name: "championString", text: "Champion" },
213 { name: "queueString", text: "Queue" },
214 { name: "timestampString", text: "Date" },
221 if (app.view == "start")
222 changeView("history");
227 historyToStats: function() {
231 statsToHistory: function() {
232 changeView("history");
235 refreshHistory: function() {
238 selectAll: function() {
239 $(".champselectcb").prop('checked', true);
241 selectNone: function() {
242 $(".champselectcb").prop('checked', false);
247 function parseUrl() {
248 let url = new URL(window.location.href);
249 if (url.searchParams.has("summoner")) {
250 app.summoner = url.searchParams.get("summoner");
251 $("#nameinput").val(app.summoner);
253 if (url.searchParams.has("region")) {
254 app.region = url.searchParams.get("region");
255 $("#regionselect").val(app.region);
257 if (url.searchParams.has("view")) {
258 let view = url.searchParams.get("view");
259 if (view != "start" && view != "history" && view != "stats") {
268 window.addEventListener('popstate', () => {
269 let view = parseUrl();
272 window.addEventListener('load', async () => {
273 let view = parseUrl();