diff --git a/admin/javascript/LeftAndMain.Content.js b/admin/javascript/LeftAndMain.Content.js index 2852be827..cbc9dc726 100644 --- a/admin/javascript/LeftAndMain.Content.js +++ b/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'; diff --git a/admin/javascript/LeftAndMain.Menu.js b/admin/javascript/LeftAndMain.Menu.js index aeb8226f1..7f6792d63 100644 --- a/admin/javascript/LeftAndMain.Menu.js +++ b/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)); \ No newline at end of file diff --git a/admin/javascript/lib.js b/admin/javascript/lib.js index 6df032e0c..c6437cc7e 100644 --- a/admin/javascript/lib.js +++ b/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)); \ No newline at end of file