function getRegions() {
- return [ "euw", "na", "kr", "br" ];
+ return {
+ "BR": "br1.api.riotgames.com",
+ "EUNE": "eun1.api.riotgames.com",
+ "EUW": "euw1.api.riotgames.com",
+ "JP": "jp1.api.riotgames.com",
+ "KR": "kr.api.riotgames.com",
+ "LAN": "la1.api.riotgames.com",
+ "LAS": "la2.api.riotgames.com",
+ "NA": "na1.api.riotgames.com",
+ "OCE": "oc1.api.riotgames.com",
+ "TR": "tr1.api.riotgames.com",
+ "RU": "ru.api.riotgames.com",
+ "PBE": "pbe1.api.riotgames.com",
+ };
+}
+function getQueues() {
+ return {
+ 0 : "Custom",
+ 2 : "5v5 Blind Pick",
+ 4 : "5v5 Ranked Solo",
+ 6 : "5v5 Ranked Premade",
+ 7 : "Co-op vs AI",
+ 8 : "3v3 Normal",
+ 9 : "3v3 Ranked Flex",
+ 14 : "5v5 Draft Pick",
+ 16 : "5v5 Dominion Blind Pick",
+ 17 : "5v5 Dominion Draft Pick",
+ 25 : "Dominion Co-op vs AI",
+ 31 : "Co-op vs AI Intro Bot",
+ 32 : "Co-op vs AI Beginner Bot",
+ 33 : "Co-op vs AI Intermediate Bot",
+ 41 : "3v3 Ranked Team",
+ 42 : "5v5 Ranked Team",
+ 52 : "Co-op vs AI",
+ 61 : "5v5 Team Builder",
+ 65 : "5v5 ARAM",
+ 70 : "One for All",
+ 72 : "1v1 Snowdown Showdown",
+ 73 : "2v2 Snowdown Showdown",
+ 75 : "6v6 Hexakill",
+ 76 : "Ultra Rapid Fire",
+ 78 : "One For All: Mirror Mode",
+ 83 : "Co-op vs AI Ultra Rapid Fire",
+ 91 : "Doom Bots Rank 1",
+ 92 : "Doom Bots Rank 2",
+ 93 : "Doom Bots Rank 5",
+ 96 : "Ascension",
+ 98 : "6v6 Hexakill",
+ 100 : "5v5 ARAM",
+ 300 : "Legend of the Poro King",
+ 310 : "Nemesis",
+ 313 : "Black Market Brawlers",
+ 315 : "Nexus Siege",
+ 317 : "Definitely Not Dominion",
+ 318 : "ARURF",
+ 325 : "All Random",
+ 400 : "5v5 Draft Pick",
+ 410 : "5v5 Ranked Dynamic",
+ 420 : "5v5 Ranked Solo",
+ 430 : "5v5 Blind Pick",
+ 440 : "5v5 Ranked Flex",
+ 450 : "5v5 ARAM",
+ 460 : "3v3 Blind Pick",
+ 470 : "3v3 Ranked Flex",
+ 600 : "Blood Hunt Assassin",
+ 610 : "Dark Star: Singularity",
+ 700 : "Clash",
+ 800 : "Co-op vs. AI Intermediate Bot",
+ 810 : "Co-op vs. AI Intro Bot",
+ 820 : "Co-op vs. AI Beginner Bot",
+ 830 : "Co-op vs. AI Intro Bot",
+ 840 : "Co-op vs. AI Beginner Bot",
+ 850 : "Co-op vs. AI Intermediate Bot",
+ 900 : "ARURF",
+ 910 : "Ascension",
+ 920 : "Legend of the Poro King",
+ 940 : "Nexus Siege",
+ 950 : "Doom Bots Voting",
+ 960 : "Doom Bots Standard",
+ 980 : "Star Guardian Invasion: Normal",
+ 990 : "Star Guardian Invasion: Onslaught",
+ 1000 : "PROJECT: Hunters",
+ 1010 : "Snow ARURF",
+ 1020 : "One for All",
+ 1030 : "Odyssey Extraction: Intro",
+ 1040 : "Odyssey Extraction: Cadet",
+ 1050 : "Odyssey Extraction: Crewmember",
+ 1060 : "Odyssey Extraction: Captain",
+ 1070 : "Odyssey Extraction: Onslaught",
+ 1200 : "Nexus Blitz",
+ };
}
function getChampions() {
- return [ {name: "Aatrox"}, {name: "Annie"}, {name: "Braum"}, {name: "Not"} ];
+ $.ajax("/lol/champions")
+ .done((data) => {
+ app.champions = JSON.parse(data);
+ });
}
-function getMatchProps() {
- return [
- {text: "Champion", name: "champ"},
- {text: "Lane", name: "lane"},
- ];
+function getChampLookup() {
+ $.ajax("/lol/champlookup")
+ .done((data) => {
+ app.champlookup = JSON.parse(data);
+ });
}
function getMatches() {
- return [
- {champ: "Xerath", lane: "Middle"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- {champ: "Quinn", lane: "Bottom"},
- ];
+ $.ajax("/lol/matches?region=" + app.region + "&summoner=" + app.summoner)
+ .done((data) => {
+ app.matches = JSON.parse(data);
+ for (m in app.matches) {
+ app.matches[m].championString = app.champlookup[app.matches[m].champion];
+ app.matches[m].queueString = app.queues[app.matches[m].queue];
+ app.matches[m].timestampString = new Date(app.matches[m].timestamp).toLocaleString();
+ }
+ });
}
function getInfo() {
app.summoner = $("#nameinput").val();
if (oldView == "start") {
if (view == "history") {
slideStartUp();
- $("#matchhistory").show("slide", { direction: "down" }, 300);
+ $("#matchhistory").show("blind", { direction: "down" }, 300);
} else if (view == "stats") {
slideStartUp();
- $("#stats").show("slide", { direction: "down" }, 300);
+ $("#stats").show("blind", { direction: "down" }, 300);
}
} else if (oldView == "history") {
if (view == "start") {
- $("#matchhistory").hide("slide", { direction: "down" }, 300);
+ $("#matchhistory").hide("blind", { direction: "down" }, 300);
slideStartDown();
} else if (view == "stats") {
$("#stats").show("blind", { direction: "right" });
}
} else if (oldView == "stats") {
if (view == "start") {
- $("#stats").hide("slide", { direction: "down" }, 300);
+ $("#stats").hide("blind", { direction: "down" }, 300);
slideStartDown();
} else if (view == "history") {
$("#matchhistory").show("blind", { direction: "left" });
region: "",
view: "",
regions: getRegions(),
- champions: getChampions(),
- matchprops: getMatchProps(),
- matches: getMatches(),
+ queues: getQueues(),
+ champlookup: [],
+ champions: [],
+ matchprops: [
+ { name: "championString", text: "Champion" },
+ { name: "queueString", text: "Queue" },
+ { name: "timestampString", text: "Date" },
+ ],
+ matches: [],
},
methods: {
submit: function() {
if (app.view == "start")
changeView("history");
setUrl();
+ app.matches = [];
+ getMatches();
},
historyToStats: function() {
changeView("stats");
setUrl();
},
refreshHistory: function() {
+ getMatches();
+ },
+ selectAll: function() {
+ $(".champselectcb").prop('checked', true);
+ },
+ selectNone: function() {
+ $(".champselectcb").prop('checked', false);
},
},
});
let view = parseUrl();
changeView(view);
});
-window.addEventListener('load', () => {
+window.addEventListener('load', async () => {
let view = parseUrl();
setView(view);
+ getChampions();
+ getChampLookup();
});