I've built a postcard plugin (of sorts) which allows a user, from the image page, to create and send a postcard with corresponding image, a background, some text, etc.
I'm using zenpage. What the user sees is a UI embedded within the image page which does an ajax json post to a handler which builds a .jpg from all the bits and pieces (the image, the text, the background), and emails it to the recipient.
In testing to see that it worked properly in 1.4, I stumbled across a condition that I can't quite understand. It seems I had managed to disable colorbox for image. Without colorbox enabled, whenever I did my post, the page would refresh and parameters that should have posted would appear in the URL (like a get).
With colorbox enabled, everything works just fine...a seamless ajax json post, response, no problem.
When I built this (obviously with colorbox enabled), I was leveraging the fact that jQuery "just seemed to be there" for my use. I can sort of see where jQuery might not be available unless colorbox is enabled - you probably wouldn't load the library unless you had to for performance reasons. The strange thing is that I've got lots of other jQuery built into the postcard UI, and it all remains functional regardless of colorbox settings...same with the navigation within my sidebar calendar.
I don't like the idea of relying on obscure dependencies, but I don't really like the idea of loading jQuery twice too if I were to include it in the postcard plugin and link it in. Any thoughts on the behavior and/or how to deal with it?
Comments
Also, Colorbox is now a plugin that just loads its JS stuff if directly enabled for a theme page via the plugin options. It does not add the code to acutally setup a colorbox. That needs to be done additionally on the theme directly.
Or maybe you load in the wrong order? Another possibility is that you use a plugin of jQuery UI we don't have included which the colorbox for some reason provides for its own dependencies.
The theme I'm using is the default zenpage (with a few styling changes).
It seems that the plugin developer would be wise to (re)include jQuery if their plugin dependeds on it so that they could be sure that all of the relevant functions are available.
Maybe something to think about - let there be a generic all-inclusive jQuery plugin-support plugin. Like colorbox, you'd choose which pages it would load with, it load the library only once per pageload, and it would contain all of the latest greatest jQuery core functions without having to load them multiple times for different plugins.