1

Use history for saving search state.

This commit is contained in:
Alex Yatskov 2015-02-01 19:43:34 +09:00
parent f1ce4990d4
commit 30d3bcd11c

View File

@ -35,7 +35,6 @@
function onReady(geo) { function onReady(geo) {
_ctx = { _ctx = {
log: [],
geo: geo, geo: geo,
query: {} query: {}
}; };
@ -102,7 +101,7 @@
} }
function saveSnapshot(results) { function saveSnapshot(results) {
_ctx.log.push(results); window.history.pushState(results);
} }
function outputSnapshot(results, omitValues) { function outputSnapshot(results, omitValues) {
@ -138,6 +137,12 @@
} }
} }
window.onpopstate = function(state) {
if (state.state) {
outputSnapshot(state.state, false);
}
};
$(document).on({ $(document).on({
ajaxStart: function() { ajaxStart: function() {
$('#spinner').show(); $('#spinner').show();