Fixing URL state changer to not blow away extra params.

master
Ben Burlingham 9 years ago
parent a1c5490082
commit df6e49ac32
  1. 7
      index.html
  2. 15
      js/main.js

@ -47,15 +47,14 @@
https://openfootball.github.io/questions.html https://openfootball.github.io/questions.html
<h5>TODO</h5> <h5>TODO</h5>
fix setState to not remove everything
1974 two germanies? 1974 two germanies?
embiggen current event flag
add sort metric below team name
update ribbon hover update ribbon hover
// STRANGE EXTENDED TIME CHILE-BRAZIL (when? not 1930) - FIX BY HAND? IS BECAUE se1 IS SCORE __GOING INTO__ EXTENDED TIME // 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 better colors
webpack 2 / css modules? webpack 2 / css modules?
tweet it! tweet it!
</div> </div>
</body> </body>

@ -111,14 +111,19 @@ const main = {
}, },
setState: (next) => { setState: (next) => {
const prev = main.getState(); const state = main.getState();
const url = window.location.href.split('?')[0]; const url = window.location.href.split('?')[0];
const eventKey = next.eventKey || prev.eventKey; state.eventKey = next.eventKey || state.eventKey;
const rounds = next.rounds || prev.rounds; state.rounds = next.rounds || state.rounds;
const sort = next.sort || prev.sort || null; 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('&')}`);
}, },
} }

Loading…
Cancel
Save