Browse files

BUGFIX Replaced logic for checking external URLs in CMS Menu with mor…

…e stable jQuery Mobile codebase (fixes problems on IE not loading menu entries via ajax) (#7002)
  • Loading branch information...
1 parent 58433d3 commit c518a19ec2e41609cfcc6f218c3e39f876e07943 @chillu chillu committed Mar 30, 2012
Showing with 6 additions and 14 deletions.
  1. +3 −3 admin/javascript/LeftAndMain.Content.js
  2. +3 −7 admin/javascript/LeftAndMain.Menu.js
  3. +0 −4 admin/javascript/lib.js
View
6 admin/javascript/LeftAndMain.Content.js
@@ -159,10 +159,10 @@
self.submitForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp, formData);
}
- // Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
+ // Simulates a redirect on an ajax response - just exchange the URL without re-requesting it.
if(window.History.enabled) {
var url = xmlhttp.getResponseHeader('X-ControllerURL');
- if(url) window.history.replaceState({}, '', url);
+ if(url) window.History.replaceState({}, '', url);
}
// Re-init tabs (in case the form tag itself is a tabset)
@@ -287,7 +287,7 @@
var url = $(node).find('a:first').attr('href');
if(url && url != '#') {
- if($(node).find('a:first').is(':internal')) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
+ if($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
// Reload only edit form if it exists (side-by-side view of tree and edit view), otherwise reload whole panel
if(container.find('.cms-edit-form').length) {
url += '?cms-view-form=1';
View
10 admin/javascript/LeftAndMain.Menu.js
@@ -207,16 +207,16 @@
onclick: function(e) {
// Only catch left clicks, in order to allow opening in tabs.
// Ignore external links, fallback to standard link behaviour
- if(e.which > 1 || this.is(':external')) return;
+ var isExternal = $.path.isExternal(this.attr('href'));
+ if(e.which > 1 || isExternal) return;
e.preventDefault();
var item = this.getMenuItem();
var url = this.attr('href');
- if(this.is(':internal')) url = $('base').attr('href') + url;
+ if(!isExternal) url = $('base').attr('href') + url;
var children = item.find('li');
-
if(children.length) {
children.first().find('a').click();
} else {
@@ -261,8 +261,4 @@
});
});
-
- // Internal Helper
- $.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
- $.expr[':'].external = function(obj){return !$(obj).is(':internal');};
}(jQuery));
View
4 admin/javascript/lib.js
@@ -232,8 +232,4 @@
};
$.path = path;
-
- // Internal Helper
- $.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
- $.expr[':'].external = function(obj){return !$(obj).is(':internal')};
}(jQuery));

0 comments on commit c518a19

Please sign in to comment.