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 function getMatches() {
107 $.ajax("/lol/matches?region=" + app.region + "&summoner=" + app.summoner)
109 app.matches = JSON.parse(data);
110 for (m in app.matches) {
111 app.matches[m].championString = app.champlookup[app.matches[m].champion];
112 app.matches[m].queueString = app.queues[app.matches[m].queue];
113 app.matches[m].timestampString = new Date(app.matches[m].timestamp).toLocaleString();
118 app.summoner = $("#nameinput").val();
119 app.region = $("#regionselect").val();
122 window.history.pushState("object or string", "Title",
130 function toggleStartUp() {
131 $("#start").removeClass("down");
132 $("#start").addClass("up");
134 function toggleStartDown() {
135 $("#start").removeClass("up");
136 $("#start").addClass("down");
138 function slideStartUp() {
139 $("#start").removeClass("slidedown");
140 $("#start").addClass("slideup");
142 function slideStartDown() {
143 $("#start").removeClass("slideup");
144 $("#start").addClass("slidedown");
146 function setView(view) {
147 console.log("Setting view to " + view);
148 if (view == "history") {
150 $("#matchhistory").show();
151 } else if (view == "stats") {
157 function changeView(view) {
158 let oldView = app.view;
159 console.log("changing view from " + oldView + " to " + view);
160 if (oldView == "start") {
161 if (view == "history") {
163 $("#matchhistory").show("blind", { direction: "down" }, 300);
164 } else if (view == "stats") {
166 $("#stats").show("blind", { direction: "down" }, 300);
168 } else if (oldView == "history") {
169 if (view == "start") {
170 $("#matchhistory").hide("blind", { direction: "down" }, 300);
172 } else if (view == "stats") {
173 $("#stats").show("blind", { direction: "right" });
174 $("#matchhistory").hide("blind", { direction: "left" });
176 } else if (oldView == "stats") {
177 if (view == "start") {
178 $("#stats").hide("blind", { direction: "down" }, 300);
180 } else if (view == "history") {
181 $("#matchhistory").show("blind", { direction: "left" });
182 $("#stats").hide("blind", { direction: "right" });
193 regions: getRegions(),
198 { name: "championString", text: "Champion" },
199 { name: "queueString", text: "Queue" },
200 { name: "timestampString", text: "Date" },
207 if (app.view == "start")
208 changeView("history");
213 historyToStats: function() {
217 statsToHistory: function() {
218 changeView("history");
221 refreshHistory: function() {
224 selectAll: function() {
225 $(".champselectcb").prop('checked', true);
227 selectNone: function() {
228 $(".champselectcb").prop('checked', false);
233 function parseUrl() {
234 let url = new URL(window.location.href);
235 if (url.searchParams.has("summoner")) {
236 app.summoner = url.searchParams.get("summoner");
237 $("#nameinput").val(app.summoner);
239 if (url.searchParams.has("region")) {
240 app.region = url.searchParams.get("region");
241 $("#regionselect").val(app.region);
243 if (url.searchParams.has("view")) {
244 let view = url.searchParams.get("view");
245 if (view != "start" && view != "history" && view != "stats") {
254 window.addEventListener('popstate', () => {
255 let view = parseUrl();
258 window.addEventListener('load', async () => {
259 let view = parseUrl();