summaryrefslogtreecommitdiff
path: root/modules/overlay
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-07-27 13:47:31 +0000
committerDries Buytaert <dries@buytaert.net>2010-07-27 13:47:31 +0000
commitacad96aa3f8d2079f4aeef9f4d4028583771f270 (patch)
treec01a5561c1f8b560623d5e8f350b6f605f74bbd2 /modules/overlay
parent98580eeb1290dada037d8e9389f86cec0d182f39 (diff)
downloadbrdo-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/overlay')
-rw-r--r--modules/overlay/overlay-parent.js44
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');
}
}
};