From e93fed6669bd5055da5683753d47df616a0108ce Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 14 Mar 2013 14:47:55 +0100 Subject: [PATCH] minor cleanup --- plugins/lists/simplelist.js | 18 +++++++++--------- plugins/querycode/querycode.js | 13 ++++++------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/lists/simplelist.js b/plugins/lists/simplelist.js index ab320e5e..6fdb4c3f 100644 --- a/plugins/lists/simplelist.js +++ b/plugins/lists/simplelist.js @@ -7,11 +7,11 @@ * License: GPLv3 */ -simplelist_debug=false; -//simplelist_debug=true; - (function($){ + var debug=false; + //debug=true + $.fn.SimpleList = function( method ) { /* Method calling logic */ if ( methods[method] ) { @@ -33,13 +33,13 @@ simplelist_debug=false; var channel='/results/' + options.query_uuid + '/changed'; /* passing $this as 2nd arg: callbacks will retrieve $this as e.data */ $.subscribe(channel, $this, update_plugin); - if (simplelist_debug) window.console.log('subscribing to ' + channel); + if (debug) window.console.log('subscribing to ' + channel); $this.data('SimpleList', {options: options}); } }); }, destroy : function( ) { - if (simplelist_debug) console.log("SimpleList.destroy..."); + if (debug) console.log("SimpleList.destroy..."); return this.each(function(){ var $this = $(this), data = $this.data('SimpleList'); // xxx not too sure what this is about @@ -48,7 +48,7 @@ simplelist_debug=false; }); }, update : function( content ) { - if (simplelist_debug) console.log("SimpleList.update..."); + if (debug) console.log("SimpleList.update..."); }, }; // methods @@ -65,7 +65,7 @@ simplelist_debug=false; // also we may or may not have a header var $tbody=$table.find("tbody.simplelist").first(); var use_datatables = $table.hasClass("with-datatables"); - if (simplelist_debug) console.log($plugindiv.attr('id') + " udt= " + use_datatables); + if (debug) console.log($plugindiv.attr('id') + " udt= " + use_datatables); // clear the spinning wheel: look up an ancestor that has the need-spin class // do this before we might return @@ -104,7 +104,7 @@ simplelist_debug=false; } function regular_update_table ($table, $tbody, rows, key) { - if (simplelist_debug) console.log('regular_update_table ' + rows.length + " rows"); + if (debug) console.log('regular_update_table ' + rows.length + " rows"); var html=$.map(rows, function (row) { return html_row ( cell (key, row[key])); }).join(); $tbody.html(html); } @@ -116,7 +116,7 @@ simplelist_debug=false; } function datatables_update_table ($table, $tbody, rows, key) { - if (simplelist_debug) console.log('datatables_update_table ' + rows.length + " rows"); + if (debug) console.log('datatables_update_table ' + rows.length + " rows"); $table.dataTable().fnClearTable(); // the lambda here returns a [[]] because $.map is kind of broken; as per the doc: // The function can return any value to add to the array. A returned array will be flattened into the resulting array. diff --git a/plugins/querycode/querycode.js b/plugins/querycode/querycode.js index 2c912449..15f9b1e5 100644 --- a/plugins/querycode/querycode.js +++ b/plugins/querycode/querycode.js @@ -7,9 +7,6 @@ * License: GPLv3 */ -querycode_debug=false; -querycode_debug=true; - function debug_object (msg, o) { var keys=[]; for (var k in o) keys.push(k); @@ -21,6 +18,9 @@ function debug_object (msg, o) { (function($) { + var debug=false; + //debug=true; + $.fn.QueryCode = function( method ) { /* Method calling logic */ if ( methods[method] ) { @@ -44,7 +44,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 +57,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 +99,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'; -- 2.43.0