From 7f4a515649423047c5e78edec22743d78d23be4d Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 16 Feb 2010 02:38:46 +0000 Subject: [PATCH] BUGFIX: Fix navigator links not opening in new windows. (from r97510) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@99086 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/ContentController.php | 2 ++ javascript/SilverStripeNavigator.js | 19 ++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/control/ContentController.php b/core/control/ContentController.php index 6ebbc7ef7..cda800032 100755 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -312,6 +312,8 @@ class ContentController extends Controller { } $viewPageIn = _t('ContentController.VIEWPAGEIN', 'View Page in:'); + Requirements::customScript("window.name = windowName('site');"); + return <<
diff --git a/javascript/SilverStripeNavigator.js b/javascript/SilverStripeNavigator.js index 7ea108bfe..86cf32afb 100644 --- a/javascript/SilverStripeNavigator.js +++ b/javascript/SilverStripeNavigator.js @@ -1,20 +1,17 @@ -Behaviour.register({ - '#switchView a.newWindow' : { - onclick : function() { - var w = window.open(this.href,windowName(this.target)); - w.focus(); - return false; - } - } -}); - function windowName(suffix) { var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_'); return base + suffix; } -window.name = windowName('site'); (function($) { + $('#switchView a.newWindow').livequery('click', + function() { + var w = window.open(this.href, windowName(this.target)); + w.focus(); + return false; + } + ); + $('#SilverStripeNavigatorLink').livequery('click', function() { $('#SilverStripeNavigatorLinkPopup').toggle();