X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fquerycode%2Fquerycode.js;h=e8719c3a9d5db49440dd518d4d52b58df3fdd24d;hb=a2ae7986853adb271361957a08effd0c9537e7a3;hp=2c912449d06e7357cc88e07fccee933dd2e1241e;hpb=c6cb049fa23065c0c7442f3c021c92dba43c5658;p=unfold.git diff --git a/plugins/querycode/querycode.js b/plugins/querycode/querycode.js index 2c912449..e8719c3a 100644 --- a/plugins/querycode/querycode.js +++ b/plugins/querycode/querycode.js @@ -7,20 +7,14 @@ * License: GPLv3 */ -querycode_debug=false; -querycode_debug=true; - -function debug_object (msg, o) { - var keys=[]; - for (var k in o) keys.push(k); - console.log (msg + " Keys : " + keys); -} - // xxx TODO // . turn back on syntax highlighting (function($) { + var debug=false; + //debug=true; + $.fn.QueryCode = function( method ) { /* Method calling logic */ if ( methods[method] ) { @@ -44,7 +38,7 @@ function debug_object (msg, o) { var channel='/results/' + options.query_uuid + '/updated'; /* passing $this as 2nd arg: callbacks will retrieve $this as e.data */ $.subscribe(channel, $this, update_plugin); - if (querycode_debug) window.console.log('subscribing to ' + channel); + if (debug) console.log('subscribing to ' + channel); $this.data('QueryCode', {options: options}); // react to changes to the language selector $this.find(".querycode-lang").change(change_language); @@ -57,10 +51,10 @@ function debug_object (msg, o) { }, // destroy : function( ) { -// if (querycode_debug) console.log("QueryCode.destroy..."); +// if (debug) console.log("QueryCode.destroy..."); // }, // update : function( content ) { -// if (querycode_debug) console.log("QueryCode.update..."); +// if (debug) console.log("QueryCode.update..."); // }, } // methods @@ -99,7 +93,6 @@ function debug_object (msg, o) { // private stuff function translate_query_as_ruby (query) { - debug_object("query_ruby entering -- query=" + query, query); var output = '# Connection to XMLRPC server\n'; output += 'require "xmlrpc/client"\n'; output += 'require "pp"\n'; @@ -132,7 +125,7 @@ function debug_object (msg, o) { }); ofs = '[' + ofs + ']'; - output += 'pp srv.call("' + title_case(query.action) +'", auth, "' + query.method + '", "' + query.timestamp + '", ' + ifs + ', ' + ofs + ')'; + output += 'pp srv.call("' + mixed_case(query.action) +'", auth, "' + query.method + '", "' + query.timestamp + '", ' + ifs + ', ' + ofs + ')'; var output = '
' + output + "
"; return output; @@ -165,12 +158,12 @@ function debug_object (msg, o) { }); ofs = '[' + ofs + ']'; - output += 'srv.' + title_case(query.action) + '(auth, "' + query.method + '", ' + ifs + ', {}, ' + ofs + ')'; + output += 'srv.' + mixed_case(query.action) + '(auth, "' + query.method + '", ' + ifs + ', {}, ' + ofs + ')'; var output = '
' + output + "
"; return output; } - function title_case (txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();} + function mixed_case (txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();} })(jQuery); // end closure wrapper