Hi there,

I recently noticed, that Shoutbox breakes the behavior of other JavaScript/AJAX dependable modules. The problem occurs in my case with the modules Admin Menu and DrupalChat. In the case of Admin Menu if the menu is set to be kept always at the top of the page this doesn't happen on pages, where I have Shoutbox (SB) instances (regardless if it is just a SB block or SB Page). In the case of DrupalChat the whole chat block breaks (it stays just Chat (Loading) and the block doesn't get themed).

As I said this happens only on pages, where I have a Shoutbox instance. Removing the SB block resolves the problem, but I need to use Shoutbox module...

Any ideas where the problem might be? Thanks in advance!!!

Comments

nibo’s picture

Forgot to mention the test environment: tried it on Firefox 3.6.7 and IE 7 and with versions 6.x-2.0 and 6.x-2.1 with the same results.

nibo’s picture

Title: Shoutbox breakes the behavior of other JavaScript/AJAX dependable modules » 'Shoutbox' and 'jQuery Update v2.0' Modules incompatible
Component: User interface » Code

Just noticed, that the problem is somehow to the jQuery Update 6.x-2.0 module related.

mstef’s picture

Category: bug » support

I've never tested with jQuery Update so I can't really comment on the matter.

nibo’s picture

Should I post this issue also on the jQuery Update issues page ?

mstef’s picture

No, jQuery Update does just what it says; update jQuery..

Shoutbox was written to work with the jQuery that ships with core (1.2.6). I'm sure the changes needed are minimal. If you could track down which part of Shoutbox breaks with jQuery update, I'll be glad to fix it. Then, hopefully, it'll work with any jQuery.

Install Firebug and use the Console to check out any JS errors/warning.

nibo’s picture

Hello Mike,

thanks for the help!!!

I have following exception: uncaught exception: Syntax error, unrecognized expression: [@name='nextcolor']

So after googling I found, that in jQuery 1.3 the '@' syntax is no more supported.
So after surrounding the problem block in shoutbox-form.js with a try/catch statement everything worked fine (for now, I hope other modules does not crash as well ...):

  try{
      $("input[@name='nextcolor']").val(Drupal.settings.shoutbox.color);
  }catch(e){
      $("input[name='nextcolor']").val(Drupal.settings.shoutbox.color);
  }

I know I'm not suppose to hack the module, but I didn't wanted to burden you with my single case ...

Once again thanks for the big help and for the nice module!!!

mstef’s picture

maybe it would be best to just get rid of the @ all together. That came over from the 1.x branch.

What exactly is @ an operator for? Look in docs.jquery.com under selectors. Find one that works across the board and I'll switch it.

nibo’s picture

This is what i found:
"Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the “@” symbol from your selectors in order to make them work again."
Source: http://api.jquery.com/category/selectors/attribute-selectors/

Seems to me that the '@' was standing there for 'attribute' and if the 1.x branch of Shoutbox was using jQuery 1.1, than it was simply transferred to the 2.x branch. Since the '@' was deprecated from jQuery 1.2, removing it should not affect the performance ... but I am relatively new to Drupal and not really the best coder out there, so I'm not the perfect reference for module changes ;)

mstef’s picture

I'll test it out..and if works good, i'll bring in the changes...

Nice job on the research

mstef’s picture

Status: Active » Fixed

Committed

Status: Fixed » Closed (fixed)

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

protoplasm’s picture

Since upgrading from 6.x-2.1 to latest stable 6.x-2.3 and also with the latest dev I get system errors (I presume) from my shoutbox embedded in a panel page. I am getting a thin pink line without an error comment in the shoutbox itself with no obvious related error in the error console box. Watchdog is throwing a myriad of these errors:

Duplicate entry 'admin/build/panels/layouts/list/%/export' for key 1 query: INSERT INTO menu_router (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, type, block_callback, description, position, weight, file) VALUES ('admin/build/panels/layouts/list/%/export', 'a:1:{i:5;a:1:{s:21:\"ctools_export_ui_load\";a:1:{i:0;s:14:\"panels_layouts\";}}}', '', 'ctools_export_ui_task_access', 'a:3:{i:0;s:14:\"panels_layouts\";i:1;s:6:\"export\";i:2;i:5;}', 'ctools_export_ui_switcher_page', 'a:3:{i:0;s:14:\"panels_layouts\";i:1;s:6:\"export\";i:2;i:5;}', 125, 7, 'admin/build/panels/layouts/list/%', 'admin/build/panels/layouts/list/%', 'Export', 't', '', 128, '', '', '', 0, 'sites/all/modules/ctools/includes/export-ui.inc') in /.../includes/menu.inc on line 2457.

Disabling the shoutbox eliminates the error messages.

Before with 6.x-2.1, I was getting uncaught exception: Syntax error, unrecognized expression: [@name='nextcolor'] errors but at least the shoutbox was more functional.

Reverting to 6.x-2.1 gives me a functional shoutbox with just the javascript error mentioned above.

Sorry, my issue is not related to this thread. Manually removing the @ symbol from the .js file in 6.x-2.1 does fix the problem. The new problem with shoutbox embedded in panels must be a different issue than this with 6.x-2.3 and 6.x-2.x-dev.