function getRegions() {
- return [ "euw", "na", "kr", "br" ];
+ $.ajax("/lol/regions")
+ .done((data) => {
+ app.regions = JSON.parse(data);
+ setTimeout(() => $("#regionselect").val(app.region), 0);
+ });
}
function getChampions() {
- return [ {name: "Aatrox"}, {name: "Annie"}, {name: "Braum"}, {name: "Not"} ];
+ $.ajax("/lol/champions")
+ .done((data) => {
+ app.champions = JSON.parse(data);
+ });
}
function getMatchProps() {
return [
];
}
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 = data;
+ for (p in app.matches[0]) {
+ app.matchprops.push({
+ name: p,
+ text: p.toUpperCase(),
+ });
+ }
+ });
}
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" });
summoner: "",
region: "",
view: "",
- regions: getRegions(),
- champions: getChampions(),
- matchprops: getMatchProps(),
- matches: getMatches(),
+ regions: [],
+ champions: [],
+ matchprops: [],
+ matches: [],
},
methods: {
submit: function() {
setUrl();
},
refreshHistory: function() {
+ getMatches();
},
},
});
}
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");
let view = parseUrl();
changeView(view);
});
-window.addEventListener('load', () => {
+window.addEventListener('load', async () => {
let view = parseUrl();
setView(view);
+ getRegions();
+ getChampions();
});