Closed (fixed)
Project:
Lightbox2
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
11 Aug 2007 at 13:49 UTC
Updated:
27 Sep 2007 at 15:44 UTC
Jump to comment: Most recent file
Since the LightBox Module was stopping some other javascript on a drupal website, I've made this 3 steps hack to let user choose some urls to be excluded from lightbox effects.
// Add Textarea for urls without lightbox
$form["image_node_options"]["lightbox2_disable_these_urls"] = array(
"#type" => "textarea",
"#title" => t("Disable LightBox for these urls"),
"#description" => t("Write here url where you don't want lightbox"),
"#default_value" => variable_get("lightbox2_disable_these_urls", 'path_to_exclude'),
);
function lightbox2_exclude_these_paths()
{
#use lightbox if this url is not excluded
$pass= explode ( "\n" ,variable_get("lightbox2_disable_these_urls") );
foreach ($pass as $pass_value)
{
if (strpos($_REQUEST[q], $pass_value ))
{
return 1;
}
}
return 0;
}
Original code:
if ($op == "view" && !$LIGHTBOX2_INCLUDE ) {
lightbox2_add_files();
$LIGHTBOX2_INCLUDE = true;
}
elseif ($node->type == "image" && !$LIGHTBOX2_INCLUDE) {
lightbox2_add_files();
$LIGHTBOX2_INCLUDE = true;
}
New code:
if (lightbox2_exclude_these_paths() !='1')
{
if ($op == "view" && !$LIGHTBOX2_INCLUDE ) {
lightbox2_add_files();
$LIGHTBOX2_INCLUDE = true;
}
elseif ($node->type == "image" && !$LIGHTBOX2_INCLUDE) {
lightbox2_add_files();
$LIGHTBOX2_INCLUDE = true;
}
}
This task is sponsored by www.palazzettodegliartisti.com
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | lightbox2_166461.patch | 2.85 KB | stella |
| lightbox2.module.txt | 13.12 KB | afagioli |
Comments
Comment #1
stella commentedThese changes, along with some tweaks to the suggested code, have been added to CVS and will be included in the next release. Thanks finley for your input!
Cheers,
Stella
Comment #2
stella commentedUse this patch for above changes.
Comment #3
(not verified) commentedComment #4
stella commentedThis has been released in 5.x-2.0 and 6.x-1.0. Thanks again.
Cheers,
Stella