only click on links, fixes #1245

This commit is contained in:
j 2013-02-13 04:54:16 +00:00
parent 61438b85eb
commit 9b518676ae

View file

@ -218,15 +218,13 @@ pandora.clickLink = function(e) {
pandora.createLinks = function($element) {
function isExternalLink(target) {
return $(target).is('a') && (
target.hostname != document.location.hostname
|| Ox.startsWith(target.pathname, '/static')
)
return target.hostname != document.location.hostname
|| Ox.startsWith(target.pathname, '/static');
}
$element
.on({
click: function(e) {
if(isExternalLink(e.target)) {
if($(e.target).is('a') && isExternalLink(e.target)) {
e.preventDefault();
window.open('/url=' + encodeURIComponent(e.target.href), '_blank');
}
@ -235,7 +233,7 @@ pandora.createLinks = function($element) {
})
.bindEvent({
singleclick: function(e) {
if(!isExternalLink(e.target)) {
if($(e.target).is('a') && !isExternalLink(e.target)) {
pandora.clickLink(e);
}
}