projects
/
mkws-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
switch from "jquery" to "jQuery" module
[mkws-moved-to-github.git]
/
tools
/
htdocs
/
mkws.js
diff --git
a/tools/htdocs/mkws.js
b/tools/htdocs/mkws.js
index
cb3e973
..
5ea0ce9
100644
(file)
--- a/
tools/htdocs/mkws.js
+++ b/
tools/htdocs/mkws.js
@@
-1,4
+1,4
@@
-/* MKWS, the MasterKey Widget Set. Copyright (C) 2013, Index Data */
+/*! MKWS, the MasterKey Widget Set. Copyright (C) 2013, Index Data */
"use strict"; // HTML5: disable for debug_level >= 2
"use strict"; // HTML5: disable for debug_level >= 2
@@
-15,8
+15,9
@@
var mkws = {
* Needs to be defined in the HTML header before including this JS file.
* Define empty mkws_config for simple applications that don't define it.
*/
* Needs to be defined in the HTML header before including this JS file.
* Define empty mkws_config for simple applications that don't define it.
*/
-if (!mkws_config)
+if (mkws_config == null || typeof mkws_config != 'object') {
var mkws_config = {};
var mkws_config = {};
+}
// Wrapper for jQuery
(function ($) {
// Wrapper for jQuery
(function ($) {
@@
-88,7
+89,7
@@
mkws.debug_function = function (string) {
}
var now = $.now();
}
var now = $.now();
- var timestamp = (now - mkws.debug_time.start)/1000 + " (+" + (now - mkws.debug_time.last)/1000 + ") "
+ var timestamp = ((now - mkws.debug_time.start)/1000).toFixed(3) + " (+" + ((now - mkws.debug_time.last)/1000).toFixed(3) + ") "
mkws.debug_time.last = now;
// you need to disable use strict at the top of the file!!!
mkws.debug_time.last = now;
// you need to disable use strict at the top of the file!!!
@@
-156,6
+157,7
@@
Handlebars.registerHelper('commaList', function(items, options) {
{
{
+
/* default mkws config */
var config_default = {
use_service_proxy: true,
/* default mkws config */
var config_default = {
use_service_proxy: true,
@@
-185,6
+187,12
@@
Handlebars.registerHelper('commaList', function(items, options) {
mkws.debug_level = config_default.debug_level;
}
mkws.debug_level = config_default.debug_level;
}
+ // make sure the mkws_config is a valid hash
+ if (!$.isPlainObject(mkws_config)) {
+ debug("ERROR: mkws_config is not an JS object, ignore it....");
+ mkws_config = {};
+ }
+
/* override standard config values by function parameters */
for (var k in config_default) {
if (typeof mkws_config[k] === 'undefined')
/* override standard config values by function parameters */
for (var k in config_default) {
if (typeof mkws_config[k] === 'undefined')
@@
-422,7
+430,7
@@
function onFormSubmitEventHandler()
function newSearch(query, sort, targets)
{
debug("newSearch: " + query);
function newSearch(query, sort, targets)
{
debug("newSearch: " + query);
-
+
if (mkws_config.use_service_proxy && !mkws.authenticated) {
alert("searching before authentication");
return;
if (mkws_config.use_service_proxy && !mkws.authenticated) {
alert("searching before authentication");
return;