From c753dfc9a8cc42600b876a38e31eddf10ead5212 Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Mon, 3 Mar 2014 17:32:17 -0500 Subject: [PATCH] Move reload initiation to an explicit initialize function The reload initiation is required to run before other parts of the site are started so that page_params will be setup correctly. This moves that initiation out of an on ready handler to an explicit initialize call near where the rest of the app is started. (imported from commit b8994311299327aa3cfa57e3d9e92124a47123f4) --- static/js/reload.js | 5 +++-- static/js/ui.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/reload.js b/static/js/reload.js index 40d0ef4894..bfa716da20 100644 --- a/static/js/reload.js +++ b/static/js/reload.js @@ -64,9 +64,10 @@ function preserve_state(send_after_reload) { window.location.replace(url); } + // Check if we're doing a compose-preserving reload. This must be // done before the first call to get_events -$(function () { +exports.initialize = function reload__initialize() { var location = window.location.toString(); var fragment = location.substring(location.indexOf('#') + 1); if (fragment.search("reload:") !== 0) { @@ -121,7 +122,7 @@ $(function () { activity.new_user_input = false; hashchange.changehash(vars.oldhash); -}); +}; function clear_message_list(msg_list) { if (!msg_list) { return; } diff --git a/static/js/ui.js b/static/js/ui.js index 9a9454abaf..b420580bee 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -1474,6 +1474,7 @@ $(function () { } // initialize other stuff + reload.initialize(); composebox_typeahead.initialize(); search.initialize(); notifications.initialize();