diff -u b/misc/ajax_facets.js b/misc/ajax_facets.js --- b/misc/ajax_facets.js +++ b/misc/ajax_facets.js @@ -497,10 +497,9 @@ * Returns query string with selected facets. */ Drupal.ajax_facets.getFacetsQuery = function() { - var filters = Drupal.ajax_facets.queryState.f.slice(0), - query = { - 'f': filters - }; + var query = { + 'f': Drupal.ajax_facets.queryState.f + }; if (Drupal.ajax_facets.queryState.query) { query.query = Drupal.ajax_facets.queryState.query; @@ -515,10 +514,6 @@ query.pages = Drupal.ajax_facets.queryState.pages; } - if (Drupal.ajax_facets.queryState['display-hidden']) { - query.display = Drupal.ajax_facets.queryState['display-hidden']; - } - return decodeURIComponent($.param(query)); }; @@ -547,9 +542,11 @@ * So before pushing new state to history we should unbind from this event and after bin again. */ Drupal.ajax_facets.pushState = function (state, title, stateUrl) { - $(window).unbind('statechange', Drupal.ajax_facets.reactOnStateChange); + var $window = $(window); + + $window.unbind('statechange', Drupal.ajax_facets.reactOnStateChange); History.pushState(state, title, stateUrl); - $(window).bind('statechange', Drupal.ajax_facets.reactOnStateChange); + $window.bind('statechange', Drupal.ajax_facets.reactOnStateChange); }; /** @@ -563,2 +560,9 @@ }; + + /** + * Initial bind to statechange event. + */ + History.Adapter.bind(window, 'statechange', function () { + Drupal.ajax_facets.reactOnStateChange(); + }); })(jQuery);