X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Flists%2Fsimplelist.js;h=6fdb4c3fd6fb09868abe3334723497ca9c63ed0d;hb=e93fed6669bd5055da5683753d47df616a0108ce;hp=ab320e5efbe9e9aae554011da0d4240aa6283323;hpb=c6cb049fa23065c0c7442f3c021c92dba43c5658;p=unfold.git 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.