diff --git a/src/pfwbged/collection/pfwbcollection.js b/src/pfwbged/collection/pfwbcollection.js index a7c0836..bf3bc30 100644 --- a/src/pfwbged/collection/pfwbcollection.js +++ b/src/pfwbged/collection/pfwbcollection.js @@ -533,13 +533,23 @@ function select_metatype(elem) $('div.close', window.parent.document).click(); }); - var history_state = history.state; - if (history_state !== null) { - if (history_state.metatype !== undefined) { - var metatype = $('.metatypes [value="' + history_state.metatype + '"]'); - metatype.prop('checked', true); - metatype.trigger('change'); + /* search restoration starts here */ + + var restore_ppfwbged_search = function() { + var history_state = history.state; + if (history_state !== null) { + if (history_state.metatype !== undefined) { + var metatype = $('.metatypes [value="' + history_state.metatype + '"]'); + metatype.prop('checked', true).trigger('change'); + } } - } + }; + + var waitForQuerywidget = setInterval(function () { + if ($.querywidget.initialized_over === true) { + restore_ppfwbged_search(); + clearInterval(waitForQuerywidget); + } + }, 500); }(jQuery));