Apply Greybox to all ext links

ramndump - April 23, 2009 - 03:13
Project:External Links
Version:5.x-1.7
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

I am using this mod currently, but after seeing this http://drupal.org/project/greybox mod I wonder if this feature could be added to ext links? Instead of opening new windows, open greybox or thickbox.

#1

quicksketch - April 23, 2009 - 04:06
Status:active» won't fix

No, I will not add this functionality, nor would I accept a patch if it were provided. With 8 different *box plugins out there, I'm not committing to any of them. If your *box plugin uses jQuery, I'd suggest adding the code yourself in your theme, something like $('a.ext').greybox(), would find all external links on the page (as long as it ran after extlink.js).

#2

ramndump - April 23, 2009 - 15:42

True there are several *box out there, but none do *box for ext links. Most are for imgs, galleries, and vids.

I will keep looking tho.

Thanks

#3

ramndump - April 26, 2009 - 11:05

For anyone interested in making this work, here is the fix for it. I wont write a patch since it will not be applied, but the fix is simple. It works with http://drupal.org/project/lightbox2 module.

After installing Lightbox2 mod,

edit line #66 of extlink.module file from:
'#return_value' => '_blank',

to
'#return_value' => 'lightframe',

Then edit line # 80 of extlink.js file from:
$(external_links).attr('target', Drupal.settings.extlink.extTarget);

to
$(external_links).attr('rel', Drupal.settings.extlink.extTarget);

This will allow all external site links to open in lightbox iframe.

#4

jdexter - May 23, 2009 - 02:50

Salutations:

New to drupal, so please excuse me if this is in the wrong place to post this - have been stuggling with menus returning rawurlencode javascript links and finally gave up - will try to rework them as external links to greybox instead.

So regarding lightbox/greybox mod - here is the external link hack detail for 5.*.

After installing

edit line #66 of extlink.module file from:
'#return_value' => '_blank',

to
'#return_value' => 'greybox',

Then edit line # 80 of extlink.js file from:
$(external_links).attr('target', Drupal.settings.extlink.extTarget);

to
$(external_links).attr('class', Drupal.settings.extlink.extTarget);

This will then allow all external links to open in greybox.

Hope this saves someone else another damned 10 hours I'm never going to get back ... :/ ...

Cheers and best wishes.

Jon

#5

Hotlikecold - September 14, 2009 - 05:20

Yeah, this works for me great! I used lightbox but, I might try greybox on some of my other sites.

You can see it in action here: http://news.goodtimessociety.com/

I have problems with some news sites who break my modal window somehow on opening. Anybody know how to make this stop?

 
 

Drupal is a registered trademark of Dries Buytaert.