X-Git-Url: https://gitweb.ps.run/lolstats/blobdiff_plain/cc2c4151a7641025525c1b9f51b081690d7d17a7..836aefac5aba1a288561cf1bd5a2cdb9a060097e:/html/script.js diff --git a/html/script.js b/html/script.js index 7a150c4..c2d4fd5 100644 --- a/html/script.js +++ b/html/script.js @@ -1,8 +1,95 @@ function getRegions() { - $.ajax("/lol/regions") - .done((data) => { - app.regions = JSON.parse(data); - }); + 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() { $.ajax("/lol/champions") @@ -10,16 +97,21 @@ function getChampions() { 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() { $.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() { @@ -98,9 +190,15 @@ let app = new Vue({ summoner: "", region: "", view: "", - regions: [], + regions: getRegions(), + queues: getQueues(), + champlookup: [], champions: [], - matchprops: [], + matchprops: [ + { name: "championString", text: "Champion" }, + { name: "queueString", text: "Queue" }, + { name: "timestampString", text: "Date" }, + ], matches: [], }, methods: { @@ -109,6 +207,8 @@ let app = new Vue({ if (app.view == "start") changeView("history"); setUrl(); + app.matches = []; + getMatches(); }, historyToStats: function() { changeView("stats"); @@ -121,6 +221,12 @@ let app = new Vue({ refreshHistory: function() { getMatches(); }, + selectAll: function() { + $(".champselectcb").prop('checked', true); + }, + selectNone: function() { + $(".champselectcb").prop('checked', false); + }, }, }); @@ -149,9 +255,9 @@ window.addEventListener('popstate', () => { let view = parseUrl(); changeView(view); }); -window.addEventListener('load', () => { +window.addEventListener('load', async () => { let view = parseUrl(); setView(view); - getRegions(); getChampions(); + getChampLookup(); });