installing this new version produce al lot of options[optionKey].split is not a function errors, this cause other javascripts screwing-up, like colorbox combined on jcarousel in views.

I had to return to the previous version and all went to its place.

Comments

quicksketch’s picture

Hm interesting. What options are you passing into jCarousel? I see how this could be a problem when passing in options that are not strings.

d.sibaud’s picture

I attach herewith the exported view, so you can see how jcarousel is configured:


$view = new view;
$view->name = 'jcarousel';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Predefinite', 'default');
$handler->override_option('fields', array(
  'field_immagine_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'jcarousel__colorbox',
    'multiple' => array(
      'group' => 0,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_immagine_fid',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_fid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Sovrascrivi',
    ),
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '2' => '2',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Sovrascrivi',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', '<none>');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'jcarousel');
$handler->override_option('style_options', array(
  'wrap' => 'both',
  'skin' => 'default',
  'visible' => '4',
  'scroll' => '',
  'auto' => '10',
  'animation' => '',
  'easing' => '',
  'start' => '1',
  'autoPause' => 1,
  'vertical' => 0,
));
$handler = $view->new_display('block', 'JCAROSELLO STD', 'block_1');
$handler->override_option('style_options', array(
  'wrap' => 'both',
  'skin' => 'default',
  'visible' => '',
  'scroll' => '',
  'auto' => '10',
  'animation' => '',
  'easing' => '',
  'start' => '1',
  'autoPause' => 1,
  'vertical' => 0,
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'JCAROSELLO VINO', 'block_2');
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '3' => '3',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'override' => array(
      'button' => 'Usa predefinito',
    ),
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Usa predefinito',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'JCAROSELLO BENESSERE', 'block_3');
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '4' => '4',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'override' => array(
      'button' => 'Usa predefinito',
    ),
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Usa predefinito',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'JCAROSELLO CAMERE', 'block_4');
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '7' => '7',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'override' => array(
      'button' => 'Usa predefinito',
    ),
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Usa predefinito',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'JCAROSELLO MAREMMA', 'block_5');
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '5' => '5',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'override' => array(
      'button' => 'Usa predefinito',
    ),
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Sovrascrivi',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'JCAROSELLO RISTORANTE', 'block_6');
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '6' => '6',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'override' => array(
      'button' => 'Usa predefinito',
    ),
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Sovrascrivi',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'JCAROSELLO SATURNIA', 'block_7');
$handler->override_option('fields', array(
  'field_immagine_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'jcarousel__colorbox',
    'multiple' => array(
      'group' => 0,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_immagine_fid',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_fid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Usa predefinito',
    ),
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'carosello' => 'carosello',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_immagine_list' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_immagine_list',
    'table' => 'node_data_field_immagine',
    'field' => 'field_immagine_list',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '8' => '8',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 1,
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'override' => array(
      'button' => 'Use default',
    ),
  ),
  'content_negotiation' => array(
    'operator' => '',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'content_negotiation',
    'table' => 'node',
    'field' => 'content_negotiation',
    'override' => array(
      'button' => 'Sovrascrivi',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
quicksketch’s picture

Huh, okay I was expecting that you had used jcarousel_add() directly. I'll try out a view with your configuration and see if I can reproduce.

alanom’s picture

I'm also encountering this problem (jCarousel 6.x-2.3). From Firebug:

options[optionKey].split is not a function
[Break On This Error] var callbackParents = options[optionKey].split('.');
jcarousel.js?7 (line 17)

This happens after a completely unrelated view block elsewhere on the page with an exposed filter completes the process of loading new content after the filter is used. The new content is loaded, then the error occurs.

Hopefully that'll help with replicating the problem. It's an ordinary exposed filter using node: nid.

Here's the settings of the carousel it's clashing with, copied from view source.

Like the other guy this is a normal Views view, set up using Views UI set to jCarousel display.

{ 
"wrap": "circular", 
"scroll": 1, 
"auto": 6, 
"start": 1, 
"autoPause": 1, 
"skin": "default", 
"selector": ".jcarousel-view--Car-frontpage--block-1" 
}
echoz’s picture

Glad to find I'm not the only one.
The code added in #1009142: jCarousel callback options do not work #8 patch gives me the following error for jcarousel.js:
"TypeError: Result of expression 'options[optionKey].split' [undefined] is not a function."
while using another module on the page, when it uses thickbox. This only occurs when I have AJAX set to yes in my carousel view. I am not using jcarousel_add().
Commenting out the code added in this patch makes the error go away, and allows the thickbox implementation to work, which is broken with this code added.

alanom’s picture

Perfect! Thanks! Drupal community == awesome.

taran2l’s picture

StatusFileSize
new742 bytes

Here's a patch to fix a problem.

echoz’s picture

#7 patch fixes my issue reported in #5. Nice work Taran2l.
I repeat that I am not using jcarousel_add(), I just am using ajax in my carousel view and another module using thickbox failed to function, therefore I think someone who is using jcarousel_add() should also text this.

dgsiegel’s picture

i can confirm too that patch #7 fixes the issue i had with jcarousel and colorbox. i tried both with and without ajax in my view.

Quaranta’s picture

Status: Needs review » Active

This patch (#7) also fixed the issue with hierarchical select, nice work!

I spoke too soon, the problem is still there

joostvdl’s picture

The problem also occurs in 7.x-2.3-alpha2

I created a D7 patch for this problem on: #1053522: jcarousel breaks colorbox

echoz’s picture

Status: Active » Needs review
dzaus’s picture

Status: Active » Needs review
StatusFileSize
new2.35 KB

I ran into similar problems, and had come up with a different fix than #7 (but I like yours better). I noticed that after fixing the first javascript error, I was getting a different script error when I had another regular view (on the same page) paging with ajax.

The addition in the beginning of the attached patch (which includes #7 and some additional changes for allowing external controls) fixed my issues. When I stepped through the script in Firebug, I noticed that the behaviors.jcarousel function, which I assume binds the behaviors and sets up everything, gets run once on page load (hence context.noneName != '#document'), and again when the second view's ajax fires, at which point the context becomes the view div.content.

The conditional at the beginning prevents the behaviors from being reperformed/initialized (?) on the wrong element, I think.

jiri.motejlek’s picture

Problem seems to be solved by #13

taran2l’s picture

Hi all,

The source of the problem is in not entirely proper use of Drupal.behaviors.

Each core behavior adds behaviorname-processed class to DOM elements is being processed by particular behavior. Example(collapse.js, responsible for collapsing fieldsets):

Drupal.behaviors.collapse = function (context) {
  $('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() {

    /* function code here */

    $(this)./*another code here */
      .addClass('collapse-processed');
  });
};

The code above prevents multiple JS code execution on the same DOM element. jCarousel module doesn't make this check at all.

Patch attached to fix this problem, hope it can close this issue. Please test and review.

pieterdc’s picture

Patch from #7 works for me.
(Emfield youtube video didn't get displayed in Colorbox if within a Jcarousel.)

quicksketch’s picture

Status: Needs review » Fixed
StatusFileSize
new1.25 KB

Thanks Taran2l, your patch in #15 looks stellar. I cleaned it up slightly for coding standards and removed some extra cruft that I had in place. I've committed this patch to both branches.

quicksketch’s picture

Title: conflict with other javascript » Add guard-class and prevent JS error when using certain jCarousel options

Cleaning up title for accuracy.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.