diff --git a/static/canjs.js b/static/canjs.js index 0892a9e6..54769e69 100644 --- a/static/canjs.js +++ b/static/canjs.js @@ -36,13 +36,12 @@ var $articleContainer, // Override link behavior $(document.body).on("click", "a", function(ev) { var noModifierKeys = !ev.altKey && !ev.ctrlKey && !ev.metaKey && !ev.shiftKey, - sameHostname = this.hostname === window.location.hostname, - sameProtocol = this.protocol === window.location.protocol; + sameHostname = (ev.target.hostname || this.hostname) === window.location.hostname, + sameProtocol = (ev.target.protocol || this.protocol) === window.location.protocol; if (noModifierKeys && sameHostname && sameProtocol) { ev.preventDefault(); - var href = this.href; - navigate(href); + navigate(ev.target.href || this.href); } }).on('keyup', 'input[type="checkbox"]', function(e){ var $target = $(e.target); diff --git a/static/search.js b/static/search.js index ea05711a..ba6c5db0 100644 --- a/static/search.js +++ b/static/search.js @@ -516,6 +516,17 @@ var Search = Control.extend({ } return "/" + this.url; + }, + addTargetToExternalURLs: function(html){ + var $html = $('