diff --git a/static/js/utils.js b/static/js/utils.js index a8c12836..04d5e680 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -283,7 +283,7 @@ pandora.clickLink = function(e) { } pandora.URL.push(e.target.pathname, true); } else { - window.open('/url=' + encodeURIComponent(e.target.href), '_blank'); + pandora.openLink(e.target.href); } }; @@ -302,7 +302,7 @@ pandora.createLinks = function($element) { ) { e.preventDefault(); if (isExternalLink(e.target)) { - window.open('/url=' + encodeURIComponent(e.target.href), '_blank'); + pandora.openLink(e.target.href); } else { pandora.clickLink(e); } @@ -1937,6 +1937,14 @@ pandora.logEvent = function(data, event, element) { } }; +pandora.openLink = function(url) { + if (Ox.startsWith(url, 'mailto:')) { + window.open(url); + } else { + window.open('/url=' + encodeURIComponent(url), '_blank'); + } +}; + pandora.signin = function(data) { // fixme: this is still voodoo pandora.user = Ox.extend(data.user, {