treesummaryrefslogcommitdiff
path: root/html/script.js
diff options
context:
space:
mode:
authorPatrick Schönberger2018-12-13 10:57:10 +0100
committerPatrick Schönberger2018-12-13 10:57:10 +0100
commit52d1869f8b5510dab338fcabcefa48b86980a9f1 (patch)
treeb8d4edff916434afc6a4ed8135c91ce8cd1b8f56 /html/script.js
parent853f585acf864128571b4c01946d54aa0cba39c5 (diff)
downloadlolstats-52d1869f8b5510dab338fcabcefa48b86980a9f1.tar.gz
lolstats-52d1869f8b5510dab338fcabcefa48b86980a9f1.zip
sass
server champions und regionen matches angefangen
Diffstat (limited to 'html/script.js')
-rw-r--r--html/script.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/html/script.js b/html/script.js
index 25f1565..a10dd69 100644
--- a/html/script.js
+++ b/html/script.js
@@ -1,8 +1,14 @@
function getRegions() {
- return [ "euw", "na", "kr", "br" ];
+ $.ajax("/lol/regions")
+ .done((data) => {
+ app.regions = JSON.parse(data);
+ });
}
function getChampions() {
- return [ {name: "Aatrox"}, {name: "Annie"}, {name: "Braum"}, {name: "Not"} ];
+ $.ajax("/lol/champions")
+ .done((data) => {
+ app.champions = JSON.parse(data);
+ });
}
function getMatchProps() {
return [
@@ -11,10 +17,10 @@ function getMatchProps() {
];
}
function getMatches() {
- return [
- {champ: "Xerath", lane: "Middle"},
- {champ: "Quinn", lane: "Bottom"},
- ];
+ $.ajax("/lol/matches?region=" + app.region + "&summoner=" + app.summoner);
+ .done((data) => {
+ app.matches = JSON.parse(data);
+ });
}
function getInfo() {
app.summoner = $("#nameinput").val();
@@ -92,10 +98,10 @@ let app = new Vue({
summoner: "",
region: "",
view: "",
- regions: getRegions(),
- champions: getChampions(),
- matchprops: getMatchProps(),
- matches: getMatches(),
+ regions: [],
+ champions: [],
+ matchprops: [],
+ matches: [],
},
methods: {
submit: function() {
@@ -113,6 +119,7 @@ let app = new Vue({
setUrl();
},
refreshHistory: function() {
+ getMatches();
},
},
});
@@ -145,4 +152,6 @@ window.addEventListener('popstate', () => {
window.addEventListener('load', () => {
let view = parseUrl();
setView(view);
+ getRegions();
+ getChampions();
});