It might make sense to use S/P Ajax module for loading scriptaculous and prototype, to avoid redundancy for users using both.

Comments

bugz_nz’s picture

Assigned: Unassigned » bugz_nz

I was worried about causing conflict when a user required the same libraries elsewhere - I wasn't aware of that module, so I will look into updating it later today.

Anonymous’s picture

ya I think this would be a good idea.

bugz you got this one then?

I'm going to create another issue which will be the start of our todo list for this module.

bugz_nz’s picture

Yep, I've got this - have been working on something which will check for the presense of S/P Ajax and use the libraries from that module if it's there, otherwise it will default to the native libraries.

BoarK’s picture

Hi guys,

I tried to tackle this problem myself but what I came up with is more like a hack, not a solution. I am adding lightbox feature to Acidfree. Since I don't want to load scriptaculous's js files on my front page, I have elected to load them only at the point where acidfree needs it. I made the call to init Spajax right before displaying the screen sized image. Here's my init code:

function lightbox2_head() {
  static $done;
  if (!$done){
    // Adding scriptaculous support files
    spajax_head(); 
    // Load required js and css files.
    $path = drupal_get_path('module', 'lightbox2');
    theme_add_style($path . '/lightbox.css');
    drupal_add_js($path . '/lightbox.js');
  }
  else {
    drupal_set_message(t('The script.aculo.us library is in not installed correctly. Please download from <a href="http://script.aculo.us/downloads">http://script.aculo.us/downloads</a>, rename directory to "scriptaculous" and place in Drupal\'s modules/spajax/ directory.'), 'error');
  }
  $done = true;
}

I can't make it any more elegant since the only thing that needs to be added for lightbox to be functional is rel="lightbox" to the img tag. There's really nothing we can use as a trigger to initialize scriptaculous.

Hope you guys come up with something better.

Nathan.

Anonymous’s picture

thanks nathan. you put ideas in my head :)

take a look at how i coded image_node.js in lightbox to make it auto set up on image nodes. That is probably the method you want to give rel="lightbox" to what you want. Don't be scared of JS :)

Thanks for the ideas on how to make this work better for us.

bugz_nz’s picture

Project: » Lightbox2
stella’s picture

Version: » master
Status: Active » Postponed

Postponing this until there is an official release of the S/P Ajax module.

stella’s picture

Status: Postponed » Closed (won't fix)

Looks like the S/P module will not be maintained going forward according to the module's maintainer in #102757. As it's extremely unlikely that there will be any official release, I'm closing this issue.