diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-07-29 14:54:27 -0400 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-07-29 14:54:27 -0400 |
commit | 5aca26cc08c0183d2b82d62d845e62e28f3a5992 (patch) | |
tree | b4a1fce4ad8f80c2d11d02f34d0174a8101486c3 /modules/overlay | |
parent | 110712521c22286b9f2a7aedea8df0d66be4e6f3 (diff) | |
download | brdo-5aca26cc08c0183d2b82d62d845e62e28f3a5992.tar.gz brdo-5aca26cc08c0183d2b82d62d845e62e28f3a5992.tar.bz2 |
- Patch #1174686 by ksenzee: overlay parent improperly opens child overlay on specific external links.
Diffstat (limited to 'modules/overlay')
-rw-r--r-- | modules/overlay/overlay-parent.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js index 8f11df669..8010d01b2 100644 --- a/modules/overlay/overlay-parent.js +++ b/modules/overlay/overlay-parent.js @@ -346,6 +346,10 @@ Drupal.overlay.setFocusBefore = function ($element, document) { * TRUE if the URL represents an administrative link, FALSE otherwise. */ Drupal.overlay.isAdminLink = function (url) { + if (Drupal.overlay.isExternalLink(url)) { + return false; + } + var path = this.getPath(url); // Turn the list of administrative paths into a regular expression. @@ -363,6 +367,20 @@ Drupal.overlay.isAdminLink = function (url) { }; /** + * Determine whether a link is external to the site. + * + * @param url + * The url to be tested. + * + * @return boolean + * TRUE if the URL is external to the site, FALSE otherwise. + */ +Drupal.overlay.isExternalLink = function (url) { + var re = RegExp('^((f|ht)tps?:)?//(?!' + window.location.host + ')'); + return re.test(url); +}; + +/** * Event handler: resizes overlay according to the size of the parent window. * * @param event |