"One question with this, is it possible to load these files dynamically rather than all of them every time. That way when you turn off some of the various types it would speed up page load." by nickorr

I've been trying to do this using array_diff but it's not working for me. Any proposed solution to this, even just conceptually?

CommentFileSizeAuthor
#4 shadowbox.module.zip10.2 KBnickorr
#1 shadowbox.tgz14.42 KBpsynaptic

Comments

psynaptic’s picture

StatusFileSize
new14.42 KB

I started an attempt at this but it didn't really get very far. I'm not sure what the best way to handle this would be. If anyone wants to have a look at this and get it in shape so we can commit that would be great.

nickorr’s picture

Would this sort of code work :

$flv = variable_get('shadowbox_supported_flv', shadowbox_get_types('flv'));
$quicktime = variable_get('shadowbox_supported_quicktime', shadowbox_get_types('quicktime'));

$flv_support = array_filter($flv);
$quicktime_support = array_filter($quicktime);

if (!empty($flv_support)) {
drupal_add_js($path .'/shadowbox/build/player/shadowbox-flv.js');
}
if (!empty($quicktime_support)) {
drupal_add_js($path .'/shadowbox/build/player/shadowbox-qt.js');
}

I've left lots of bits out there, but it seems to work on my testing.

Cheers,
Nick

psynaptic’s picture

I don't think so. The problem is that shadowbox seems to need the media types defined in the JS settings.

See shadowbox_get_settings().

nickorr’s picture

StatusFileSize
new10.2 KB

I've put those changes into my test version and it seems to work. I've turned off everything except quicktime and images and it only loaded those two files and the overlay thing still happened.

psynaptic’s picture

Status: Active » Postponed

I'm itching to try this out but I've just committed a massive set of changes to get the module fully working in views 2. I've done a diff against your changes to the version I uploaded. Thanks for keeping it focused, I will try this out when I get confirmation that the other fix works for everyone. If you could test it out too that would be great.

psynaptic’s picture

Assigned: Unassigned » psynaptic
psynaptic’s picture

Status: Postponed » Fixed

Ok, lack of response so I just went ahead and carried this out. Shame there are no testers today.

It works great so thanks for your help nickorr.

One caveat, and I guess it should be expected is this:

If the correct supported media option is not selected for a link to that type and you have a rel="shadowbox" on that link then it will cause a JS exception: can't find player qt. Just remove the rel="shadowbox" from that link or add the correct supported media type in the settings.

I'll try and get some more features in before making another stable release.

Status: Fixed » Closed (fixed)

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

psynaptic’s picture

Just backported this to the Drupal 5.x-2.x version.