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.

Step 1) Add a textarea to the setting page where to write the url of your website to exclude

file:row [lightbox2.module:172]


	// 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'),
 	);

Step 2) Copy this function in the module (personally, I prefer to add new functions at the end of the modules)

file:row [lightbox2.module:363]


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;
}

Step 3) replace the code. It just chooses to use the lightbox for the allowed pages

file:row [lightbox2.module:96]

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;
		}
	}

More info at http://www.fagioli.biz/?q=drupal-lightbox-exclude-some-urls-effects

This task is sponsored by www.palazzettodegliartisti.com

CommentFileSizeAuthor
#2 lightbox2_166461.patch2.85 KBstella
lightbox2.module.txt13.12 KBafagioli

Comments

stella’s picture

Assigned: Unassigned » stella
Status: Active » Fixed

These 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

stella’s picture

StatusFileSize
new2.85 KB

Use this patch for above changes.

Anonymous’s picture

Status: Fixed » Closed (fixed)
stella’s picture

This has been released in 5.x-2.0 and 6.x-1.0. Thanks again.

Cheers,
Stella