From ca50e1dc5410325fb5367b7c6573ba69a02c5e2a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 1 Feb 2013 14:06:22 +0000 Subject: [PATCH] prevent popup blocker for external links --- static/js/pandora/utils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 0af3b472f..5e6195c7b 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -219,7 +219,16 @@ pandora.clickLink = function(e) { pandora.createLinks = function($element) { $element .on({ - click: function() { + click: function(e) { + if( + $(e.target).is('a') && ( + e.target.hostname != document.location.hostname + || Ox.startsWith(e.target.pathname, '/static') + ) + ) { + e.preventDefault(); + window.open('/url=' + encodeURIComponent(e.target.href), '_blank'); + } return false; } })