diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-07-27 13:47:31 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-07-27 13:47:31 +0000 |
commit | acad96aa3f8d2079f4aeef9f4d4028583771f270 (patch) | |
tree | c01a5561c1f8b560623d5e8f350b6f605f74bbd2 /modules | |
parent | 98580eeb1290dada037d8e9389f86cec0d182f39 (diff) | |
download | brdo-acad96aa3f8d2079f4aeef9f4d4028583771f270.tar.gz brdo-acad96aa3f8d2079f4aeef9f4d4028583771f270.tar.bz2 |
- Patch #667012 by ksenzee, casey: remove (or fix) the opening of external links in a new browser window.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/overlay/overlay-parent.js | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js index 78ad6ec55..859091133 100644 --- a/modules/overlay/overlay-parent.js +++ b/modules/overlay/overlay-parent.js @@ -500,29 +500,31 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) { .attr('href', href); } } - // Open external links in a new window. - else if (target.hostname != window.location.hostname) { - // Add a target attribute to the clicked link. This is being picked up by - // the default action handler. - if (!$target.attr('target')) { - $target.attr('target', '_new'); - } - } - // Non-admin links should close the overlay and open in the main window. - // Only handle them if the overlay is open and the clicked link is inside - // the overlay iframe, else default action will do fine. + // Non-admin links should close the overlay and open in the main window, + // which is the default action for a link. We only need to handle them + // if the overlay is open and the clicked link is inside the overlay iframe. else if (this.isOpen && target.ownerDocument === this.iframeWindow.document) { - // When the link has a destination query parameter and that destination - // is an admin link we need to fragmentize it. This will make it reopen - // in the overlay. - var params = $.deparam.querystring(href); - if (params.destination && this.isAdminLink(params.destination)) { - var fragmentizedDestination = $.param.fragment(this.getPath(window.location), { overlay: params.destination }); - $target.attr('href', $.param.querystring(href, { destination: fragmentizedDestination })); + // Open external links in a new window. + if (target.hostname != window.location.hostname) { + // Add a target attribute to the clicked link. This is being picked up by + // the default action handler. + if (!$target.attr('target')) { + $target.attr('target', '_new'); + } + } + else { + // When the link has a destination query parameter and that destination + // is an admin link we need to fragmentize it. This will make it reopen + // in the overlay. + var params = $.deparam.querystring(href); + if (params.destination && this.isAdminLink(params.destination)) { + var fragmentizedDestination = $.param.fragment(this.getPath(window.location), { overlay: params.destination }); + $target.attr('href', $.param.querystring(href, { destination: fragmentizedDestination })); + } + + // Make the link open in the immediate parent of the frame. + $target.attr('target', '_parent'); } - - // Make the link to be opening in the immediate parent of the frame. - $target.attr('target', '_parent'); } } }; |