treesummaryrefslogcommitdiff
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/script.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/html/script.js b/html/script.js
index 7a150c4..1105262 100644
--- a/html/script.js
+++ b/html/script.js
@@ -2,6 +2,7 @@ function getRegions() {
$.ajax("/lol/regions")
.done((data) => {
app.regions = JSON.parse(data);
+ setTimeout(() => $("#regionselect").val(app.region), 0);
});
}
function getChampions() {
@@ -19,7 +20,13 @@ function getMatchProps() {
function getMatches() {
$.ajax("/lol/matches?region=" + app.region + "&summoner=" + app.summoner)
.done((data) => {
- app.matches = JSON.parse(data);
+ app.matches = data;
+ for (p in app.matches[0]) {
+ app.matchprops.push({
+ name: p,
+ text: p.toUpperCase(),
+ });
+ }
});
}
function getInfo() {
@@ -132,7 +139,6 @@ function parseUrl() {
}
if (url.searchParams.has("region")) {
app.region = url.searchParams.get("region");
- $("#regionselect").val(app.region);
}
if (url.searchParams.has("view")) {
let view = url.searchParams.get("view");
@@ -149,7 +155,7 @@ window.addEventListener('popstate', () => {
let view = parseUrl();
changeView(view);
});
-window.addEventListener('load', () => {
+window.addEventListener('load', async () => {
let view = parseUrl();
setView(view);
getRegions();