From da77fa00d946d7eea5091e44b6e9d1dd97ab895a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 3 Mar 2014 20:08:55 +0000 Subject: [PATCH] dont open mailto: links via /url=, fixes #2349 --- static/js/utils.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/js/utils.js b/static/js/utils.js index a8c12836c..04d5e680a 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, {