Posted by dboulet on May 6, 2009 at 6:33pm
| Project: | External Links |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I noticed that if the extlink JavaScript code is run on a page more than once, all external links receive multiple icons. In my case, this is happening when I use a pager provided by a view that loads content using ajax--an icon is added every time that I use the pager.
I suggest modifying the JavaScript code in such a way that it ensures that only one icon is added per link, either by searching for the presence of a previously added icon, or maybe by simply checking the link for the "ext" class.
Comments
#1
That's strange that the view page is causing the extlink icons to be doubled up, as Extlink should only find links within the new content loaded on the page. However, it'd be good to prevent this doubling-up even if it isn't extlink's fault. This patch should prevent these icons from ever being doubled up. If you can test it out I'd appreciate it.
#2
Thanks quicksketch, I'll test the patch and get back to you tomorrow. I think that in my case the doubling is happening because I have multiple views embedded on the same page--I'm guessing that the JavaScript is being re-run on all of them.
#3
Patch works great, tested with Firefox, Opera, Chrome, Safari, IE7, IE6 on WinXP and Firefox, Safari on Mac OSX.
One question: should we be worried about people who add an "ext" class to their links in their markup? These links wouldn't get an icon.
#4
I committed this patch, thanks for testing!
We probably shouldn't affect these links, especially since modules like External Links Filter (http://drupal.org/project/elf) also use the "ext" link class and adds its own styling. Of course if you've installed that module and this one, you'd probably have problems anyway.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.