Open the contact form, close with X, open again, close. Have a look at the contact link path. Keeps getting "lightbox2" added to path.

ie: http://www.example.com/contact/lightbox2/lightbox2/lightbox2/lightbox2

I managed to rectify this in lightbox_modal.js, changing:

function lightbox2_contact() {
  $("a[@href*='/contact']),...

to...

function lightbox2_contact() {
  $("a[@href*='/contact']:not([href*=lightbox2]),...

This would probably effect login too.

Comments

stella’s picture

Status: Active » Closed (works as designed)

This is by design, so none of the sidebars, etc, are included in the lightbox, just the form.

Cheers,
Stella

Christopher Herberte’s picture

Status: Closed (works as designed) » Active

Please reread the issue. The code i posted checks for the existence of the lightbox2 path and does not add it if it's already there.
Look:
http://www.example.com/contact/lightbox2/lightbox2/lightbox2/lightbox2

Is this necessary?

It is undesirable where I want to read additional parameters from url.

stella’s picture

Status: Active » Needs review
elanghout’s picture

Suggested (better?) solution. Will only add lightbox to links where needed and puts rel:lightmodal on all lightbox links.

function lightbox2_login() {
$("a[@href*='/user/login'][@href!='/user/login/lightbox2'], a[@href*='?q=user/login'][@href!='?q=user/login/lightbox2']").each(function() {
$(this).attr({
href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
});
});
$("a[@href*='/user/login/lightbox2'], a[@href*='?q=user/login/lightbox2']").each(function() {
$(this).attr({
rel: 'lightmodal[|width:250px; height:210px;]'
});
});
}

function lightbox2_contact() {
$("a[@href*='/contact'][@href!='/contact/lightbox2'], a[@href*='?q=contact'][@href!='?q=contact/lightbox2']").each(function() {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
});
});
$("a[@href*='/contact/lightbox2'], a[@href*='?q=contact/lightbox2']").each(function() {
$(this).attr({
rel: 'lightmodal[|width:450px; height:450px;]'
});
});
}

Monzer Emam’s picture

nither both worked in my test.

Monzer Emam’s picture

the following done it ;)
only changed " @href*= " ---------to-------> " @href$= " in 4 places

function lightbox2_login() {
$("a[@href$='/user/login'], a[@href$='?q=user/login']").each(function() {
$(this).attr({
href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
rel: 'lightmodal[|width:250px; height:210px;]'
});
});
}

function lightbox2_contact() {
$("a[@href$='/contact'], a[@href$='?q=contact']").each(function() {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
rel: 'lightmodal[|width:650px; height:450px;]'
});
});
}

stella’s picture

Status: Needs review » Fixed

Fixed, thanks. It'll be included in the next dev release, available later today.

Status: Fixed » Closed (fixed)

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

armyofda12mnkeys’s picture

well I tried cutting and pasting, but didnt work for problem i had... the admin page, /admin/build/contact, ends with contact so it gets a popup too...

Solution to not build it for that specific link?:

function lightbox2_contact() {
$("a[@href$='/contact'], a[@href$='?q=contact']").not('[@href*=/admin/build/contact]').each(function() {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
rel: 'lightmodal[|width:650px; height:450px;]'
});
});
}

Also curious, a /user/login won't get class of lightbox processed if the user is signed in right? i noticed that, and it made sense, just wanted to make sure.