From c756fb64ab176db37eb3a8822008de1e1e4ad1a0 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 22 Jan 2014 11:11:19 +0000 Subject: [PATCH] add a simple debug() function to jquery.pazpar2() plugin, MKWS-101 The jquery.pazpar2() plugin will be called usually before the DOM ready event, so the mkws.debug_function does not exists yet. --- tools/htdocs/mkws.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 0dc511f..f7f324b 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1210,9 +1210,16 @@ function M(word) { * implement jQuery plugin $.pazpar2({}) */ function _mkws_jquery_plugin ($) { - // delayed debug, internal variables are set after dom ready + var debug_level = 1; + function debug (string) { - setTimeout(function() { mkws.debug_function(string); }, 500); + if (!debug_level) + return; + + if (typeof console === "undefined" || typeof console.log === "undefined") + return; + + console.log("jquery.pazpar2: " + string); } function init_popup(obj) { -- 1.7.10.4