From 6048ca4e831ca2b9153ba1f363c76f745db3b0c3 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 8 Apr 2014 11:19:06 +0100 Subject: [PATCH] Move saved_config code inside $(document).ready(function() {} block. It DOES work there -- I don't know why I thought before it didn't. (I was probably confused by the difficulty of dealing with a variable that may or may not have been defined.) Fixes bug MKWS-149. --- src/mkws-core.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/mkws-core.js b/src/mkws-core.js index 9668cd1..01f82c8 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -302,21 +302,15 @@ mkws.pagerNext = function(tname) { } } - - // I don't understand why I need this copy, but I do: mkws_config - // is not visible inside the document.ready function, but the - // saved copy is. - var saved_config; - if (typeof mkws_config === 'undefined') { - log("setting empty config"); - saved_config = {}; - } else { - log("using config: " + $.toJSON(mkws_config)); - saved_config = mkws_config; - } - - $(document).ready(function() { + var saved_config; + if (typeof mkws_config === 'undefined') { + log("setting empty config"); + saved_config = {}; + } else { + log("using config: " + $.toJSON(mkws_config)); + saved_config = mkws_config; + } mkws.setMkwsConfig(saved_config); for (var key in mkws.config) { -- 1.7.10.4