"use strict"; // HTML5: disable for debug_level >= 2
-// Wrapper for jQuery
-(function ($) {
-
// Set up namespace and some state.
var mkws = {};
if (!mkws_config)
var mkws_config = {};
+// Wrapper for jQuery
+(function ($) {
+
mkws.locale_lang = {
"de": {
"Authors": "Autoren",
}
var debug = mkws.debug_function; // local alias
-/* default mkws config */
-/* ### No defaults given for:
- * lang, service_proxy_auth and of course the optional language_* entries.
- */
-var config_default = {
- use_service_proxy: true,
- sort_options: [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]],
- perpage_options: [10, 20, 30, 50],
- sort_default: "relevance",
- perpage_default: 20,
- query_width: 50,
- show_lang: true, /* show/hide language menu */
- show_sort: true, /* show/hide sort menu */
- show_perpage: true, /* show/hide perpage menu */
- lang_options: [], /* display languages links for given languages, [] for all */
- facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
- responsive_design_width: undefined, /* a page with less pixel width considered as narrow */
- debug_level: 1, /* debug level for development: 0..2 */
-
- dummy: "dummy"
-};
-
-/* set global debug_level flag early */
-if (typeof mkws_config.debug_level !== 'undefined') {
- mkws.debug_level = mkws_config.debug_level;
-} else if (typeof config_default.debug_level !== 'undefined') {
- mkws.debug_level = config_default.debug_level;
-}
-
-/* override standard config values by function parameters */
-for (var k in config_default) {
- if (typeof mkws_config[k] === 'undefined')
- mkws_config[k] = config_default[k];
- debug("Set config: " + k + ' => ' + mkws_config[k]);
+{
+ /* default mkws config */
+ var config_default = {
+ use_service_proxy: true,
+ service_proxy_auth: "http://mkws.indexdata.com/service-proxy-auth",
+ lang: "",
+ sort_options: [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]],
+ perpage_options: [10, 20, 30, 50],
+ sort_default: "relevance",
+ perpage_default: 20,
+ query_width: 50,
+ show_lang: true, /* show/hide language menu */
+ show_sort: true, /* show/hide sort menu */
+ show_perpage: true, /* show/hide perpage menu */
+ lang_options: [], /* display languages links for given languages, [] for all */
+ facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
+ responsive_design_width: undefined, /* a page with less pixel width considered as narrow */
+ debug_level: 1, /* debug level for development: 0..2 */
+
+ dummy: "dummy"
+ };
+
+ /* set global debug_level flag early */
+ if (typeof mkws_config.debug_level !== 'undefined') {
+ mkws.debug_level = mkws_config.debug_level;
+ } else if (typeof config_default.debug_level !== 'undefined') {
+ mkws.debug_level = config_default.debug_level;
+ }
+
+ /* override standard config values by function parameters */
+ for (var k in config_default) {
+ if (typeof mkws_config[k] === 'undefined')
+ mkws_config[k] = config_default[k];
+ debug("Set config: " + k + ' => ' + mkws_config[k]);
+ }
}
if (mkws_config.query_width < 5 || mkws_config.query_width > 150) {
var lang = key.replace(/^language_/, "");
// Copy custom languages into list
mkws.locale_lang[lang] = mkws_config[key];
+ debug("Added locally configured language '" + lang + "'");
}
}
}
stat.innerHTML = '<span class="head">Status info</span>' +
' -- ' +
- '<span class="clients">' + data.activeclients + '/' + data.clients + '</span>' +
+ '<span class="clients">Active clients: ' + data.activeclients + '/' + data.clients + '</span>' +
' -- ' +
- '<span class="records">' + data.records + '/' + data.hits + '</span>';
+ '<span class="records">Retrieved records: ' + data.records + '/' + data.hits + '</span>';
}
function my_onterm(data) {
}
function mkws_set_lang() {
- var lang = $.parseQuerystring().lang || mkws_config.lang || "";
+ var lang = $.parseQuerystring().lang || mkws_config.lang;
if (!lang || !mkws.locale_lang[lang]) {
mkws_config.lang = ""
} else {
if (key == mkws_config.sort_default) {
sort_html += ' selected="selected"';
}
- sort_html += '>' + val + '</option>';
+ sort_html += '>' + M(val) + '</option>';
}
sort_html += '</select>';
* for the site.
*/
function mkws_service_proxy_auth(auth_url) {
- if (!auth_url)
- auth_url = "http://mkws.indexdata.com/service-proxy-auth";
-
debug("Run service proxy auth URL: " + auth_url);
var request = new pzHttpRequest(auth_url, function(err) {
if (!lang || !mkws.locale_lang[lang])
return word;
- return mkws.locale_lang[lang][word] ? mkws.locale_lang[lang][word] : word;
+ return mkws.locale_lang[lang][word] || word;
}
/*