diff --git a/index.html b/index.html index 4fc5c9e..b874f17 100644 --- a/index.html +++ b/index.html @@ -47,15 +47,14 @@ https://openfootball.github.io/questions.html
TODO
- fix setState to not remove everything 1974 two germanies? - embiggen current event flag - add sort metric below team name update ribbon hover // STRANGE EXTENDED TIME CHILE-BRAZIL (when? not 1930) - FIX BY HAND? IS BECAUE se1 IS SCORE __GOING INTO__ EXTENDED TIME - better layout + + better layout: embiggen current event flag better colors webpack 2 / css modules? + tweet it! diff --git a/js/main.js b/js/main.js index f330d4a..c1bae92 100644 --- a/js/main.js +++ b/js/main.js @@ -111,14 +111,19 @@ const main = { }, setState: (next) => { - const prev = main.getState(); + const state = main.getState(); const url = window.location.href.split('?')[0]; - const eventKey = next.eventKey || prev.eventKey; - const rounds = next.rounds || prev.rounds; - const sort = next.sort || prev.sort || null; + state.eventKey = next.eventKey || state.eventKey; + state.rounds = next.rounds || state.rounds; + state.sort = next.sort || state.sort || null; + + const params = []; + for (key in state) { + params.push(`${key}=${state[key]}`); + } - history.pushState(null, null, `${url}?eventKey=${eventKey}&sort=${sort}&rounds=${rounds}`); + history.pushState(null, null, `${url}?${params.join('&')}`); }, }