-(function(jQuery){
-
- var methods = {
- init : function( options ) {
-
- return this.each(function(){
-
- var $this = jQuery(this),
- data = $this.data('SimpleList'), SimpleList = jQuery('<div />', { text : $this.attr('title') });
-
- // If the plugin hasn't been initialized yet
- if ( ! data ) {
-
- /* Plugin initialization */
-
- /* Subscribe to query updates */
- jQuery.subscribe('/results/' + options.query_uuid + '/changed', {instance: $this}, update_list);
-
- /* End of plugin initialization */
-
- $this.data('SimpleList', {
- options: options,
- target : $this,
- SimpleList : SimpleList
- });
-
- }
- });
- },
- destroy : function( ) {
-
- return this.each(function(){
- var $this = jQuery(this), data = $this.data('SimpleList');
- jQuery(window).unbind('SimpleList');
- data.SimpleList.remove();
- $this.removeData('SimpleList');
- })
-
+simplelist_debug=true;
+
+(function($){
+ var methods = {
+ init : function( options ) {
+ return this.each(function(){
+ var $this = $(this);
+ var data = $this.data('SimpleList');
+ /* create an empty DOM object */
+ var SimpleList = $('<div />', { text : $this.attr('title') });
+ // 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 (simplelist_debug) window.console.log('subscribing to ' + channel);
+ $this.data('SimpleList', {options: options, SimpleList : SimpleList});
+ }
+ });
+ },
+ destroy : function( ) {
+ return this.each(function(){
+ var $this = $(this), data = $this.data('SimpleList');
+ $(window).unbind('SimpleList');
+ data.SimpleList.remove();
+ $this.removeData('SimpleList');
+ })