various tweaks
[unfold.git] / plugins / lists / simplelist.js
index 20f2a84..46534ce 100644 (file)
@@ -10,7 +10,7 @@
 (function($){
 
     var debug=false;
-    debug=true
+    // debug=true
 
     $.fn.SimpleList = function( method ) {
         /* Method calling logic */
        init : function( options ) {
            return this.each(function(){
                var $this = $(this), data = $this.data('SimpleList');
-               // If the plugin hasn't been initialized yet
-               if ( ! data ) {
-                   /* Subscribe to query updates */
-                   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 (debug) window.console.log('subscribing to ' + channel);
-                   $this.data('SimpleList', options);
-               }
+               /* Subscribe to query updates */
+               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 (debug) window.console.log('subscribing to ' + channel);
+               $this.data('SimpleList', options);
            });
        },
        destroy : function( ) {
        $plugindiv.closest('.need-spin').spin(false);
 
         if (rows.length == 0) {
-           if (use_datatables) datatables_set_message ($table, $tbody, myslice_warning("No result"));
-           else                regular_set_message ($table, $tbody, myslice_warning("No result"));
+           if (use_datatables) datatables_set_message ($table, $tbody, unfold.warning("No result"));
+           else                regular_set_message ($table, $tbody, unfold.warning("No result"));
             return;
         }
         if (typeof rows[0].error != 'undefined') {
            var error="ERROR: " + rows[0].error;
-           if (use_datatables) datatables_set_message ($table, $tbody, myslice_error(error));
-           else                regular_set_message ($table, $tbody, myslice_error(error));
+           if (use_datatables) datatables_set_message ($table, $tbody, unfold.error(error));
+           else                regular_set_message ($table, $tbody, unfold.error(error));
             return;
         }
         var options = $plugindiv.data().SimpleList;