When colorbox is enabled, it seems to add its Javascript to every page on the site, even if it isn't necessary on that page. This is a minor performance hit in any browser, but more importantly it can conflict with other JS-heavy modules.

For example, this breaks the image browser popup for WYSIWYG editors (I think across all editors.) When colorbox is enabled, Chrome reports the errors:

Uncaught TypeError: Object #

has no method 'live' (jquery.colorbox-min.js:4) Uncaught TypeError: Cannot call method 'show' of undefined (jquery.colorbox-min.js:4)
and the user can no longer use the popup to select images to go back into their rich-text editor. Rather than digging around in the unminified colorbox JS, I think it might be more useful to be able to disable colorbox on certain pages. I'm therefore attaching a patch that lets the site admin set a variable 'colorbox_paths_disabled' (using e.g. drush vset) which contains path globs where colorbox needs to be disabled. The variable I propose should be garbage-collected by colorbox_uninstall(), as with all other colorbox variables. Would appreciate feedback on this (minor) patch. Thanks for continued maintenance of the colorbox module! (This work was sponsored by Torchbox.)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

frjo’s picture

Category: bug » support

This is already possible, go to admin/settings/colorbox and at the bottom you find "Advanced settings". By default Colorbox is not active on node edit/add pages.

jp.stacey’s picture

Status: Active » Closed (works as designed)

Weird. Our configuration is as per default, so it contains admin*, node/*/edit etc. But we were definitely getting those darn errors.

The site is live now, so it's tricky to play around with it too much, but on a local dev copy I can no longer repeat the problem.

We'll close this ticket and assume for now we can remove this patch, but we'll keep on the lookout. Thanks for responding!

rjmackay’s picture

For anyone else having issues with image browser and colorbox. You need to add imagebrowser* into the 'Deactive colorbox on specific pages' configuration.

ericmulder1980’s picture

For elements using ajax callbacks, also add system/ajax to the exclusion list!