From 71aa8121e550f16068eddc1365881e2ab652f8ee Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Tue, 25 Jun 2013 12:57:59 +0000 Subject: [PATCH] document, refactor for empty mkws_config object --- experiments/spclient/mkws.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 43804bf..4a6eb6d 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -3,17 +3,24 @@ "use strict"; // HTML5: disable for debug >= 2 -// global config object mkws_config +/* + * global config object: mkws_config + * + * needs to be defined in the HTML header before + * including this JS file + */ + if (!mkws_config) var mkws_config = {}; // for the guys who forgot to define mkws_config... +var mkws_debug = 1; + var pazpar2_url = mkws_config.pazpar2_url ? mkws_config.pazpar2_url : "/pazpar2/search.pz2"; var service_proxy_url = mkws_config.service_proxy_url ? mkws_config.service_proxy_url : "/service-proxy/"; var pazpar2path = mkws_config.use_service_proxy ? service_proxy_url : pazpar2_url; var usesessions = mkws_config.use_service_proxy ? false : true; -var mkws_debug = 1; var mkws_locale_lang = { "de": { @@ -468,9 +475,9 @@ function mkws_html_all(data) { } /* override standard config values by function parameters */ - for (var k in data) { - config[k] = data[k]; - debug("Set config: " + k + ' => ' + data[k]); + for (var k in config) { + mkws_config[k] = config[k]; + debug("Set config: " + k + ' => ' + config[k]); } if (mkws_config.query_width < 5 || mkws_config.query_width > 150) { debug("Reset query width: " + mkws_config.query_width); -- 1.7.10.4