1 function getRegions() {
2 return [ "euw", "na", "kr", "br" ];
4 function getChampions() {
5 return [ {name: "Aatrox"}, {name: "Annie"}, {name: "Braum"}, {name: "Not"} ];
7 function getMatchProps() {
9 {text: "Champion", name: "champ"},
10 {text: "Lane", name: "lane"},
13 function getMatches() {
15 {champ: "Xerath", lane: "Middle"},
16 {champ: "Quinn", lane: "Bottom"},
17 {champ: "Quinn", lane: "Bottom"},
18 {champ: "Quinn", lane: "Bottom"},
19 {champ: "Quinn", lane: "Bottom"},
20 {champ: "Quinn", lane: "Bottom"},
21 {champ: "Quinn", lane: "Bottom"},
22 {champ: "Quinn", lane: "Bottom"},
23 {champ: "Quinn", lane: "Bottom"},
24 {champ: "Quinn", lane: "Bottom"},
25 {champ: "Quinn", lane: "Bottom"},
26 {champ: "Quinn", lane: "Bottom"},
27 {champ: "Quinn", lane: "Bottom"},
28 {champ: "Quinn", lane: "Bottom"},
29 {champ: "Quinn", lane: "Bottom"},
30 {champ: "Quinn", lane: "Bottom"},
31 {champ: "Quinn", lane: "Bottom"},
32 {champ: "Quinn", lane: "Bottom"},
33 {champ: "Quinn", lane: "Bottom"},
34 {champ: "Quinn", lane: "Bottom"},
35 {champ: "Quinn", lane: "Bottom"},
36 {champ: "Quinn", lane: "Bottom"},
37 {champ: "Quinn", lane: "Bottom"},
38 {champ: "Quinn", lane: "Bottom"},
39 {champ: "Quinn", lane: "Bottom"},
40 {champ: "Quinn", lane: "Bottom"},
41 {champ: "Quinn", lane: "Bottom"},
42 {champ: "Quinn", lane: "Bottom"},
43 {champ: "Quinn", lane: "Bottom"},
44 {champ: "Quinn", lane: "Bottom"},
45 {champ: "Quinn", lane: "Bottom"},
46 {champ: "Quinn", lane: "Bottom"},
47 {champ: "Quinn", lane: "Bottom"},
48 {champ: "Quinn", lane: "Bottom"},
49 {champ: "Quinn", lane: "Bottom"},
50 {champ: "Quinn", lane: "Bottom"},
51 {champ: "Quinn", lane: "Bottom"},
52 {champ: "Quinn", lane: "Bottom"},
53 {champ: "Quinn", lane: "Bottom"},
54 {champ: "Quinn", lane: "Bottom"},
55 {champ: "Quinn", lane: "Bottom"},
56 {champ: "Quinn", lane: "Bottom"},
57 {champ: "Quinn", lane: "Bottom"},
58 {champ: "Quinn", lane: "Bottom"},
59 {champ: "Quinn", lane: "Bottom"},
60 {champ: "Quinn", lane: "Bottom"},
61 {champ: "Quinn", lane: "Bottom"},
62 {champ: "Quinn", lane: "Bottom"},
63 {champ: "Quinn", lane: "Bottom"},
64 {champ: "Quinn", lane: "Bottom"},
65 {champ: "Quinn", lane: "Bottom"},
66 {champ: "Quinn", lane: "Bottom"},
67 {champ: "Quinn", lane: "Bottom"},
68 {champ: "Quinn", lane: "Bottom"},
69 {champ: "Quinn", lane: "Bottom"},
70 {champ: "Quinn", lane: "Bottom"},
71 {champ: "Quinn", lane: "Bottom"},
72 {champ: "Quinn", lane: "Bottom"},
76 app.summoner = $("#nameinput").val();
77 app.region = $("#regionselect").val();
80 window.history.pushState("object or string", "Title",
88 function toggleStartUp() {
89 $("#start").removeClass("down");
90 $("#start").addClass("up");
92 function toggleStartDown() {
93 $("#start").removeClass("up");
94 $("#start").addClass("down");
96 function slideStartUp() {
97 $("#start").removeClass("slidedown");
98 $("#start").addClass("slideup");
100 function slideStartDown() {
101 $("#start").removeClass("slideup");
102 $("#start").addClass("slidedown");
104 function setView(view) {
105 console.log("Setting view to " + view);
106 if (view == "history") {
108 $("#matchhistory").show();
109 } else if (view == "stats") {
115 function changeView(view) {
116 let oldView = app.view;
117 console.log("changing view from " + oldView + " to " + view);
118 if (oldView == "start") {
119 if (view == "history") {
121 $("#matchhistory").show("slide", { direction: "down" }, 300);
122 } else if (view == "stats") {
124 $("#stats").show("slide", { direction: "down" }, 300);
126 } else if (oldView == "history") {
127 if (view == "start") {
128 $("#matchhistory").hide("slide", { direction: "down" }, 300);
130 } else if (view == "stats") {
131 $("#stats").show("blind", { direction: "right" });
132 $("#matchhistory").hide("blind", { direction: "left" });
134 } else if (oldView == "stats") {
135 if (view == "start") {
136 $("#stats").hide("slide", { direction: "down" }, 300);
138 } else if (view == "history") {
139 $("#matchhistory").show("blind", { direction: "left" });
140 $("#stats").hide("blind", { direction: "right" });
151 regions: getRegions(),
152 champions: getChampions(),
153 matchprops: getMatchProps(),
154 matches: getMatches(),
159 if (app.view == "start")
160 changeView("history");
163 historyToStats: function() {
167 statsToHistory: function() {
168 changeView("history");
171 refreshHistory: function() {
176 function parseUrl() {
177 let url = new URL(window.location.href);
178 if (url.searchParams.has("summoner")) {
179 app.summoner = url.searchParams.get("summoner");
180 $("#nameinput").val(app.summoner);
182 if (url.searchParams.has("region")) {
183 app.region = url.searchParams.get("region");
184 $("#regionselect").val(app.region);
186 if (url.searchParams.has("view")) {
187 let view = url.searchParams.get("view");
188 if (view != "start" && view != "history" && view != "stats") {
197 window.addEventListener('popstate', () => {
198 let view = parseUrl();
201 window.addEventListener('load', () => {
202 let view = parseUrl();