Loading js/views_ajax_history.js +21 −7 Original line number Diff line number Diff line Loading @@ -125,6 +125,25 @@ return url[0] + (query.length ? '?' + query.join('&') : ''); }; /** * Remove the functions from the state. They can't been pushed into the history. * * @param state * Object containing the state to be cleaned. * * @return state * Object that has been cleaned up. */ var cleanStateForHistory = function (state) { var stateWithNoFunctions = {}; for (var key in state) { if (typeof state[key] !== "function") { stateWithNoFunctions[key] = state[key]; } } return stateWithNoFunctions; }; /** * Parse a URL query string. * Loading Loading @@ -152,17 +171,12 @@ */ var addState = function (options, url) { // The data in the history state must be serializable. var historyOptions = $.extend({}, options) delete historyOptions.beforeSend; delete historyOptions.beforeSerialize; delete historyOptions.beforeSubmit; delete historyOptions.complete; delete historyOptions.success; var historyOptions = $.extend({}, options); // Store the actual view's dom id. drupalSettings.viewsAjaxHistory.lastViewDomID = options.data.view_dom_id; $(window).unbind('popstate', loadView); history.pushState(historyOptions, document.title, cleanURL(url, options.data)); history.pushState(cleanStateForHistory(historyOptions), document.title, cleanURL(url, options.data)); $(window).bind('popstate', loadView); }; Loading Loading
js/views_ajax_history.js +21 −7 Original line number Diff line number Diff line Loading @@ -125,6 +125,25 @@ return url[0] + (query.length ? '?' + query.join('&') : ''); }; /** * Remove the functions from the state. They can't been pushed into the history. * * @param state * Object containing the state to be cleaned. * * @return state * Object that has been cleaned up. */ var cleanStateForHistory = function (state) { var stateWithNoFunctions = {}; for (var key in state) { if (typeof state[key] !== "function") { stateWithNoFunctions[key] = state[key]; } } return stateWithNoFunctions; }; /** * Parse a URL query string. * Loading Loading @@ -152,17 +171,12 @@ */ var addState = function (options, url) { // The data in the history state must be serializable. var historyOptions = $.extend({}, options) delete historyOptions.beforeSend; delete historyOptions.beforeSerialize; delete historyOptions.beforeSubmit; delete historyOptions.complete; delete historyOptions.success; var historyOptions = $.extend({}, options); // Store the actual view's dom id. drupalSettings.viewsAjaxHistory.lastViewDomID = options.data.view_dom_id; $(window).unbind('popstate', loadView); history.pushState(historyOptions, document.title, cleanURL(url, options.data)); history.pushState(cleanStateForHistory(historyOptions), document.title, cleanURL(url, options.data)); $(window).bind('popstate', loadView); }; Loading