only click on links, fixes #1245
This commit is contained in:
parent
61438b85eb
commit
9b518676ae
1 changed files with 4 additions and 6 deletions
|
@ -218,15 +218,13 @@ pandora.clickLink = function(e) {
|
||||||
|
|
||||||
pandora.createLinks = function($element) {
|
pandora.createLinks = function($element) {
|
||||||
function isExternalLink(target) {
|
function isExternalLink(target) {
|
||||||
return $(target).is('a') && (
|
return target.hostname != document.location.hostname
|
||||||
target.hostname != document.location.hostname
|
|| Ox.startsWith(target.pathname, '/static');
|
||||||
|| Ox.startsWith(target.pathname, '/static')
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
$element
|
$element
|
||||||
.on({
|
.on({
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
if(isExternalLink(e.target)) {
|
if($(e.target).is('a') && isExternalLink(e.target)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.open('/url=' + encodeURIComponent(e.target.href), '_blank');
|
window.open('/url=' + encodeURIComponent(e.target.href), '_blank');
|
||||||
}
|
}
|
||||||
|
@ -235,7 +233,7 @@ pandora.createLinks = function($element) {
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
singleclick: function(e) {
|
singleclick: function(e) {
|
||||||
if(!isExternalLink(e.target)) {
|
if($(e.target).is('a') && !isExternalLink(e.target)) {
|
||||||
pandora.clickLink(e);
|
pandora.clickLink(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue